Robotics StackExchange | Archived questions

Tracked Vehicle cmd_vel topic ROS2

Hi there,

I'm using ROS2 Humble on Ubuntu 22.04

i want to simulate a tracked Vehicle in Gazebo with the "libSimpleTrackedVehiclePlugin.so". Everything works fine in gazebo. I can control the Robot with the libKeysToCmdVelPlugin.so. But i can't control the robot by publishing the cmdvel topic in ROS2. I already found this: https://github.com/lprobsth/gazeborostrackedvehicle_interface

Unfortunately this package ist for ROS not for ROS2. Is it possilbe to convert it in a ROS2 package? I'm on the very beginning on my ROS career, sorry...

Thank you very much

Asked by bafhcs on 2023-06-19 08:51:07 UTC

Comments

Sure, its always possible to convert a ROS 1 package to ROS 2.

Asked by stevemacenski on 2023-06-19 14:09:49 UTC

i already startet to convert in to ROS2. For me its very difficult because i have only few experience. I created a new ROS2 branch and forked the repo. I would be very thankful if we work together on this project https://github.com/fab-sch/gazebo_ros_tracked_vehicle_interface/tree/ros2

Asked by bafhcs on 2023-06-19 14:44:39 UTC

I don't think you need to port that package. I think you can use the ros gazebo brigde.

Asked by jrtg on 2023-06-20 05:40:31 UTC

Answers

I tested it, it is fairly easy with the ros_gz_bridge:

  1. Start the simulation: gz sim ./tracked_vehicle_simple.sdf (or ign sim ... depending on the Gazebo version)

  2. In another terminal, start the bridge:

ros2 run ros_gz_bridge parameter_bridge /model/simple_tracked/cmd_vel@geometry_msgs/msg/Twist]gz.msgs.Twist


  1. Publish Twist messages from your ROS node, or e.g. from the cli:

ros2 topic pub /model/simple_tracked/cmd_vel geometry_msgs/msg/Twist "linear: { x: 1 }"


Note that, depending on your Gazebo version, you might have to write gz.msgs.Twist in step 2, or ignition.msgs.Twist as 'ignition' was renamed to 'gz' starting from Gazebo Garden.

Note also that gz topic -l currently does not list topics to which there is no active publisher. If you're not sure to which topic you should publish, start the simulation with option '-v 4', e.g. gz sim ./tracked_vehicle_simple.sdf -v 4 and typically it will be mentioned in the debug output.

Asked by jrtg on 2023-06-20 07:07:29 UTC

Comments

thank you very much!! i just updated to gazebo garden because i had Gazebo 11 installed. Unfortunately gz sim crashes immediatley after the start...

xxx@LIFEBOOK:~$ gz sim Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. terminate called after throwing an instance of 'Ogre::RenderingAPIException' what(): OGRE EXCEPTION(3:RenderingAPIException): Vertex Program 100000000VertexShader_vs failed to compile. See compile log above for details. in GLSLShader::compile at ./RenderSystems/GL3Plus/src/GLSL/OgreGLSLShader.cpp (line 361) Stack trace (most recent call last) in thread 6364: 10 Object "[0xffffffffffffffff]", at 0xffffffffffffffff, in 9 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f6f45d269ff, in 8 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f6f45c94b42, in 7 Object "/lib/x86_64-linux-gnu/libQt5Core.so.5", at 0x7f6f3f49199d, in 6 Object "/lib/x86_64-linux-gnu/libQt5Core.so.5", at 0x7f6f3f48ff90, in qTerminate() 5 Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7f6f414ae2b6, in std::terminate() 4 Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7f6f414ae24b, in 3 Object "/lib/x86_64-linux-gnu/libstdc++.so.6", at 0x7f6f414a2bbd, in 2 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f6f45c287f2, in abort 1 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f6f45c42475, in raise 0 Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f6f45c96a7c, in pthread_kill

Asked by bafhcs on 2023-06-20 07:55:06 UTC

Comments

I don't know.

Try the following command: gz sim -v 4 --render-engine ogre2 and see if it either works or if there is more info in the debug output.

Alternatively, try with an sdf, e.g. gz sim -v 4 minimal_scene.sdf

Asked by jrtg on 2023-06-23 02:47:06 UTC