Robotics StackExchange | Archived questions

Joint_State_Controller Message wrongfully Populated

Hi,

Basic Setup:

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 JointStateController "copies" the data into fields of other Joints, exactly the ones I cant get to publish by themself.

What could this all be about?

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 on the controller.
   hardware_interface::JointHandle vel_handle_c(jnt_state_interface.getHandle("flwwheel"), &cmd[6]); //cmd is the commanded value depending on the controller.
   hardware_interface::JointHandle vel_handle_d(jnt_state_interface.getHandle("frwwheel"), &cmd[7]); //cmd is the commanded value depending on the controller.

Asked by Dragonslayer on 2019-09-07 13:36:18 UTC

Comments

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

Asked by gvdhoorn on 2019-09-09 02:12:58 UTC

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".

Asked by Dragonslayer on 2019-09-12 07:26:03 UTC

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.

Asked by gvdhoorn on 2019-09-12 07:28:29 UTC

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.

Asked by Dragonslayer on 2019-09-12 08:23:53 UTC

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.

Asked by gvdhoorn on 2019-09-12 08:27:30 UTC

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

Asked by Dragonslayer on 2019-09-12 08:46:50 UTC

Answers