Joint_State_Controller Message wrongfully Populated

asked 2019-09-07 13:36:18 -0500

Dragonslayer gravatar image

updated 2019-09-12 17:03:47 -0500

gvdhoorn gravatar image

Hi,

Basic Setup:

  • Two microcontrollers feeding rosserial (looking for rs485 tutorial or examples, by the way) Encoder
    Information and receiving motor cmd. 4x encoder and motor cmd per mc. They run the exactly same program just
    other names for the topics.
  • Launching two serial nodes (2 ports, 2 names), one for each mc.
  • Messages all arrive in the appropriate namespace.
  • HW-Interface based on https://github.com/cyborg-x1/ros_cont...

Problem:

  1. Only the data from the first 4 topics/encoders gets published in the Joint_State msg. Those four are also coming from one single mc, and are by default the first four Names/datafields in the message.
  2. For some strange reason Joint_State_Controller "copies" the data into fields of other Joints, exactly the ones I cant get to publish by themself.

What could this all be about?

  • I checked naming, datafield etc. mixups.
  • I switched the controllers ports, its just always the same controller
    that "gets the go".
  • Changed position of controllers in config.yaml and .launch nothing
    changed.

Would be nice if someone could give me an Idea where to look for a solution, or even better point me to a rs485 HW interface. Thanks Matt

EDIT:

I didnt have the latest version on this computer but the handles part didnt change. For some reason I cant copy it to the Strg-K, it just takes the first line, so here it is the dirty way.

hardware_interface::JointStateHandle state_handle_a("blsteer", &pos[0], &vel[0], &eff[0]); //pos vel eff outputs of the state message...
   jnt_state_interface.registerHandle(state_handle_a);
   hardware_interface::JointStateHandle state_handle_b("brsteer", &pos[1], &vel[1], &eff[1]); //pos vel eff outputs of the state message...
   jnt_state_interface.registerHandle(state_handle_b);
   hardware_interface::JointStateHandle state_handle_c("blwwheel", &pos[2], &vel[2], &eff[2]); //pos vel eff outputs of the state message...
   jnt_state_interface.registerHandle(state_handle_c);
   hardware_interface::JointStateHandle state_handle_d("brwwheel", &pos[3], &vel[3], &eff[3]); //pos vel eff outputs of the state message...
   jnt_state_interface.registerHandle(state_handle_d);
   hardware_interface::JointStateHandle state_handle_e("flsteer", &pos[4], &vel[4], &eff[4]); //pos vel eff outputs of the state message...
   jnt_state_interface.registerHandle(state_handle_e);
   hardware_interface::JointStateHandle state_handle_f("frsteer", &pos[5], &vel[5], &eff[5]); //pos vel eff outputs of the state message...
   jnt_state_interface.registerHandle(state_handle_f);
   hardware_interface::JointStateHandle state_handle_g("flwwheel", &pos[6], &vel[6], &eff[6]); //pos vel eff outputs of the state message...
   jnt_state_interface.registerHandle(state_handle_g);
   hardware_interface::JointStateHandle state_handle_h("frwwheel", &pos[7], &vel[7], &eff[7]); //pos vel eff outputs of the state message...
   jnt_state_interface.registerHandle(state_handle_h);

   hardware_interface::JointHandle pos_handle_a(jnt_state_interface.getHandle("blsteer"), &cmd[0]); //cmd is the commanded value depending on the controller.
   hardware_interface::JointHandle pos_handle_b(jnt_state_interface.getHandle("brsteer"), &cmd[1]); //cmd is the commanded value depending on the controller.
   hardware_interface::JointHandle vel_handle_a(jnt_state_interface.getHandle("blwwheel"), &cmd[2]); //cmd is the commanded value depending on the controller.
   hardware_interface::JointHandle vel_handle_b(jnt_state_interface.getHandle("brwwheel"), &cmd[3]); //cmd is the commanded value depending on the controller.
   hardware_interface::JointHandle pos_handle_c(jnt_state_interface.getHandle("flsteer"), &cmd[4]); //cmd is the commanded value depending on the controller.
   hardware_interface::JointHandle pos_handle_d(jnt_state_interface.getHandle("frsteer"), &cmd[5]); //cmd is the commanded value depending ...
(more)
edit retag flag offensive close merge delete

Comments

rosserial requires special care when publishing arrays/lists. Can you show a snippet where you initialise, populate and finally publish the JointState msgs?

gvdhoorn gravatar image gvdhoorn  ( 2019-09-09 02:12:58 -0500 )edit

Thanks for the comment. Its ros_control/controller_manager/joint_state_controller that takes care of the JointState message. The Input messages from the mc´s that I provide are all available and outputing data in ROS as "rostopic echo" shows. And 4 work fine with joint_states except the copying around. I suspect that the "copying around" is actually what blocks the other data from being "used".

Dragonslayer gravatar image Dragonslayer  ( 2019-09-12 07:26:03 -0500 )edit

If you believe that your hw interface is OK (and the way you communicate with it from your microcontrollers) then we'd need to see the ros_control configuration and perhaps even the hardware_interface. Without some more info I think it'd be difficult to help you.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-12 07:28:29 -0500 )edit

Thanks for the reply. To get HW Interface (linked above) to work with topics input and output I had to break every c++ convention there is. Iam now making a proper one with classic serial communication. Maybe I find the time to clean the rosserial HW Interface up and post it in the future. ros_control configuration? Is it config/controllers.yaml, launchfile for the controller spawner? The thing is JSC always copies into those wrong fields, even if I not configure and use the 4 aditional controllers/topics etc. It just always does it.

After all I was just looking for a quick fix, and to point to a possible bug in joint_state_controllers.

Dragonslayer gravatar image Dragonslayer  ( 2019-09-12 08:23:53 -0500 )edit

The joint_state_controller does almost nothing. It's just a few pointers and some copies.

But it's your hardware_interface that is in charge of registering those pointers (in the JointState handles). That's why I'm suspicious of your hardware_interface.

But without seeing some code or something, I'm afraid I can't help you.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-12 08:27:30 -0500 )edit

Edited the question and pasted the handles part of HW Interface.

Dragonslayer gravatar image Dragonslayer  ( 2019-09-12 08:46:50 -0500 )edit