ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
0

Getting custom values in joint_limits.yaml from python

asked 2021-12-07 14:57:34 -0600

Peter_Mitrano gravatar image

I would like to put a custom field "min_nonzero_velocity" in the joint_limits.yaml file for my robot, and read that in my python code. Currently, I'm using the following but it feels very hacky and I'm wondering if there's a better way?

# robot_namespace is given by the user, specifying this cannot be avoided
robot_description = ns_join(robot_namespace, 'robot_description')
joint_limits_param = rospy.get_param(self.robot_description + '_planning/joint_limits')
self.min_velocities = {k: v['min_nonzero_velocity'] for k,v in joint_limits_param}

What's bad:

  • I'm hard coding _planning/joint_limits, but that could change and is an internal detail of moveit/the yaml config
  • the RobotCommander object I am already using elsewhere has already done the work of parsing out all the joint_limits yaml stuff, so potentially it could have that information. However AFAIK it only parses the known fields and won't include my custom field

A nice middle ground would be something like

p = moveit.get_joint_limits_param_name(robot_namespace='hdt_michigan')
joint_limits_param = rospy.get_param(p)
self.min_velocities = {k: v['min_nonzero_velocity'] for k,v in joint_limits_param}
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-12-07 15:30:00 -0600

Mike Scheutzow gravatar image

I think you're making this unnecessarily complicated. Just assign the private parameter in the launch file, and read it in your node. No need to involve either robot_description or joint_limits.yaml.

edit flag offensive delete link more

Comments

I disagree, I think joint_limit.yaml is a great place to put it, since it is a limit that varies per joint and that structure is exactly what joint_limits.yaml is for

Peter_Mitrano gravatar image Peter_Mitrano  ( 2021-12-07 15:53:49 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2021-12-07 14:57:34 -0600

Seen: 30 times

Last updated: Dec 07 '21