建模实践5 —— moveit + gazebo 联合仿真
1. MoveIt!机器人控制框架
官话:moveit输入用户指令,比如起始位置,输出轨迹数据,每个点通过位置速度加速度描述,为了通过话题发出来,还需要一个Follow Joint Trajectory功能,通过通信接口发给机器人,机器人还需要对轨迹进行精插补,再驱动电机同步运动。机器人控制器还需要将每个电机的状态数据反馈给moveit来确定机器人是否到达指定位置,这样完成一个闭环。
普通话:首先当指令进来后,由 Moveit 做规划,不管是避障也好,还是关节规划也好,出来以后都是 Trajectory Data ,也就是轨迹数据,通过 Follow Joint Trajectory 这个接口,将轨迹信息封装成 Action,Action 发送给Trajectory Controller ,不论是在实际的机器人控制器还是Gazebo中,都会在这里进行插补运算(因为轨迹里边是一些中间间隔一定时间长度的轨迹点,这个时间不可以直接用做控制,控制器要求这个时间必须细微,所以就涉及到了插补算法),插补算法会完成六个轴的插补运算,插补后将数据发送给 Position Servo(位置伺服驱动器),驱动器收到信号之后,将电平信号变成电流信号、电压信号给到电机,电机发生运动。机器人端还要将状态信息通过Joint State Controller反馈给Moveit。

主要是理解三个模块的作用:Follow Joint Trajectory,Joint Trajectory Controller, Joint State Controller

gazebo这边是一个action server,moveit那边是一个action client,轨迹通过Action机制发出来,sever这一端接收轨迹,完成插补运算,再发到每一个电机位置控制接口上,所以配置Moveit + Gazebo 很主要的一点就是做到“插座”和“插头”的匹配。
2. 代码层面的理解
在 /husky_kinova_moveit_config/config/ros_controllers.yaml 中:
# Simulation settings for using moveit_sim_controllers
moveit_sim_hw_interface:
joint_model_group: arm
joint_model_group_pose: todo_no_pose_selected
# Settings for ros_control_boilerplate control loop
generic_hw_control_loop:
loop_hz: 300
cycle_time_error_threshold: 0.01
# Settings for ros_control hardware interface
hardware_interface:
joints:
- front_left_wheel
- front_right_wheel
- rear_left_wheel
- rear_right_wheel
- j2n6s300_joint_1
- j2n6s300_joint_2
- j2n6s300_joint_3
- j2n6s300_joint_4
- j2n6s300_joint_5
- j2n6s300_joint_6
- j2n6s300_joint_finger_1
- j2n6s300_joint_finger_tip_1
- j2n6s300_joint_finger_2
- j2n6s300_joint_finger_tip_2
- j2n6s300_joint_finger_3
- j2n6s300_joint_finger_tip_3
sim_control_mode: 1 # 0: position, 1: velocity
# Publish all joint states
# Creates the /joint_states topic necessary in ROS
joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate

最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



