# Revision history [back]

### Can somone 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:

1. How to access the diff drive plugin from my code (what is the #include).

2. What functions do I need to use to get the robot to move in the simulation

3. How to link this plugin to my pioneer2dx model in the world file.

### Can somone 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:

1. How to access the diff drive plugin from my code (what is the #include).

2. What functions do I need to use to get the robot to move in the simulation

3. How to link this plugin to my pioneer2dx model in the world file.

## 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:

why would my world file be giving me an error to do with ros::init()?

### Can somone 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:

1. How to access the diff drive plugin from my code (what is the #include).

2. What functions do I need to use to get the robot to move in the simulation

3. How to link this plugin to my pioneer2dx model in the world file.

## 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 .done
Warning [parser.cc:437] Converting a deprecated SDF source[data-string]. 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()?

### Can somone 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:

1. How to access the diff drive plugin from my code (what is the #include).

2. What functions do I need to use to get the robot to move in the simulation

3. How to link this plugin to my pioneer2dx model in the world file.

## 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 REQUIRED)
find_package(std_msgs REQUIRED)
include_directories(${roscpp_INCLUDE_DIRS}) include_directories(${std_msgs_INCLUDE_DIRS})

I can now successfully open my world with the diff drive plugin attached to the pioneer2dx, without errors

HOWEVER, I am still having one more issue: while the simulation is running, if i type "rostopic list" into a terminal window, I don't find cmd_vel topic...

icepaka89@icepaka89-MacBook:~/algsim_ws/src/sim_pkg/src/gzplugins/build$rostopic list /algorithm /robotCount /rosout /rosout_agg /world_complete Why can't I see the cmd_vel topic here? Isn't the diff drive plugin supposed to publish on this topic, based on my world file? Or am i not using rostopic correctly? ### Can somone 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: 1. How to access the diff drive plugin from my code (what is the #include). 2. What functions do I need to use to get the robot to move in the simulation 3. 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 REQUIRED) find_package(std_msgs REQUIRED) include_directories(${roscpp_INCLUDE_DIRS})
include_directories(${std_msgs_INCLUDE_DIRS}) I can now successfully open my world with the diff drive plugin attached to the pioneer2dx, without errors HOWEVER, I am However this is still having one more issue: while thing I don't understand -- I know I need to publish messages to the cmd_vel topic, but what type of message do I need to publish exactly? How can I manipulate the robot in the simulation is running, if i type "rostopic list" into a terminal window, I don't find cmd_vel topic... icepaka89@icepaka89-MacBook:~/algsim_ws/src/sim_pkg/src/gzplugins/build$ rostopic list
/algorithm
/robotCount
/rosout
/rosout_agg
/world_complete

Why can't I see the cmd_vel topic here? Isn't the diff drive plugin supposed to publish on by publishing messages to this topic, based on my world file? Or am i not using rostopic correctly?topic? Thanks

 6 None Peter Mitrano 653 ●10 ●19 ●29 http://petermitrano.gi...

### Can somone 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:

1. How to access the diff drive plugin from my code (what is the #include).

2. What functions do I need to use to get the robot to move in the simulation

3. How to link this plugin to my pioneer2dx model in the world file.

## 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 REQUIRED)
find_package(std_msgs REQUIRED)
include_directories(${roscpp_INCLUDE_DIRS}) include_directories(${std_msgs_INCLUDE_DIRS})

I can now successfully open my world with the diff drive plugin attached to the pioneer2dx, without errors

However this is still one more thing I don't understand -- I know I need to publish messages to the cmd_vel topic, but what type of message do I need to publish exactly? How can I manipulate the robot in the simulation by publishing messages to this topic? Thanks