Getting custom values in joint_limits.yaml from python
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}