Skip to content
Draft
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -398,13 +398,13 @@ When the Gazebo world is launched you can run the following command to move the

.. code-block:: shell

ros2 run gz_ros2_control_demos example_mobile_robots
ros2 run gz_ros2_control_demos example_mobile_robots --ros-args -p use_sim_time:=true

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
ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -p stamped:=true -p use_sim_time:=true

You can also manually publish on the ``/cmd_vel`` topic to drive the robots:

Expand Down
46 changes: 21 additions & 25 deletions gz_ros2_control_demos/config/tricycle_drive_controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,40 @@ joint_state_broadcaster:

tricycle_controller:
ros__parameters:
type: tricycle_controller/TricycleController
type: tricycle_steering_controller/TricycleSteeringController

# Model
traction_joint_name: traction_joint # Name of traction joint in URDF
steering_joint_name: steering_joint # Name of steering joint in URDF
wheel_radius: 0.3 # Radius of front wheel
traction_joints_names: ["traction_joint"] # Name of traction joint in URDF
steering_joints_names: ["steering_joint"] # Name of steering joint in URDF
traction_wheels_radius: 0.3 # Radius of front wheel
wheelbase: 1.7 # Distance between center of back wheels and front wheel

# Rate Limiting
linear:
x:
max_acceleration: 5.0
max_deceleration: -8.0
max_jerk: 1000.0
angular:
z:
max_velocity: 1.0
max_acceleration: 5.0
max_deceleration: -8.0
max_jerk: 1000.0

# Odometry
odom_frame_id: odom
base_frame_id: base_link
open_loop: false # if True, uses cmd_vel instead of hardware interface feedback to compute odometry
enable_odom_tf: true # If True, publishes odom<-base_link TF
odom_only_twist: false # If True, publishes on /odom only linear.x and angular.z; Useful for computing odometry in another node, e.g robot_localization's ekf
pose_covariance_diagonal: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] # Need to be set if fusing odom with other localization source
twist_covariance_diagonal: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] # Need to be set if fusing odom with other localization source
velocity_rolling_window_size: 10 # Rolling window size of rcppmath::RollingMeanAccumulator applied on linear and angular speeds published on odom

# Rate Limiting
traction: # All values should be positive
# min_velocity: 0.0
# max_velocity: 1000.0
# min_acceleration: 0.0
max_acceleration: 5.0
# min_deceleration: 0.0
max_deceleration: 8.0
# min_jerk: 0.0
# max_jerk: 1000.0
steering:
min_position: -1.57
max_position: 1.57
# min_velocity: 0.0
max_velocity: 1.0
# min_acceleration: 0.0
# max_acceleration: 1000.0
reduce_wheel_speed_until_steering_reached: true # If true, limits wheel speed when steering angle is far from reference to avoid slipping.

# cmd_vel input
cmd_vel_timeout: 500 # In milliseconds. Timeout to stop if no cmd_vel is received
reference_timeout: 0.5 # In seconds. Timeout to stop if no cmd_vel is received

# Debug
publish_ackermann_command: true # Publishes AckermannDrive. The speed does not comply to the msg definition, it the wheel angular speed in rad/s.
# debug
publish_limited_velocity: true
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def generate_launch_description():
'--param-file',
robot_controllers,
'--controller-ros-args',
'-r /tricycle_controller/cmd_vel:=/cmd_vel'
'-r /tricycle_controller/reference:=/cmd_vel'
],
)

Expand Down
2 changes: 2 additions & 0 deletions gz_ros2_control_demos/urdf/test_tricycle_drive.xacro.urdf
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
<parent link="chassis" />
<child link="steering_link" />
<axis xyz="0 0 1" />
<limit effort="100" velocity="1" lower="-1.57" upper="1.57" />
</joint>

<!-- traction wheel link -->
Expand Down Expand Up @@ -148,6 +149,7 @@
<child link="wheel_front_link" />
<origin xyz="0 0 0" rpy="-1.57 1.57 0" />
<axis xyz="0 0 1" />
<limit effort="100" velocity="1"/>
</joint>

<ros2_control name="GazeboSystem" type="system">
Expand Down
Loading