mateusmenezes95 / omnidirectional_controllers

ROS2 controllers for Omnidirectional robots with three wheels
MIT License
26 stars 4 forks source link

Hi #10

Open xianzhou127 opened 2 months ago

xianzhou127 commented 2 months ago

Your codes is useful ,but i meet some problems when i used it in my project. I almost finish it,but i get this

[gzserver-4] [INFO] [1713712162.652976630] [gazebo_ros2_control]: Loading gazebo_ros2_control plugin
[gzserver-4] [INFO] [1713712162.654715763] [robot_0.gazebo_ros2_control]: Starting gazebo_ros2_control plugin in namespace: /robot_0
[gzserver-4] [INFO] [1713712162.654818903] [robot_0.gazebo_ros2_control]: Starting gazebo_ros2_control plugin in ros 2 node: gazebo_ros2_control
[gzserver-4] [INFO] [1713712162.656256463] [robot_0.gazebo_ros2_control]: connected to service!! robot_state_publisher
[gzserver-4] [INFO] [1713712162.656628341] [robot_0.gazebo_ros2_control]: Received urdf from param server, parsing...
[gzserver-4] [INFO] [1713712162.656658385] [robot_0.gazebo_ros2_control]: Loading parameter files /home/robot/ROS2_omni_gazebo/install/models/share/models/config/omni_robot.yaml
[gzserver-4] [INFO] [1713712162.661470477] [robot_0.gazebo_ros2_control]: Loading joint: left_wheel_robot_0
[gzserver-4] [INFO] [1713712162.661503793] [robot_0.gazebo_ros2_control]:       State:
[gzserver-4] [INFO] [1713712162.661509935] [robot_0.gazebo_ros2_control]:                position
[gzserver-4] [INFO] [1713712162.661514600] [robot_0.gazebo_ros2_control]:                velocity
[gzserver-4] [INFO] [1713712162.661517598] [robot_0.gazebo_ros2_control]:       Command:
[gzserver-4] [INFO] [1713712162.661548673] [robot_0.gazebo_ros2_control]:                velocity
[gzserver-4] [INFO] [1713712162.661554499] [robot_0.gazebo_ros2_control]: Loading joint: back_wheel_robot_0
[gzserver-4] [INFO] [1713712162.661557957] [robot_0.gazebo_ros2_control]:       State:
[gzserver-4] [INFO] [1713712162.661560698] [robot_0.gazebo_ros2_control]:                position
[gzserver-4] [INFO] [1713712162.661563436] [robot_0.gazebo_ros2_control]:                velocity
[gzserver-4] [INFO] [1713712162.661565992] [robot_0.gazebo_ros2_control]:       Command:
[gzserver-4] [INFO] [1713712162.661581531] [robot_0.gazebo_ros2_control]:                velocity
[gzserver-4] [INFO] [1713712162.661587194] [robot_0.gazebo_ros2_control]: Loading joint: right_wheel_robot_0
[gzserver-4] [INFO] [1713712162.661590127] [robot_0.gazebo_ros2_control]:       State:
[gzserver-4] [INFO] [1713712162.661592801] [robot_0.gazebo_ros2_control]:                position
[gzserver-4] [INFO] [1713712162.661595556] [robot_0.gazebo_ros2_control]:                velocity
[gzserver-4] [INFO] [1713712162.661597968] [robot_0.gazebo_ros2_control]:       Command:
[gzserver-4] [INFO] [1713712162.661613345] [robot_0.gazebo_ros2_control]:                velocity
[gzserver-4] [INFO] [1713712162.661639976] [resource_manager]: Initialize hardware 'GazeboSystem' 
[gzserver-4] [INFO] [1713712162.661714153] [resource_manager]: Successful initialization of hardware 'GazeboSystem'
[gzserver-4] [INFO] [1713712162.661757823] [resource_manager]: 'configure' hardware 'GazeboSystem' 
[gzserver-4] [INFO] [1713712162.661762216] [resource_manager]: Successful 'configure' of hardware 'GazeboSystem'
[gzserver-4] [INFO] [1713712162.661765400] [resource_manager]: 'activate' hardware 'GazeboSystem' 
[gzserver-4] [INFO] [1713712162.661768201] [resource_manager]: Successful 'activate' of hardware 'GazeboSystem'
[gzserver-4] [INFO] [1713712162.661808672] [robot_0.gazebo_ros2_control]: Loading controller_manager
[gzserver-4] [WARN] [1713712162.664435877] [robot_0.controller_manager]: 'update_rate' parameter not set, using default value.
[gzserver-4] [ERROR] [1713712162.667432065] [robot_0.gazebo_ros2_control]: controller manager doesn't have an update_rate parameter

There are the yaml codes, also your codes

controller_manager:
  ros__parameters:
    update_rate: 20  # Hz
    use_sim_time: true

    joint_state_broadcaster:
      type: joint_state_broadcaster/JointStateBroadcaster

    omnidirectional_controller:
      type: omnidirectional_controllers/OmnidirectionalController

omnidirectional_controller:
  ros__parameters:
    wheel_names: 
      - left_wheel_robot_0
      - back_wheel_robot_0
      - right_wheel_robot_0

    robot_radius: 0.1
    wheel_radius: 0.053112205
    gamma: 30.0 # angle between body fixed y axis and the normal of wheel3

    publish_rate: 50.0
    odom_frame_id: odom
    base_frame_id: base_link_robot_0
    pose_covariance_diagonal : [0.001, 0.001, 0.001, 0.001, 0.001, 0.01]
    twist_covariance_diagonal: [0.001, 0.001, 0.001, 0.001, 0.001, 0.01]
    odom_numeric_integration_method: runge_kutta2

    open_loop: false
    enable_odom_tf: true

    cmd_vel_timeout: 0.5
    use_stamped_vel: false

And there is no omnidirectional_controller in the node list Looking forward to your reply!

mateusmenezes95 commented 2 months ago

Hello @xianzhou127, could you also share the launch file that you using to startup the controller?