Skip to content
Draft
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 34 additions & 17 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ URDF:
.. code-block:: xml

<gazebo>
<plugin filename="libgz_ros2_control-system.so" name="gz_ros2_control::GazeboSimROS2ControlPlugin">
<plugin filename="gz_ros2_control-system" name="gz_ros2_control::GazeboSimROS2ControlPlugin">
<parameters>$(find gz_ros2_control_demos)/config/cart_controller.yaml</parameters>
</plugin>
</gazebo>
Expand All @@ -142,7 +142,7 @@ SDF:

.. code-block:: xml

<plugin filename="libgz_ros2_control-system.so" name="gz_ros2_control::GazeboSimROS2ControlPlugin">
<plugin filename="gz_ros2_control-system.so" name="gz_ros2_control::GazeboSimROS2ControlPlugin">
<parameters>$(find gz_ros2_control_demos)/config/cart_controller.yaml</parameters>
</plugin>

Expand Down Expand Up @@ -172,7 +172,7 @@ URDF:
.. code-block:: xml

<gazebo>
<plugin filename="libgz_ros2_control-system.so" name="gz_ros2_control::GazeboSimROS2ControlPlugin">
<plugin filename="gz_ros2_control-system" name="gz_ros2_control::GazeboSimROS2ControlPlugin">
...
<ros>
<namespace>my_namespace</namespace>
Expand All @@ -185,7 +185,7 @@ SDF:

.. code-block:: xml

<plugin filename="libgz_ros2_control-system.so" name="gz_ros2_control::GazeboSimROS2ControlPlugin">
<plugin filename="gz_ros2_control-system" name="gz_ros2_control::GazeboSimROS2ControlPlugin">
...
<ros>
<namespace>my_namespace</namespace>
Expand Down Expand Up @@ -226,7 +226,7 @@ URDF:
...
<ros2_control>
<gazebo>
<plugin name="gz_ros2_control::GazeboSimROS2ControlPlugin" filename="libgz_ros2_control-system">
<plugin name="gz_ros2_control::GazeboSimROS2ControlPlugin" filename="gz_ros2_control-system">
...
</plugin>
</gazebo>
Expand All @@ -241,7 +241,7 @@ SDF:
</hardware>
...
<ros2_control>
<plugin name="gz_ros2_control::GazeboSimROS2ControlPlugin" filename="libgz_ros2_control-system">
<plugin name="gz_ros2_control::GazeboSimROS2ControlPlugin" filename="gz_ros2_control-system">
...
</plugin>

Expand Down Expand Up @@ -327,14 +327,38 @@ You can run some of the mobile robots running the following commands:
ros2 launch gz_ros2_control_demos diff_drive_example.launch.py
ros2 launch gz_ros2_control_demos tricycle_drive_example.launch.py
ros2 launch gz_ros2_control_demos ackermann_drive_example.launch.py
ros2 launch gz_ros2_control_demos mecanum_drive_example.launch.py

When the Gazebo world is launched you can run the following command to move the robots.

.. code-block:: shell

ros2 run gz_ros2_control_demos example_mobile_robots

You can also drive the robots from the keyboard using the following command:

.. code-block:: shell

ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -p stamped:=true

When the Gazebo world is launched you can run some of the following commands to move the robots.
You can also manually publish on the ``/cmd_vel`` topic to drive the robots:

.. code-block:: shell

ros2 run gz_ros2_control_demos example_diff_drive
ros2 run gz_ros2_control_demos example_tricycle_drive
ros2 run gz_ros2_control_demos example_ackermann_drive
ros2 topic pub --rate 10 /cmd_vel geometry_msgs/msg/TwistStamped "
twist:
linear:
x: 0.7
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 1.0"

For these demos you can verify that the robot is moving at the desired velocities be echoing the ``/gz/odom`` topic.
This topic gets the simulation-real odometry of the robot from Gazebo.
You can also echo the ``<controller_name>/odom`` topic to verify how accurate the odometry calculated by the controller is in comparison to the odometry from ``/gz/odom``.

To demonstrate the setup of a namespaced robot, run

Expand All @@ -348,13 +372,6 @@ which will launch a diff drive robot within the namespace ``r1``.

The ros2_control settings for the controller_manager and the controller defined in ``diff_drive_controller.yaml`` use wildcards to match all namespaces.

To run the Mecanum mobile robot run the following commands to drive it from the keyboard:

.. code-block:: shell

ros2 launch gz_ros2_control_demos mecanum_drive_example.launch.py
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -p stamped:=true

Gripper
-----------------------------------------------------------

Expand Down
7 changes: 3 additions & 4 deletions gz_ros2_control_demos/config/diff_drive_controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
joint_state_broadcaster:
type: joint_state_broadcaster/JointStateBroadcaster

/**/diff_drive_base_controller:
/**/diff_drive_controller:
ros__parameters:
type: diff_drive_controller/DiffDriveController
left_wheel_names: ["left_wheel_joint"]
right_wheel_names: ["right_wheel_joint"]

wheel_separation: 1.25
#wheels_per_side: 1 # actually 2, but both are controlled by 1 signal
wheel_radius: 0.3

wheel_separation_multiplier: 1.0
Expand All @@ -29,8 +28,8 @@
enable_odom_tf: true

cmd_vel_timeout: 0.5
#publish_limited_velocity: true
#velocity_rolling_window_size: 10
publish_limited_velocity: true
velocity_rolling_window_size: 10

# Velocity and acceleration limits
# Whenever a min_* is unspecified, default to -max_*
Expand Down
13 changes: 13 additions & 0 deletions gz_ros2_control_demos/config/ros_gz_bridge_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
- ros_topic_name: "/clock"
gz_topic_name: "/clock"
ros_type_name: "rosgraph_msgs/msg/Clock"
gz_type_name: "gz.msgs.Clock"
direction: GZ_TO_ROS

# Topic published by OdometryPublisher plugin, only for debugging purposes
- ros_topic_name: "/gz/odom"
gz_topic_name: "/gz/odom"
ros_type_name: "nav_msgs/msg/Odometry"
gz_type_name: "gz.msgs.Odometry"
direction: GZ_TO_ROS
62 changes: 0 additions & 62 deletions gz_ros2_control_demos/examples/example_ackermann_drive.cpp

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ int main(int argc, char * argv[])
rclcpp::init(argc, argv);

std::shared_ptr<rclcpp::Node> node =
std::make_shared<rclcpp::Node>("diff_drive_test_node");
std::make_shared<rclcpp::Node>("example_mobile_robots_node");

auto publisher = node->create_publisher<geometry_msgs::msg::TwistStamped>(
"/diff_drive_base_controller/cmd_vel", 10);
"/cmd_vel", 10);

RCLCPP_INFO(node->get_logger(), "node created");

Expand Down
54 changes: 0 additions & 54 deletions gz_ros2_control_demos/examples/example_tricycle_drive.cpp

This file was deleted.

Loading
Loading