implement ros2 control for a 4 wheel differential drive robot
Hello. I am trying to implement ros2 control (controller manager(YAML) and resource manager(URDF)) for controlling a 4 wheel robot. I have been following this video https://youtu.be/4QKsDf1c4hc but the problem is this video is for a 2 wheel robot and i want the same for a 4 wheel robot. I made the changes that if felt like but it dose'nt seems to work. The robot isnt moving at all. To keep things simple i am only using the frromnt 2 wheels and have set the friction of others 2 wheels near to zero.
Version: ROS2 Foxy
NOET: The formatting of this question is not good as i don't use answers.ros.org much.
Here is the Terminal window. It says "No Parameter file provided. Configuration might be wrong.".
The ".yaml" file:
controller_manager: ros_parameters: update_rate: 30 use_sim_time: true
diff_cont: type: diff_drive_controller/DiffDriveController joint_broad: type: joint_state_broadcaster/JointStateBroadcaster
diff_cont: ros__parameters:
publish_rate: 50.0 base_frame_id: base_link left_wheel_names: ['left_front_wheel_joint'] right_wheel_names: ['right_front_wheel_joint'] wheel_separation: 0.36 wheel_radius: 0.1 use_stamped_vel: false # open_loop: false # wheels_per_side: x # wheel_separation_multiplier: x # left_wheel_radius_multiplier: x # right_wheel_radius_multiplier: x # odom_frame_id: x # pose_covariance_diagonal: x # twist_covariance_diagonal: x # open_loop: x # enable_odom_tf: x # cmd_vel_timeout: x # publish_limited_velocity: x # velocity_rolling_window_size: x # linear.x.has_velocity_limits: false # linear.x.has_acceleration_limits:
false # linear.x.has_jerk_limits: false # linear.x.max_velocity: NAN # linear.x.min_velocity: NAN # linear.x.max_acceleration: NAN # linear.x.min_acceleration: NAN # linear.x.max_jerk: NAN # linear.x.min_jerk: NAN
# angular.z.has_velocity_limits: false # angular.z.has_acceleration_limits:
false # angular.z.has_jerk_limits: false # angular.z.max_velocity: NAN # angular.z.min_velocity: NAN # angular.z.max_acceleration: NAN # angular.z.min_acceleration: NAN # angular.z.max_jerk: NAN # angular.z.min_jerk: NAN
joint_broad:
ros__parameters:
The Launch File:
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription from launch.actions import IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node
def generate_launch_description():
# Include the robot_state_publisher launch file, provided by our own package. Force sim time to be enabled
# !!! MAKE SURE YOU SET THE PACKAGE NAME CORRECTLY !!!
package_name='my_bot' #<--- CHANGE ME
rsp = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory(package_name),'launch','rsp.launch.py'
)]), launch_arguments={'use_sim_time': 'true'}.items()
)
# Include the Gazebo launch file, provided by the gazebo_ros package
gazebo = IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
get_package_share_directory('gazebo_ros'), 'launch', 'gazebo.launch.py')]),
)
# Run the spawner node from the gazebo_ros package. The entity name doesn't really matter if you only have a single robot.
spawn_entity = Node(package='gazebo_ros', executable='spawn_entity.py',
arguments=['-topic', 'robot_description',
'-entity', 'my_bot'],
output='screen')
# Launch them all!
return LaunchDescription([
rsp,
gazebo,
spawn_entity,
])
The urdf file:
<robot <a="" href="http://xmlns:xacro="http://www.ros.org/wiki/xacro">xmlns:xacro="http://www.ros.org/wiki/..." ><="" p=""> </robot>
<xacro:include filename="inertial_macros.xacro"/>
<material name="white">
<color rgba="1 1 1 1" />
</material>
<material name="orange">
<color rgba="1 0.3 0.1 1" />
</material>
<material name="blue">
<color rgba="0.2 0.2 1 1" />
</material>
<material name="black">
<color rgba="0 0 0 1" />
< ...