Robotics StackExchange | Archived questions

How to interface a C program with Gazebo (without ROS) ?

Hello,

Is there a way to interface a C program with Gazebo ? Let's say I have a C program for making autonomous navigation with my robot, and I want to validate it in simulation.
I just need to replace the sensor input by a subscription to the sensor data coming from gazebo, and to export the actuators commands to gazebo.
Is it possible to do that ? I don't see any C API for Gazebo.
I don't want to use ROS, because it means that I would have to rewrite the sequencer in the ROS node.

Thanks in advance

Asked by Clement on 2022-06-16 08:58:17 UTC

Comments

Answers

I think there is a gazebo transport system that allows you to interact with the gazebo server using messages. https://github.com/gazebosim/gz-transport

https://gazebosim.org/api/transport/11.0/tutorials.html

I also have a hard time finding good documentation.

Asked by marc-marc on 2022-06-22 08:37:31 UTC

Comments

The doc says: "C++ is the native implementation and so far the only way to use the library. We hope to offer different wrappers for the most popular languages in the future."

Asked by Clement on 2022-06-24 02:45:03 UTC

You can interact with gazebo using the C++ library. I finally managed to get it to work.

Here is my c++ script to set the pose of an object in gazebo. https://github.com/gazebosim/gz-transport/issues/323#issuecomment-1171263362

Asked by marc-marc on 2022-06-30 09:08:39 UTC

I think the best way is to use sockets to make the C program communicate with a ROS node that will make the bridge with Gazebo.

Asked by Clement on 2022-06-24 02:45:54 UTC

Comments