Ask Your Question
0

Rename JOINT_NAMES in ur_driver test_move.py [closed]

asked 2014-10-20 10:58:23 -0600

updated 2014-10-21 04:02:50 -0600

gvdhoorn gravatar image

I rosrun ur_driver test_move.py and would like to change the names of the joints which used. Originally they are initialized in the test_move.py, sadly I can't just edit this file, so I would like to find out if I can do this maybe with a launch file.

In test_move.py the joint names are saved in a character array like this:

JOINT_NAMES = ['shoulder_pan_joint','shoulder_lift_joint',...]

The overall question: Can I effect the names of the joints via a launchfile. If yes how and if not, are there other ways to effect it.

My thoughts are about a Launch-File like this:

<node pkg="ur_driver" type="test_move.py" name="follow_joint_trajectory">
<param name="JOINT_NAMES" value="['J0','J1',...]"/>
</node>

EDIT 1: During writing I may already obtained my answer. I need to check at home. If you probably know something important to know about please feel free as to answer me. I am not sure about how to write value="['J0','J1',...]" in an exact way. I still get an error.

EDIT 2: So far I tried about and read the information about the <param> tag, but as I understand it is not changing the variables used within the file. And there was also no reaction yet. This is my launch file: <launch>

<arg name="robot_ip" />

<param name="/robot_ip_address" type="str" value="$(arg robot_ip)"/>

<node pkg="industrial_robot_client" type="robot_state" name="robot_state"/>

<node pkg="industrial_robot_client" type="motion_streaming_interface" name="motion_streaming_interface"/>

<node pkg="industrial_robot_client" type="joint_trajectory_action" name="joint_trajectory_action"/>

<node pkg="ur_driver" type="test_move.py" name="follow_joint_trajectory">
    <param name="JOINT_NAMES" value="['J0','J1','J2','J3','J4','J5']"/>
    <remap from="follow_joint_trajectory/cancel" to="/joint_trajectory_action/cancel"/>
    <remap from="follow_joint_trajectory/feedback" to="/joint_trajectory_action/feedback"/>
    <remap from="follow_joint_trajectory/goal" to="/joint_trajectory_action/goal"/>
    <remap from="follow_joint_trajectory/result" to="/joint_trajectory_action/result"/>
    <remap from="follow_joint_trajectory/status" to="/joint_trajectory_action/status"/>
</node></launch>

Is there a way to change this on the fly or do I need to build the test_move.py in a new package with the right names?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by RosBort
close date 2014-11-24 04:44:19.999386

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-10-21 14:02:04 -0600

updated 2014-10-22 04:46:35 -0600

For solving my problem I split it up in two approaches:

  1. Copy test_move.py into my own package and change the joint names, as well as the topic name it advertises.
  2. Use features that are already implemted in ROS-I and do needed changes via launch file.

Informations that are important for both approaches: Out of a joint_names.yaml, which I found here, I got the names the Joints should have.

The first approach: I copied the test_move.py in a package created by myself and got it to run with changing the JOINT_NAMES and the topic advertised. Here are the lines I modified:

JOINT_NAMES = ['joint_1', 'joint_2', 'joint_3', 'joint_4', 'joint_5', 'joint_6']
client = actionlib.SimpleActionClient('joint_trajectory_action', FollowJointTrajectoryAction)

And I call it with these commands:

roscore
roslaunch industrial_robot_client robot_interface_streaming.launch robot_ip:=192.168.0.101
rosrun rospy_pkg test_move

This for the first works! But results in an error message listed bellow in this question.

The second approach: Later on I found here, that the process of copying the test_move.py and modify it is not necessary. One can use the original test_move.py in the ur_driver package and set the rosparam controller_joint_names. It will have the same effect as writing an own modified test_move.py.

<launch>
   <arg name="robot_ip" />
   <param name="/robot_ip_address" type="str" value="$(arg robot_ip)"/>
   <rosparam param="controller_joint_names">['shoulder_pan_joint', 'shoulder_lift_joint', 'elbow_joint','wrist_1_joint', 'wrist_2_joint', 'wrist_3_joint']</rosparam>

   <node pkg="industrial_robot_client" type="robot_state" name="robot_state"/>
   <node pkg="industrial_robot_client" type="motion_streaming_interface" name="motion_streaming_interface"/>
   <node pkg="industrial_robot_client" type="joint_trajectory_action" name="joint_trajectory_action">
      <remap from="joint_trajectory_action/feedback" to "follow_joint_trajectory/feedback"/>
   </node>
   <node pkg="ur_driver" type="test_move.py" name="follow_joint_trajectory">
      <remap from="follow_joint_trajectory/cancel" to="/joint_trajectory_action/cancel"/>
      <remap from="follow_joint_trajectory/goal" to="/joint_trajectory_action/goal"/>
      <remap from="follow_joint_trajectory/result" to="/joint_trajectory_action/result"/>
      <remap from="follow_joint_trajectory/status" to="/joint_trajectory_action/status"/>
   </node>
</launch>

This also works! But results in the same error message as approach nr. 1 mentioned above. Here is the error message:

[joint_trajectory_action-X] process has died [pid 19413, exit code -6, cmd /opt/ros/hydro/lib/industrial_robot_client/joint_trajectory_action

So far I found out it has to do with the remapping of the the .../feedback topic. Attention! In Version Nr. 2 I do a remapping in the launch file. In Version Nr. 1 it is done by ROS-I automatically. Any ideas what and why it happens?

edit flag offensive delete link more

Comments

Parts of the errormessage of both procedures that I forgot:

joint_trajectory_action: /usr/include/boost/smart_ptr/shared_ptr.hpp:418: T* boost::shared_ptr<T>::operator->() const [with T = const control_msgs::FollowJointTrajectoryFeedback_<std::allocator<void> >]: Assertion `px != 0' failed.
RosBort gravatar imageRosBort ( 2014-10-21 14:07:02 -0600 )edit

1) There is no test_move.py in industrial_robot_client, 2) "set a rosparam according to the launch file here below": that only works for the nodes in industrial_robot_client, not for your test_move.py. Really, just update the Python test script, don't make things harder than they need be.

gvdhoorn gravatar imagegvdhoorn ( 2014-10-22 01:45:19 -0600 )edit

You need to change the jointnames because by default (as you found), industrial_robot_client (IRC) uses joint_1, joint_2, etc. That needs to match the names in the goal that you send to the joint_trajectory_action node. Either update test_move.py, or use controller_joint_names for IRC.

gvdhoorn gravatar imagegvdhoorn ( 2014-10-22 01:48:48 -0600 )edit

I did how you said. I am updating my answer at the moment for better understandability.

RosBort gravatar imageRosBort ( 2014-10-22 03:40:15 -0600 )edit

Your approach is sane, you have just run into a bug, see industrial_core/issues/85. The ActionServer needs feedback from your robot to see whether a TrajPt has been reached. You're not sending any, and it causes the crash.

gvdhoorn gravatar imagegvdhoorn ( 2014-10-22 04:57:09 -0600 )edit

And again: you should've updated your original question with this new info.

gvdhoorn gravatar imagegvdhoorn ( 2014-10-22 04:59:04 -0600 )edit

This is really usual for me running into a bug, but thanks god you told me. I need some time to read through this. I wanted to give an answer this time and start a new question. But how it is in the life of a technician four hours are nothing compared to our projects and pass much too fast.

RosBort gravatar imageRosBort ( 2014-10-22 05:17:07 -0600 )edit

Ok it was not so much to read and not too complicated. It seems like there is no workaround at the moment without one of the ROS-I controllers with the specific drivers. I guess you also don't know if something will be done? How can I do something?

RosBort gravatar imageRosBort ( 2014-10-22 05:35:09 -0600 )edit
0

answered 2014-10-21 04:01:55 -0600

gvdhoorn gravatar image

I would just make a copy of test_move.py. Then change the names of the joints in your copy. You can also then just change the topic name the ActionClient is using, removing the need for the remapping lines in your launchfile.

As this is just a temporary test, this should be fine.

'Real' ROS-Industrial packages typically include a joint_names.yaml file, which gets loaded before starting any nodes that need that information. See the robot_interface_streaming_m10ia.launch in the M-10iA support package for an example (but this would obviously not work with test_move.py, as it hard codes the joint names).

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-10-20 10:58:23 -0600

Seen: 276 times

Last updated: Oct 22 '14