Skip to content

[WIP] Enforce joint limits#223

Open
hsd-dev wants to merge 5 commits into
UniversalRobots:masterfrom
hsd-dev:joint_limits
Open

[WIP] Enforce joint limits#223
hsd-dev wants to merge 5 commits into
UniversalRobots:masterfrom
hsd-dev:joint_limits

Conversation

@hsd-dev

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

Copy link
Copy Markdown

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

Comment thread ur_robot_driver/include/ur_robot_driver/ros/hardware_interface.h Outdated
@gavanderhoorn

gavanderhoorn commented Jul 7, 2020

Copy link
Copy Markdown
Contributor

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

hsd-dev commented Jul 7, 2020

Copy link
Copy Markdown
Author

was this code copied from somewhere?

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

@gavanderhoorn

Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

@hsd-dev

hsd-dev commented Jul 7, 2020

Copy link
Copy Markdown
Author

Will you do that @ipa-hsd ?

Yes working on it.

@hsd-dev

hsd-dev commented Jul 7, 2020

Copy link
Copy Markdown
Author

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

@fmauch fmauch left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
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

fmauch commented Jul 20, 2020

Copy link
Copy Markdown
Contributor

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

@hsd-dev

hsd-dev commented Jul 21, 2020

Copy link
Copy Markdown
Author

@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
Copy Markdown
Contributor

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.

std::string input_recipe_filename;

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

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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
Copy Markdown
Contributor

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

@hsd-dev

hsd-dev commented Oct 9, 2020

Copy link
Copy Markdown
Author

@fmauch a1422f1 addresses your previous comments.

@hsd-dev

hsd-dev commented Oct 9, 2020

Copy link
Copy Markdown
Author

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
Copy Markdown
Contributor

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

@hsd-dev

hsd-dev commented Oct 12, 2020

Copy link
Copy Markdown
Author

The checks look good now.

@ljden

ljden commented Jun 21, 2021

Copy link
Copy Markdown

What's the status on this?

@github-actions

github-actions Bot commented Apr 8, 2023

Copy link
Copy Markdown

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

fmauch commented Apr 11, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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