Skip to content
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

[WIP] Enforce joint limits #223

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

hsd-dev
Copy link

@hsd-dev hsd-dev commented Jul 7, 2020

Related to #198
[WIP] since have not tested.

@gavanderhoorn
Copy link
Contributor

gavanderhoorn commented Jul 7, 2020

I'll let @fmauch do the detailed review, but two high-level comments:

  1. was this code copied from somewhere? I seem to recognise it as the code used in the ros_control boilerplate for loading limits from the parameter server. If it was copied (doesn't matter from where), this fact should be recorded somewhere -- probably with a copyright statement and attribution somewhere
  2. to make the diff easier to follow: try to avoid whitespace and layout changes (unless clang format asks/demands it)

Edit: looks like the format_check test failed.

@hsd-dev
Copy link
Author

hsd-dev commented Jul 7, 2020

was this code copied from somewhere?

Yes from the boilerplate. There are very few examples out there :)

@gavanderhoorn
Copy link
Contributor

was this code copied from somewhere?

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 .cpp. That would make it even easier to add a license block at the top of the file.

@gavanderhoorn
Copy link
Contributor

Will you do that @ipa-hsd ? (just making sure)

@hsd-dev
Copy link
Author

hsd-dev commented Jul 7, 2020

Will you do that @ipa-hsd ?

Yes working on it.

@hsd-dev
Copy link
Author

hsd-dev commented Jul 7, 2020

All checks passed, but not tested yet and updating as per @gavanderhoorn's comments.
Do Not Merge.

Copy link
Collaborator

@fmauch fmauch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 1109 to 1113
{
ROS_INFO_STREAM("Waiting for model URDF on the ROS param server at location: " << nh.getNamespace()
<< param_name);
nh.getParam(param_name, urdf_string);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block doesn't make sense to me. In which situation should searchParam fail but getParam work? Am I missing anything?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Removed it for the next commit.

@fmauch fmauch added the wrid20 label Jul 7, 2020
@fmauch
Copy link
Collaborator

fmauch commented Jul 20, 2020

@ipa-hsd Any plans / resources to continue this?

@hsd-dev
Copy link
Author

hsd-dev commented Jul 21, 2020

@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 .cpp

@gavanderhoorn I have also added the original license from the example.

Comment on lines 165 to 168
* \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,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this function apply the limits or register the limits? I guess, the docstring needs to be adapted.

@@ -72,6 +75,9 @@ bool HardwareInterface::init(ros::NodeHandle& root_nh, ros::NodeHandle& robot_hw
std::string output_recipe_filename;
std::string input_recipe_filename;

// Load URDF file from parameter server
loadURDF(robot_hw_nh, "robot_description");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be the root_nh

*********************************************************************/

/* Author: Dave Coleman
Desc: Helper ros_control hardware interface that loads configurations
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@gavanderhoorn
Copy link
Contributor

@ipa-hsd: would you see a chance to finish this?

@hsd-dev
Copy link
Author

hsd-dev commented Oct 9, 2020

@fmauch a1422f1 addresses your previous comments.

@hsd-dev
Copy link
Author

hsd-dev commented Oct 9, 2020

Any idea about:

  Starting function 'before_init'
  E: Failed to fetch http://packages.ros.org/ros/ubuntu/dists/xenial/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
  E: Some index files failed to download. They have been ignored, or old ones used instead.

@gavanderhoorn
Copy link
Contributor

@ipa-hsd: could be ros-infrastructure/answers.ros.org#209.

@hsd-dev
Copy link
Author

hsd-dev commented Oct 12, 2020

The checks look good now.

@ljden
Copy link

ljden commented Jun 21, 2021

What's the status on this?

@github-actions
Copy link

github-actions bot commented Apr 8, 2023

This PR hasn't made any progress for quite some time and will be closed soon. Please comment if it is still relevant.

@github-actions github-actions bot added the Stale label Apr 8, 2023
@fmauch
Copy link
Collaborator

fmauch commented Apr 11, 2023

though not being updated in a while, this topic is still important.

@github-actions github-actions bot removed the Stale label Apr 11, 2023
@github-actions
Copy link

This PR hasn't made any progress for quite some time and will be closed soon. Please comment if it is still relevant.

@github-actions github-actions bot added the Stale label Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants