[WIP] Enforce joint limits#223
Conversation
|
I'll let @fmauch do the detailed review, but two high-level comments:
Edit: looks like the |
Yes from the boilerplate. There are very few examples out there :) |
Then we should mention that somewhere. It might even be a good idea to put that code in a separate |
|
Will you do that @ipa-hsd ? (just making sure) |
Yes working on it. |
|
All checks passed, but not tested yet and updating as per @gavanderhoorn's comments. |
fmauch
left a comment
There was a problem hiding this comment.
This roughly looks quite good.
Because of the missing vector initialization I cannot test this currently, but I'll be happy to test this once that's done.
| std::size_t joint_id) | ||
| { | ||
| // Default values | ||
| joint_position_lower_limits_[joint_id] = -std::numeric_limits<double>::max(); |
There was a problem hiding this comment.
As far as I can see, this vector doesn't get resized anywhere, which would making this call illegal.
| bool has_soft_limits = false; | ||
|
|
||
| // Get limits from URDF | ||
| if (urdf_model_ == NULL) |
There was a problem hiding this comment.
| if (urdf_model_ == NULL) | |
| if (urdf_model_ == nullptr) |
| urdf::JointConstSharedPtr urdf_joint = urdf_model_->getJoint(joint_names_[joint_id]); | ||
|
|
||
| // Get main joint limits | ||
| if (urdf_joint == NULL) |
There was a problem hiding this comment.
| if (urdf_joint == NULL) | |
| if (urdf_joint == nullptr) |
| if (urdf_joint->type != urdf::Joint::CONTINUOUS) | ||
| ROS_WARN_STREAM("Joint " << joint_names_[joint_id] | ||
| << " does not have a URDF " | ||
| "position limit"); |
There was a problem hiding this comment.
This isn't only referring to position limits, right? We could change the output that no limits are configured for that joint in the URDF.
| { | ||
| ROS_INFO_STREAM("Waiting for model URDF on the ROS param server at location: " << nh.getNamespace() | ||
| << param_name); | ||
| nh.getParam(param_name, urdf_string); | ||
| } |
There was a problem hiding this comment.
This block doesn't make sense to me. In which situation should searchParam fail but getParam work? Am I missing anything?
There was a problem hiding this comment.
You are right. Removed it for the next commit.
|
@ipa-hsd Any plans / resources to continue this? |
|
@fmauch sorry for the delay. Was occupied last week. I have separated the code from the boilerplate example in a separate file. Please take a look if that make sense because I have not made it as a separate class, but just a separate @gavanderhoorn I have also added the original license from the example. |
| * \brief Applies joint limits & soft joint limits on position, velocity & effort defined in URDF / parameter server | ||
| * | ||
| */ | ||
| void registerJointLimits(ros::NodeHandle& robot_hw_nh, const hardware_interface::JointHandle& joint_handle_position, |
There was a problem hiding this comment.
Does this function apply the limits or register the limits? I guess, the docstring needs to be adapted.
| std::string input_recipe_filename; | ||
|
|
||
| // Load URDF file from parameter server | ||
| loadURDF(robot_hw_nh, "robot_description"); |
There was a problem hiding this comment.
This should probably be the root_nh
| *********************************************************************/ | ||
|
|
||
| /* Author: Dave Coleman | ||
| Desc: Helper ros_control hardware interface that loads configurations |
There was a problem hiding this comment.
I think a note where this file comes from and that you added modifications to it (if you did) might be nice to add here.
|
@ipa-hsd: would you see a chance to finish this? |
|
Any idea about: |
|
@ipa-hsd: could be ros-infrastructure/answers.ros.org#209. |
|
The checks look good now. |
|
What's the status on this? |
|
This PR hasn't made any progress for quite some time and will be closed soon. Please comment if it is still relevant. |
|
though not being updated in a while, this topic is still important. |
|
This PR hasn't made any progress for quite some time and will be closed soon. Please comment if it is still relevant. |
Related to #198
[WIP] since have not tested.