🗒️

AgRoboticsResearch/Lerobot_ros2について

に公開

LeRobot SO-101 Follower Armを制御するROS2パッケージAgRoboticsResearch/Lerobot_ros2を確認しました。

インストール

こちら。

https://zenn.dev/karaage0703/articles/d778d660703c0b

動かし方

あらかじめ、サーボの可動範囲のエンコーダ値を読み取っておき(キャリブレーションという)、

$ ros2 run so101_hw_interface so101_calibrate --ros-args -p port:=/dev/ttyACM0
[INFO] [1754629567.861300511] [so101_calibrator]: Connecting to bus on /dev/ttyACM0 …
We'll record mechanical limits joint-by-joint.
For each joint:
  1. Rotate to the NEGATIVE mechanical stop and press <Enter>.
  2. Rotate to the POSITIVE mechanical stop and press <Enter>.

Move shoulder_pan to its NEGATIVE stop then press Enter…
Now move shoulder_pan to its POSITIVE stop then press Enter…
Move shoulder_lift to its NEGATIVE stop then press Enter…
Now move shoulder_lift to its POSITIVE stop then press Enter…
Move elbow_flex to its NEGATIVE stop then press Enter…
Now move elbow_flex to its POSITIVE stop then press Enter…
Move wrist_flex to its NEGATIVE stop then press Enter…
Now move wrist_flex to its POSITIVE stop then press Enter…
Move wrist_roll to its NEGATIVE stop then press Enter…
Now move wrist_roll to its POSITIVE stop then press Enter…
Move gripper to its NEGATIVE stop then press Enter…
Now move gripper to its POSITIVE stop then press Enter…

Calibration captured.  Mid-point between min/max will be treated as zero.
[INFO] [1754629664.899081892] [so101_calibrator]: Calibration written to /home/jetson/.so101_follower_calibration.yaml

ノードを動かします。

$ ros2 run so101_hw_interface so101_motor_bridge --ros-args -p port:=/dev/ttyACM0
[INFO] [1754631928.990073429] [so101_motor_bridge]: Connecting to Feetech bus on /dev/ttyACM0 …
[INFO] [1754631929.012056302] [so101_motor_bridge]: Motor bus connected and configured.
[INFO] [1754631929.063306557] [so101_motor_bridge]: Loaded calibration from /home/jetson/Lerobot_ros2/install/so101_hw_interface/share/so101_hw_interface/config/so101_calibration.yaml
[INFO] [1754631929.086886431] [so101_motor_bridge]: Issued initial command to move joints to mid-range position.

キャリブレーション値

キャリブレーションの値は~/.so101_follower_calibration.yamlに書かれていました。

~/.so101_follower_calibration.yaml
generated: '2025-08-08T14:07:44.892666'
shoulder_pan:
  range_min: 370
  range_max: 2252
  homing_offset: 1311
shoulder_lift:
  range_min: 431
  range_max: 2405
  homing_offset: 1418
elbow_flex:
  range_min: 173
  range_max: 2219
  homing_offset: 1196
wrist_flex:
  range_min: 235
  range_max: 2267
  homing_offset: 1251
wrist_roll:
  range_min: 363
  range_max: 2459
  homing_offset: 1411
gripper:
  range_min: 374
  range_max: 3515
  homing_offset: 1944

ノードとトピック

/so101_motor_bridge ノード

ros2 run so101_hw_interface so101_motor_bridgeで動いているノードはこれです。

$ ros2 node info /so101_motor_bridge
/so101_motor_bridge
  Subscribers:
    /so101_follower/joint_commands: sensor_msgs/msg/JointState
  Publishers:
    /parameter_events: rcl_interfaces/msg/ParameterEvent
    /rosout: rcl_interfaces/msg/Log
    /so101_follower/joint_states: sensor_msgs/msg/JointState
  Service Servers:
    /so101_motor_bridge/describe_parameters: rcl_interfaces/srv/DescribeParameters
    /so101_motor_bridge/get_parameter_types: rcl_interfaces/srv/GetParameterTypes
    /so101_motor_bridge/get_parameters: rcl_interfaces/srv/GetParameters
    /so101_motor_bridge/list_parameters: rcl_interfaces/srv/ListParameters
    /so101_motor_bridge/set_parameters: rcl_interfaces/srv/SetParameters
    /so101_motor_bridge/set_parameters_atomically: rcl_interfaces/srv/SetParametersAtomically
  Service Clients:

  Action Servers:

  Action Clients:

/so101_follower/joint_states トピック

サーボの現在位置がここに送られてきます。

$ ros2 topic echo /so101_follower/joint_states
header:
  stamp:
    sec: 1754632333
    nanosec: 648229945
  frame_id: ''
name:
- shoulder_pan
- shoulder_lift
- elbow_flex
- wrist_flex
- wrist_roll
- gripper
position:
- -0.0046019423636569235
- -0.0030679615757712823
- 0.0030679615757712823
- -0.0030679615757712823
- -0.0030679615757712823
- 1.0200972239439514
velocity: []
effort: []

/so101_follower/joint_commands トピック

サーボを操作したいときはここへ送ります。

$ ros2 topic echo /so101_follower/joint_commands
header:
  stamp:
    sec: 1754633927
    nanosec: 815360591
  frame_id: ''
name:
- gripper
- wrist_roll
- wrist_flex
- elbow_flex
- shoulder_lift
- shoulder_pan
position:
- 0.7395137743000002
- 0.1645888000000002
- 0.11321360000000014
- -1.5270033
- -0.8326267999999999
- 0.3346529999999994
velocity: []
effort: []

シェルから操作するときはこのコマンドを実行します。

$ ros2 topic pub /so101_follower/joint_commands sensor_msgs/msg/JointState "{name: ['gripper'], position: [-1.0]}" --once

Discussion