Articulated vehicle control in gazebo and ROS

asked 2020-05-13 04:08:56 -0600

adel gravatar image

updated 2020-05-22 05:47:50 -0600

Hello all, I have an articulated vehicle model in (urdf.xacro) format. The vehicle has two parts (front and rear) connected to each other by a joint. I have established a node (in python) which has:

  1. a publisher, which publish a new model pose to the topic gazebo/set_model_state.
  2. a service /gazebo/set_model_configuration, which controls the position of the joint.

After connecting gazebo to ROS and starting this node, controlling the model was fine. NOW, I have to control each part autonomously (considering each part as a separate model). Therefore,

  1. I established two xacro files one for each part, thus, I get two models (front model and rear model)
  2. For each model, I created a launch file
  3. Finally I created launch file to launch both models together into gazebo. The two models will launch as they were connected to each other.

Afterward, I rewrote the python code to control two models instead of one. In This node, I am using the topic gazebo/set_model_state to send new poses of the models.

And I got the following problems:

  1. If I started gazebo "unpaused" the two models push each other randomly and fly around.
  2. Even when starting gazebo "paused", when giving an articulated angle command, each model has to change its orientation angle relative to the articulated angle, but only the rear part does that.

I will be very appreciated to get any help from you to solve these problems. Best regards

EDITED: The problem was solved by defining the both model as kinematic models in the xacro files.

edit retag flag offensive close merge delete


Perhaps the models are constantly in collision therefor trying to get away from each other and "flying around". Perhaps you do not want the parts of the vehicle to collide, because they are actually just one model. Here is a way how to make two gazebo models to ingore the collision between each other

kumpakri gravatar imagekumpakri ( 2020-05-18 05:39:21 -0600 )edit

Thanks for your answer and sorry for the late response, I tried the way you mentioned but it isn't work. Actually I'm working with URDF not with sdf format and sometimes some properties do not work properly in gazebo. But anyway thanks again for the help and the problem was solved by making the two models as kinematic models

adel gravatar imageadel ( 2020-05-22 05:46:01 -0600 )edit

It would be nice if you could describe how you solved this in an answer to your own question and then click the check button to accept your answer.

kumpakri gravatar imagekumpakri ( 2020-05-22 07:08:56 -0600 )edit