-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Icub dev #241
base: dev
Are you sure you want to change the base?
Icub dev #241
Conversation
added test move joints.
…s - upating few tests
@@ -419,3 +419,9 @@ def close(self) -> Type[ProcessModule]: | |||
""" | |||
raise NotImplementedError( | |||
f"There are no Process Modules for '{inspect.currentframe().f_code.co_name}' for robot '{self.robot_name}'") | |||
|
|||
def exit(self)->None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The exit method for Process modules is a nice idea.
But the actual code to exit the connection to a robot should be directly in the Process module.
Please also add an exit method to the ProcessModule parent class and then call the currently loaded ProcessModule.exit method from this method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this what i did ?
Would you explain more this part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes what you did is correct, I was just confused about the structure of the ProcessModuleManager
from ..datastructures.enums import JointType, ObjectType, Arms, ExecutionType, GripperState | ||
from ..external_interfaces import giskard | ||
from ..external_interfaces.robokudo import * | ||
import yarp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This add yarp as a hard dependency. Wrap this into a try, catch and add a log function in case the imports fail. Look here for reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
for i in hand_values: | ||
target_loc.addFloat32(i) | ||
|
||
print("command Ready to send to iCub part tcp") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use pycram.ros.logging instead of print statements, throughout the whole file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
return False | ||
|
||
HAND_CLOSED = [60.0,60.0,0,85.0,20,85,20,85,85] | ||
HAND_OPENED = [0 ,0 ,0,0 ,0 ,0 ,0 ,0 ,0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess these are joint values for the hand, they are already in the robot_description use these insetad and remove the global variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not all the joint are directly actuated 1:1.
In the robot description I have the values for every joint for close and open. However the control joints are different and also different values.
So this list is the actuated control values. which is only used for the real robot
What do you think ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, then you cloud put them in the move_gripper process module of the real robot. This way it should be clear where they are used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DONE
from ..external_interfaces.robokudo import * | ||
import yarp | ||
|
||
from pycram.yarp_utils.yarp_networking import NO_ACK_VOCAB, ACK_VOCAB, open_rpc_client_port, open_buffered_bottle_port, \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to move the calls to yarp into its own file and put this in external_interfaces instead of yarp_utils. So people know what purpose yarp has.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
test/test_icub.py
Outdated
ProcessModuleManager.execution_type = ExecutionType.SIMULATED | ||
cls.viz_marker_publisher = VizMarkerPublisher() | ||
|
||
def test_move_joint_direct(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no assert here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted the whole file, this was just for me to test the implementation.
I think I will try to make jupyter notebook on virtual labs for this instead of here
test/test_icub.py
Outdated
def test_move_joints_simulated(self): | ||
with simulated_robot: | ||
MoveJointsMotion(["torso_roll"], [math.radians(-20.0)]).perform() | ||
sleep(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these sleeps necessary? Are the calls in yarp asynchronous?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, not necessary, it was just too fast to see it in the simulation. Anyways, the whole file os removed :)
test/test_icub.py
Outdated
MoveGripperMotion(GripperState.CLOSE, Arms.LEFT).perform() | ||
sleep(10) | ||
MoveGripperMotion(GripperState.OPEN, Arms.RIGHT).perform() | ||
MoveGripperMotion(GripperState.OPEN, Arms.LEFT).perform() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also no asserts here. So you are only executing the motions and checking if nothing crashes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
test/test_icub.py
Outdated
|
||
|
||
def test_try_world(self): | ||
sleep(100) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What? Why?
I guess this was for testing, in this case please delete it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
test/test_icub.py
Outdated
|
||
|
||
with real_robot: | ||
yarpModule = run_icub_state_updater(['/', '--robot', 'icubSim']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is unittest.skip for this case, look here for reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please checkout the new default_process_modules and how specific process modules are handled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't change the default processing modules for the simulated robot.
I used them as it is.
For the real robot, I implemented the specific functionalities to control icub in the right way.
Note: the tcp/looking/ etc poses are expected to be w.r.t. robot frame. At the moment as we don't have a simulated world for the real robot. maybe lateron, we can easily do the transformation.
If there is any other notes, please clarify what you mean.
Thanks
""" | ||
Initializes the YARP network. | ||
|
||
**Returns:** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please stick to the rst standard
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -0,0 +1,66 @@ | |||
from typing_extensions import Tuple,Optional | |||
|
|||
import yarp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs a try, catch block
loginfo("Received: another reply") | ||
return False | ||
|
||
def update_part(state_port,ctp_port, joint_to_change_idx, joints_to_change_pos): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add documentation here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
This point can either be a position or an object. | ||
""" | ||
|
||
def __init__(self,lock,cmd_port:yarp.RpcClient): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type annotation yarp.RpcClient will not work if yarp is not there. You can put it in quotation marks to prevent the interpreter evaluating it
I noticed that the CI/CD checks failed because of the imports of yarp. |
let me check again your last reviews. I just noticed it |
I went through the code again and all your comments. |
Dear all,
I create here the main pull request for the major updates of the integration of the iCub robot into pycram.
In the next 2 days, I will replace some prints with exception handling and add some documentation.
I create this pull request to initiate the process to speed up the integration.
Please have a look and let me know if there are any reviews
There are some requirements to have the code running. I will add all the details in README soon.
Thanks