-
Notifications
You must be signed in to change notification settings - Fork 948
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
Add namespace capabilities to moveit_commander #835
Add namespace capabilities to moveit_commander #835
Conversation
@@ -349,7 +379,7 @@ class MoveGroupInterfaceWrapper : protected py_bindings_tools::ROScppInitializer | |||
std::map<std::string, double> positions = getNamedTargetValues(name); | |||
std::map<std::string, double>::iterator iterator; | |||
|
|||
for (iterator = positions.begin(); iterator != positions.end(); iterator++) | |||
for (iterator = positions.begin(); iterator != positions.end(); ++iterator) |
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!
@@ -0,0 +1,68 @@ | |||
#!/usr/bin/env python | |||
|
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 standard BSD license with your name and short description
@@ -0,0 +1,69 @@ | |||
#!/usr/bin/env python | |||
|
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 standard BSD license with your name and short description
@@ -0,0 +1,68 @@ | |||
#!/usr/bin/env python | |||
|
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 standard BSD license with your name and short description
def tearDown(self): | ||
pass | ||
|
||
def check_target_setting(self, expect, *args): |
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.
rename something like test__group__set_joint_value_target
to make it easier to for future devs to understand what this test does
self.assertTrue(np.all(np.asarray(res) == np.asarray(expect)), | ||
"Setting failed for %s, values: %s" % (type(args[0]), res)) | ||
|
||
def test_target_setting(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.
I think I understand this test but it took me a few minutes to parse what you are doing here. You are testing all the different ways to assign joint values correct? Changing test_target_setting
to something like test__group__set_joint_value_target__methods
will go a long way helping future devs debug issues if these tests ever break
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've just copy and pasta'd the tests from here:
https://github.com/ros-planning/moveit/blob/kinetic-devel/moveit_ros/planning_interface/test/python_move_group.py
to test basic functionality.. its definitely more duplicated testing than intended.
self.group.set_joint_value_target(target) | ||
return self.group.plan() | ||
|
||
def test_validation(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.
rename something like test__group__execute_path_validation
to make it easier to understand what this test does
def tearDown(self): | ||
pass | ||
|
||
def check_target_setting(self, expect, *args): |
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.
rename something like test__group__set_joint_value_target
to make it easier to understand what this test does
self.assertTrue(np.all(np.asarray(res) == np.asarray(expect)), | ||
"Setting failed for %s, values: %s" % (type(args[0]), res)) | ||
|
||
def test_target_setting(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.
rename something like test__group__set_joint_value_target__methods
to make it easier to understand what this test does
def tearDown(self): | ||
pass | ||
|
||
def check_target_setting(self, expect, *args): |
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 as above
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, why the copy-paste? Is there a reason why you test these functions three times?
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 magic is all in the initialization of the test; was just ensuring "functionality" aka the robot can plan and execute as demonstrated in MoveGroupCommander tests. so I believe something like these tests should be tested against in each case
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.
Makes sense
"Setting failed for %s, values: %s" % (type(args[0]), res)) | ||
|
||
def test_target_setting(self): | ||
n = self.group.get_variable_count() |
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 as above
self.group.set_joint_value_target(target) | ||
return self.group.compute_plan() | ||
|
||
def test_validation(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.
same as above
self.group.set_joint_value_target(target) | ||
return self.group.plan() | ||
|
||
def test_validation(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.
same as above
The tests are failing. I've re-run the test locally and they also fail for me:
|
Adds a optional namespace argument to the python side of planning_scene_interface and passes it to the wrapped C++, which expects a namespace after moveit#835.
@@ -348,7 +348,7 @@ def new(self, status, attr): | |||
|
|||
class MoveitJoy: | |||
def parseSRDF(self): | |||
ri = RobotInterface("/robot_description") | |||
ri = RobotInterface("/robot_description", "") |
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.
@willcbaker #842 shows a similar issue like the one fixed here.
Why did you added an empty namespace here, instead of using an empty default in the RobotInterface
constructor?
@@ -109,6 +110,15 @@ class MoveGroupInterfaceWrapper : protected py_bindings_tools::ROScppInitializer | |||
return setJointValueTarget(js_msg); | |||
} | |||
|
|||
bool setStateValueTarget(const std::string& state_str) |
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.
@willcbaker I didn't realize that you just recently added this function.
This is highly dangerous, as it allows setting of joints that are not part of the JointModelGroup
!
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.
Exposing a publicly available c++ move group method
http://docs.ros.org/jade/api/moveit_ros_planning_interface/html/classmoveit_1_1planning__interface_1_1MoveGroup.html#ad35630dd853a734de3580390facf2c9b
iirc it was (is?) the only way to set a desired multi dof joint state.
@@ -118,6 +128,14 @@ class MoveGroupInterfaceWrapper : protected py_bindings_tools::ROScppInitializer | |||
return l; | |||
} | |||
|
|||
std::string getJointValueTarget() |
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 here. Why do you want to expose the internal RobotState?
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.
It's just a copy of the state, not quite exposing the internal rs. This compliments above; yes this might be possible to instead use a list like get Joint Value Target with joint states but does not have a clear explicit way to handle multi dof joints
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.
@willcbaker Please take a look at my post-merge comments on this PR, particularly in regard of #861.
{ | ||
node_handle_ = ros::NodeHandle(ns); |
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 local variable shouldn't have a trailing underscore.
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.
Correct, I think this was a rebase artifact as I had previously stored this namespace as a private variable in the class for some functionality that did was not targeted for this PR
@willcbaker This change-set caused several test regressions on the ROS build farm: Please have a look and fix them asap. Otherwise, we should revert those changes. The reason for this was that Travis used an updated |
no i don't know why the build farm failed to catch this! |
Description
Add namespace compatibility and tests to moveit commander
Checklist