Gazebo | Ignition | Community
Ask Your Question

Co-simulation between MatLab and Gazebo

asked 2021-08-18 02:04:27 -0600

maria gravatar image

I want to control a robotic manipulator using co-simulation between Simulink and Gazebo. I created a Gazebo plugin package by running the packageGazeboPlugin command in Matlab and then compiled it in the user/home directory. I copied file in the manipulator package (catkin_ws/devel/lib) then created a plugin file and included this file to the model .xacro file (i followed steps presented here -->

but when I use the Gazebo pacer block to test if Gazebo has synchronized or not, I receive "failed to connect to Gazebo plugin". Do you have any idea what is the problem?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-08-31 02:32:47 -0600

m.bahno gravatar image

Gazebo Co-Simulation plugin needs also another files to work properly. After compilation, several files and folders are created in export folder. They are need to be existing and GAZEBO_PLUGIN_PATH needs to be on/set to matlab_plugin/export/lib. Since you provided only the .so file, plugin was not able to find other files (for sommunication handlers, servers, ...). Note that also folder include must exist, even though it is not in export folder. This plugin is unfortunately a bit tricky with this...

edit flag offensive delete link more


Thank you for your answer. should I compile the Gazebo plugin package inside of my manipulator package? then, when I lunch the package the plugin package should be active? and where should I add export GAZEBO_PLUGIN_PATH=${GAZEBO_PLUGIN_PATH}: /home/user/src/GazeboPlugin/export ?.

maria gravatar imagemaria ( 2021-10-05 05:57:46 -0600 )edit

I compiled plugin in my ROS package, but it can be anywhere, as long as the path is in GAZEBO_PLUGIN_PATH. The plugin shall be added to model SDF file as any other plugin. And if you have the corresponding plugin .so file on the GAZEBO_PLUGIN_PATH path, it should work fine. Of course, the plugin needs to be compiled. You can export the value in the same terminal you run the roslaunch (before running it) or you can use env tag directly in .launch file.

m.bahno gravatar imagem.bahno ( 2021-10-15 02:39:25 -0600 )edit

Just a note to adding path: If you add only .../export/ to path, then you need to add plugin .so file as lib/ Alternatively, you can add to path .../export/lib and then just, which is cleaner in my opinion. But in Matlab example files, it is for some reason the other way...

m.bahno gravatar imagem.bahno ( 2021-10-15 02:47:44 -0600 )edit

Question Tools

1 follower


Asked: 2021-08-18 02:04:27 -0600

Seen: 5,273 times

Last updated: Aug 31 '21