Hi
I have a simple robot, the robot is controlled with a raspberry pi gpio, L298N. I’m working on creature hardware interface. it’s a black magician for me.
based on your code trying to understand how to do it i have some problems with it
My setup:
Ubuntu 22.04
Ros2 Humble
My code: GitHub - mkonwerski/diffdrive_arduino at lolo
lolo@lolo:~/robot_sw$ source install/setup.sh
lolo@lolo:~/robot_sw$ ros2 launch articubot_one launch_robot.launch.py
[INFO] [launch]: All log files can be found below /home/lolo/.ros/log/2022-10-28-21-49-48-170830-lolo-3406
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [robot_state_publisher-1]: process started with pid [3419]
[robot_state_publisher-1] Link chassis had 4 children
[robot_state_publisher-1] Link camera_link had 1 children
[robot_state_publisher-1] Link camera_link_optical had 0 children
[robot_state_publisher-1] Link caster_wheel had 0 children
[robot_state_publisher-1] Link face_link had 0 children
[robot_state_publisher-1] Link laser_frame had 0 children
[robot_state_publisher-1] Link left_wheel had 0 children
[robot_state_publisher-1] Link right_wheel had 0 children
[robot_state_publisher-1] [INFO] [1666986591.834266827] [robot_state_publisher]: got segment base_link
[robot_state_publisher-1] [INFO] [1666986591.835206611] [robot_state_publisher]: got segment camera_link
[robot_state_publisher-1] [INFO] [1666986591.835403277] [robot_state_publisher]: got segment camera_link_optical
[robot_state_publisher-1] [INFO] [1666986591.835505932] [robot_state_publisher]: got segment caster_wheel
[robot_state_publisher-1] [INFO] [1666986591.835603900] [robot_state_publisher]: got segment chassis
[robot_state_publisher-1] [INFO] [1666986591.835699837] [robot_state_publisher]: got segment face_link
[robot_state_publisher-1] [INFO] [1666986591.835796607] [robot_state_publisher]: got segment laser_frame
[robot_state_publisher-1] [INFO] [1666986591.835907648] [robot_state_publisher]: got segment left_wheel
[robot_state_publisher-1] [INFO] [1666986591.836107594] [robot_state_publisher]: got segment right_wheel
[INFO] [ros2_control_node-2]: process started with pid [3483]
[ERROR] [launch]: Caught exception in launch (see debug for traceback): executable 'spawner.py' not found on the libexec directory '/opt/ros/humble/lib/controller_manager'
[INFO] [ros2_control_node-2]: sending signal 'SIGINT' to process[ros2_control_node-2]
[INFO] [robot_state_publisher-1]: sending signal 'SIGINT' to process[robot_state_publisher-1]
[ERROR] [ros2_control_node-2]: process has died [pid 3483, exit code -2, cmd '/opt/ros/humble/lib/controller_manager/ros2_control_node --ros-args --params-file /tmp/launch_params_hyw5g_8t --params-file /home/lolo/robot_sw/install/articubot_one/share/articubot_one/config/my_controllers.yaml'].
[robot_state_publisher-1] [INFO] [1666986599.524392759] [rclcpp]: signal_handler(signum=2)
[INFO] [robot_state_publisher-1]: process has finished cleanly [pid 3419]
lolo@lolo:~/robot_sw$ ros2 run controller_manager spawner
usage: spawner [-h] [-c CONTROLLER_MANAGER] [-p PARAM_FILE] [--load-only] [--stopped] [--inactive] [-t CONTROLLER_TYPE]
[-u] [--controller-manager-timeout CONTROLLER_MANAGER_TIMEOUT]
controller_name
spawner: error: the following arguments are required: controller_name
[ros2run]: Process exited with failure 2
lolo@lolo:~/robot_sw$ ls /opt/ros/humble/lib/controller_manager
ros2_control_node spawner unspawner
lolo@lolo:~/robot_sw$ /opt/ros/humble/lib/controller_manager/ros2_control_node --ros-args --params-file /tmp/launch_params_hyw5g_8t --params-file /home/lolo/robot_sw/install/articubot_one/share/articubot_one/config/my_controllers.yaml
[INFO] [1666990050.219291726] [resource_manager]: Loading hardware 'RealRobot'
[INFO] [1666990050.255340732] [resource_manager]: Initialize hardware 'RealRobot'
[INFO] [1666990050.258260654] [DiffDriveArduino]: -----------------------------*
[INFO] [1666990050.258455288] [DiffDriveArduino]: step: on_init
[INFO] [1666990050.259081793] [DiffDriveArduino]: -----------------------------!
[INFO] [1666990050.259239552] [resource_manager]: Successful initialization of hardware 'RealRobot'
[INFO] [1666990050.259347520] [DiffDriveArduino]: -----------------------------*
[INFO] [1666990050.259439550] [DiffDriveArduino]: step: export_state_interfaces
[INFO] [1666990050.260059597] [DiffDriveArduino]: -----------------------------!
[INFO] [1666990050.260246626] [DiffDriveArduino]: -----------------------------*
[INFO] [1666990050.260646050] [DiffDriveArduino]: step: export_command_interfaces
[INFO] [1666990050.261204222] [DiffDriveArduino]: -----------------------------!
[INFO] [1666990050.261453335] [resource_manager]: 'configure' hardware 'RealRobot'
[INFO] [1666990050.261562396] [resource_manager]: Successful 'configure' of hardware 'RealRobot'
[INFO] [1666990050.261667708] [resource_manager]: 'activate' hardware 'RealRobot'
[INFO] [1666990050.261796769] [DiffDriveArduino]: -----------------------------*
[INFO] [1666990050.261895987] [DiffDriveArduino]: step: on_activate
[INFO] [1666990050.261995778] [DiffDriveArduino]: Activating ...please wait...
[INFO] [1666990050.262117027] [DiffDriveArduino]: Successfully activated!
[INFO] [1666990050.262208849] [DiffDriveArduino]: -----------------------------!
[INFO] [1666990050.262306973] [resource_manager]: Successful 'activate' of hardware 'RealRobot'
[INFO] [1666990050.304599986] [controller_manager]: update rate is 30 Hz
[INFO] [1666990050.305668779] [controller_manager]: RT kernel is recommended for better performance
[INFO] [1666990050.305954349] [DiffDriveArduino]: -----------------------------*
[INFO] [1666990050.306044140] [DiffDriveArduino]: step: read
[INFO] [1666990050.306116900] [DiffDriveArduino]: Got position state 0.00000 and velocity state 0.00000 for 'left_wheel_joint'!
[INFO] [1666990050.306188879] [DiffDriveArduino]: Got position state 0.00000 and velocity state 0.00000 for 'right_wheel_joint'!
[INFO] [1666990050.306296326] [DiffDriveArduino]: Joints successfully read! (0.00000,0.00000,0.00000)
[INFO] [1666990050.306364033] [DiffDriveArduino]: -----------------------------!
[INFO] [1666990050.306437262] [DiffDriveArduino]: -----------------------------*
[INFO] [1666990050.306491116] [DiffDriveArduino]: step: write
[INFO] [1666990050.306542313] [DiffDriveArduino]: Writing...
[INFO] [1666990050.306595021] [DiffDriveArduino]: Got command 0.00000 for 'left_wheel_joint'!
[INFO] [1666990050.306664812] [DiffDriveArduino]: Got command 0.00000 for 'right_wheel_joint'!
[INFO] [1666990050.306721739] [DiffDriveArduino]: Joints successfully written!
[INFO] [1666990050.306773769] [DiffDriveArduino]: -----------------------------!
[INFO] [1666990050.339467596] [DiffDriveArduino]: -----------------------------*```