Can someone please tell me how to use the diff drive plugin?
So I am very new to gazebo, working on my first project. So far my program spawns robots randomly in a given area. I want to be able to control them via a ROS node. Since Im using Pioneer2dx models, I am trying to use the diff drive plugin. I have spent literally days trying to find relevant information online, to no avail. I have also posted multiple forum questions on here and got answers that either didn't work or weren't useful to me. Here's what I REALLY need to know:
How to access the diff drive plugin from my code (what is the #include).
What functions do I need to use to get the robot to move in the simulation
How to link this plugin to my pioneer2dx model in the world file.
Please help! thanks in advance. . .
UPDATE
Here is my world file:
<sdf version="1.5"> <world name="default"> <include> <uri>model://sun</uri> </include>
<!-- A ground plane -->
<include>
<uri>model://ground_plane</uri>
</include>
<!-- Generate Population -->
<population name="pioneer_population1">
<!-- Define the population model type -->
<model name="pioneer1">
<include>
<static>false</static>
<uri>model://pioneer2dx</uri>
</include>
<!-- <plugin name="pioneer_prog" filename="libpioneer_prog.so"/> -->
<plugin name="differential_drive_controller" filename="libgazebo_ros_diff_drive.so">
<alwaysOn>true</alwaysOn>
<updateRate>10</updateRate>
<leftJoint>left_wheel_hinge</leftJoint>
<rightJoint>right_wheel_hinge</rightJoint>
<wheelSeparation>0.5380</wheelSeparation>
<wheelDiameter>0.2410</wheelDiameter>
<torque>20</torque>
<commandTopic>cmd_vel</commandTopic>
<odometryTopic>odom</odometryTopic>
<odometryFrame>odom</odometryFrame>
<robotBaseFrame>base_footprint</robotBaseFrame>
<robotNamespace>gz</robotNamespace>
</plugin>
</model>
<!-- Center spawn around (0,0,0) with orientation <0,0,0> -->
<pose>0 0 0 0 0 0</pose>
<!-- Size of spawn area -->
<box>
<size>8 8 0.01</size>
</box>
<!-- world_builder will insert this line based on user params -->
<!-- MODEL_COUNT -->
<!-- /MODEL_COUNT -->
<!-- Define how the models will be distributed -->
<!-- Distribution types: random, uniform, grid, linear-x,
liner-y, linear-z -->
<distribution>
<type>random</type>
</distribution>
</population>
</world>
</sdf>
I get this error when i try to open the world file:
Launching simulator. . .done
Warning [parser.cc:437] Converting a deprecated SDF source[data-string].
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
Couldn't find an AF_INET address for []
^CCouldn't find an AF_INET address for []
why would my world file be giving me an error to do with ros::init()?
UPDATE 2
As it turns out, the ros::init() error was caused by problems with my CMakeLists.txt file in my gazebo plugin directory. My file structure is the same as that used in the gazebo plugin tutorials. I needed to add these lines to CMakeLists.txt in order to include any ROS headers into my gazebo plugin:
find_package(roscpp ...