ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Outdoor trailer URDF model

asked 2018-07-30 16:45:36 -0500

mescarra gravatar image

Hello everyone.

So I'm facing a very basic scenario I'm having trouble setting up. It consists of a powered vehicle (4 wheels, rear transmission) drawing an unpowered trailer (2 wheels, no transmission). The hitch connecting the two parts is a joint that is not fixed, so the trailer won't be aligned with the vehicle when the vehicle is turning, just like an articulated bus.

What I need from this model is the trailer's pose relative to the vehicle, because my gps antenna is located somewhere in the vehicle and my camera is located somewhere in the trailer, so in order to project what my camera is seeing I need this transform to update in real-time.

So far, I have wrote the URDF file following the tutorial and controlled the wheels in my vehicle using rqt_robot_steering. Gazebo shows how the robot moves and publishes transforms for the hitch revolute joint. So far so good.

When I try to merge this to my real project, where the vehicle's location (base_link) is set by my high-freq, high-precision gps antenna and the ros package geonav_transform, I don't get the vehicle moving in Gazebo nor articulating in RViz. Probably because I need some sort of transmission to move the vehicle in Gazebo. The thing is, I don't even know if I actually need Gazebo for this. All I need is an approximate position for the trailer.

Any ideas on how I can deal with this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-07-30 18:32:53 -0500

Geoff gravatar image

updated 2018-07-30 18:36:14 -0500

You do not need Gazebo when you are working with the real hardware. Ideally, your packages should be set up so that they are agnostic to the vehicle running as a simulation in Gazebo or as real hardware.

Gazebo is not a visualisation tool, so when running the real hardware you should not expect Gazebo to respond.

Gazebo is providing joint position information and publishing transforms based on its simulation of the vehicle's bodies and joints. For your hardware, you will need to provide this information yourself. For example, you could put an encoder on the joint so that you can publish the position of the pivot between the powered vehicle and the trailer. You should publish this information to the /joint_states topic. The URDF tutorials have a good tutorial on how to do this. (For testing your URDF in rviz, you can use the joint_state_publisher GUI tool, which will mimic the joint position moving.)

Once you have the joint state being published, you need to publish the updated transforms to /tf. The robot_state_publisher node can do this for you automatically. It reads in your URDF and looks for new joint states, then publishes the updated transforms automatically.

When you get transforms flowing, everything will magically start working. rviz will display your articulated vehicle in its correct state, and you will be able to get the pose of the camera relative to the powered vehicle or to any other frame easily from tf.

edit flag offensive delete link more


Thank you very much

mescarra gravatar image mescarra  ( 2018-07-31 09:00:33 -0500 )edit

Question Tools



Asked: 2018-07-30 16:45:36 -0500

Seen: 615 times

Last updated: Jul 30 '18