手動發送 Joint Trajectory
如果要 手動發送 Joint Trajectory 訊息 而不使用 rospy.Publisher
,可以直接使用 rostopic pub
指令發送 trajectory_msgs/JointTrajectory
訊息。
手動發送 Joint Trajectory
參數說明
參數 | 說明 |
---|---|
/robot_arm_controller/command | ROS Topic,負責接收 Joint Trajectory 指令 |
trajectory_msgs/JointTrajectory | 訊息類型,包含關節名稱、目標位置與時間 |
joint_names | 指定控制的關節名稱 (需符合 URDF) |
points | 關節的目標位置 |
positions | 設定目標關節角度 |
time_from_start | 運動完成的時間 (秒) |
測試不同的關節角度
可以更改 positions
值來測試不同的關節運動:
此指令會讓
joint_1
,joint_2
,joint_3
在 3 秒內移動到新的位置。
這樣可以 不寫 Python 程式碼,直接在終端機手動發送訊息測試機械手臂動作!
#moveit_ws prj 控制關節定義及範例
"joint_1" 鞋軸 前後擺 範圍 (-45 .. +45)
"joint_2" 鞋面 左右擺 範圍 (-45 .. +45)
"joint_3" Y軸行程 前後動 範圍 (-0.170m .. 0m)
"joint_4" X軸行程 左右動 範圍 (-0.120m .. 0m)
"joint_5" Z軸行程 上下動 範圍 (-0.030m .. 0m)
#歸零
=============================================================$rostopic pub -1 /robot_arm_controller/command trajectory_msgs/JointTrajectory ' joint_names: ["joint_ 1", "joint_2", "joint_3", "joint_4", "joint_5"]
points: - positions: [0 , 0, 0.0 , 0.0 ,0.0] time_from_start: {secs: 3, nsecs: 0}'
=============================================================#joint_1 (move demo)
=============================================================$rostopic pub -1 /robot_arm_controller/command trajectory_msgs/JointTrajectory ' joint_names: ["joint_ 1", "joint_2", "joint_3", "joint_4", "joint_5"]
points: - positions: [-45 , 0, 0.0 , 0.0 ,0.0] time_from_start: {secs: 3, nsecs: 0}'
=============================================================
$rostopic pub -1 /robot_arm_controller/command trajectory_msgs/JointTrajectory ' joint_names: ["joint_ 1", "joint_2", "joint_3", "joint_4", "joint_5"]
points: - positions: [45 , 0, 0.0 , 0.0 ,0.0] time_from_start: {secs: 3, nsecs: 0}'
=============================================================#joint_2 (move demo)
=============================================================$rostopic pub -1 /robot_arm_controller/command trajectory_msgs/JointTrajectory ' joint_names: ["joint_ 1", "joint_2", "joint_3", "joint_4", "joint_5"]
points: - positions: [0 ,-45, 0.0 , 0.0 ,0.0] time_from_start: {secs: 3, nsecs: 0}'
=============================================================
$rostopic pub -1 /robot_arm_controller/command trajectory_msgs/JointTrajectory ' joint_names: ["joint_ 1", "joint_2", "joint_3", "joint_4", "joint_5"]
points: - positions: [0 , 45, 0.0 , 0.0 ,0.0]
#joint_3 (move demo)
=============================================================$rostopic pub -1 /robot_arm_controller/command trajectory_msgs/JointTrajectory ' joint_names: ["joint_ 1", "joint_2", "joint_3", "joint_4", "joint_5"]
points: - positions: [0 , 0, -0.080 , 0.0 ,0.0] time_from_start: {secs: 3, nsecs: 0}'
=============================================================
$rostopic pub -1 /robot_arm_controller/command trajectory_msgs/JointTrajectory ' joint_names: ["joint_ 1", "joint_2", "joint_3", "joint_4", "joint_5"]
points: - positions: [0 , 0, -0.170 , 0.0 ,0.0]
#joint_4 (move demo)
=============================================================$rostopic pub -1 /robot_arm_controller/command trajectory_msgs/JointTrajectory ' joint_names: ["joint_ 1", "joint_2", "joint_3", "joint_4", "joint_5"]
points: - positions: [0 , 0, 0.0 , -0.060 ,0.0] time_from_start: {secs: 3, nsecs: 0}'
=============================================================
$rostopic pub -1 /robot_arm_controller/command trajectory_msgs/JointTrajectory ' joint_names: ["joint_ 1", "joint_2", "joint_3", "joint_4", "joint_5"]
points: - positions: [0 , 0, 0.0 , -0.120 ,0.0]
#joint_5 (move demo)
=============================================================$rostopic pub -1 /robot_arm_controller/command trajectory_msgs/JointTrajectory ' joint_names: ["joint_ 1", "joint_2", "joint_3", "joint_4", "joint_5"]
points: - positions: [0 , 0, 0.0 , 0.0 , -0.015] time_from_start: {secs: 3, nsecs: 0}'
=============================================================
$rostopic pub -1 /robot_arm_controller/command trajectory_msgs/JointTrajectory ' joint_names: ["joint_ 1", "joint_2", "joint_3", "joint_4", "joint_5"]
points: - positions: [0 , 0, 0.0 , 0.0 ,-0.030]
沒有留言:
張貼留言