ros2 flow
stateDiagram-v2
Command_Velocity --> Diff_Dirve_Controller
state ros2_control {
Diff_Dirve_Controller --> Hardware_interface: Req. Motor Velocities Velocity Cmd Interfaces
Controller_Manager
Hardware_interface --> Joint_State_Broadcaster: Encoder position state
}
Hardware_interface --> Car
Joint_State_Broadcaster --> /joint_states
/joint_states --> Off_to_robot_state_publisher
install packages
install ros2 controll
要注意的是如果ubuntu20.04都是源码编译ros,需要跳过这一步,因为会失败。总之我是通过源码编译的,因为树莓派在20.04系统64位的暂时没法烧录成功。
1
| sudo apt install ros-foxy-ros2-control ros-foxy-ros2-controllers ros-foxy-xacro
|
需要从这里开始源码编译。 1 2 3 4 5 6 7 8 9
| git clone https://github.com/ros/angles.git -b foxy-devel git clone -b ros2 https://github.com/ros-drivers/ackermann_msgs.git git clone https://github.com/ros-controls/control_toolbox.git -b foxy git clone https://github.com/ros-controls/realtime_tools.git -b foxy-devel git clone https://github.com/ros-controls/control_msgs.git -b foxy-devel git clone https://github.com/ros-controls/ros2_controllers.git -b foxy git clone https://github.com/ros-controls/ros2_control.git -b foxy git clone https://github.com/ros/xacro.git git checkout 2.0.7
|
~/.bashrc
1 2
| source ~/ros2_foxy/ros2-linux/setup.bash source /opt/ros/foxy/setup.bash
|
install joystick test
1 2 3
| sudo apt install ros-foxy-joy joystick jstest-gtk evtest evtest jstest-gtk
|
install libserial
1
| sudo apt install libserial-dev
|
joystick flow
stateDiagram-v2
[*] --> Linux_Joystick_Driver
Linux_Joystick_Driver --> Joy_Node
Joy_Node --> /Joy
/Joy --> /Other_Nodes
/Other_Nodes --> /whatever
/Joy --> e.g.teleop_twist_joy
e.g.teleop_twist_joy --> /cmd_vel
ros2 joy
1 2 3
| ros2 run joy joy_enumerate_devices ros2 run joy joy_node ros2 topic echo /joy
|
dev_ws
1 2 3 4 5 6 7 8 9 10 11
| mkdir ~/code/dev_ws mkdir src && cd src git clone https://github.com/joshnewans/joy_tester git clone https://github.com/joshnewans/diffdrive_arduino git clone https://github.com/joshnewans/articubot_one git checkout 174b3f31 git clone https://github.com/joshnewans/serial git clone https://github.com/joshnewans/teleop_twist_joy colcon build --symlink-install source install/setup.bash ros2 run joy_tester test_joy
|
config/my_controllers.yaml
1 2
| wheel_separation: 0.177 wheel_radius: 0.042
|
description/ros2_control.xacro
1
| <param name="enc_counts_per_rev">1321</param>
|