switching between joint_state_publisher and custom made joint_val_publisher

asked 2019-10-23 21:20:55 -0500

anirban gravatar image

Hi,

I have a simulated robot in RViz which is a 7 DoF robot arm. It receives fake joint angle values from the node joint_state_publisher. But now I have written ROS service server and client nodes to compute motion plan as service response given initial and final joint poses as input to the service request. Next I have another node named execute_plan that publishes joint angles, obtained from motion plan, to /joint_states topic. The problem is that since joint_state_publisher have already been publishing the joint angles to the /joint_states topic, launching the node execute_plan results in publishing different joint angles to the same /joint_states topic. As a result, in RViz I see a wired motion of the robot arm. I understand this is happening because of two nodes publishing different values to the same topic simultaneously. What I want is to kill (or send it to idle) the joint_state_publisher node as long as execute_plan is done with executing the plan. Can anyone tell me how to send a running node to idle mode while keeping track of the status of the other node? Any help is appreciated.

edit retag flag offensive close merge delete

Comments

Hello @anirban, I have the EXACT same issue. Did you ever come to solve this? I am currently reading up on the proper use of JSP which I believe it the main issue. Please let me know if you have discovered anything!

matthewmarkey gravatar image matthewmarkey  ( 2020-05-24 04:02:04 -0500 )edit

@matthewmarkey: the issue the OP describes is due to the fact he's trying to use the JSP for commanding state. As I already wrote in your own question(s), that's not what it is for.

Additionally, OP hasn't remapped the topic the JSP publishes on, nor the topic(s) his own node(s) use. You'll then end-up with multiple publishers on the joint_states topic -- which in itself is not a problem, but it becomes a problem if those JointState messages contain information for the same joints.

Solution: don't use the JSP to command anything. And don't use it if you already have a robot driver / Gazebo / something else publishing actual, corresponding to the real-world JointState messages. There is no need for a JSP in that case, unless you need it to coalesce messages from multiple JointState publishers into a single, coherent 'view' of the ...(more)

gvdhoorn gravatar image gvdhoorn  ( 2020-05-24 04:18:05 -0500 )edit

Ok thank you for that prompt explanation.

I understand what you are saying about using the JSP to control the robot. I am not trying to coalesce multiple messages, just send the gazebo joint messages. So, I am just trying to disable the JSP at this point.

I have tried removing the node completely and then saving the launch file, but the model still behaves in the same manner as I have described to you many, many, many times, ha.

matthewmarkey gravatar image matthewmarkey  ( 2020-05-24 04:23:47 -0500 )edit

As I already wrote in #q352941, that most likely has nothing to do with the JSP being started or not.

And please don't post off-topic comments under other questions.

gvdhoorn gravatar image gvdhoorn  ( 2020-05-24 04:26:45 -0500 )edit