2 · Explore the ROS 2 interfaces
Goal: understand how Bajie's abilities are exposed, and call a few of them by hand from the terminal. hnbot does exactly this under the hood.
Run everything in this tutorial on the robot, in a terminal with the environment from tutorial 1 loaded.
How Bajie is organised
Bajie has no separate "SDK server". Each ability is a standard ROS 2 interface:
- Actions do something that takes time and can be cancelled: navigate, search, grasp, dock.
- Topics stream data: camera images, battery.
| Ability | Interface | Type |
|---|---|---|
| Rooms in the semantic map | /map_manager |
action common_msgs/action/MapManager |
| Navigation point for a room | /nav2_area_navi_points |
action common_msgs/action/AreaNav |
| Drive to a pose | /navigate_to_pose |
action nav2_msgs/action/NavigateToPose |
| Find objects → grasp poses | /searching_manager_action |
action common_msgs/action/Search |
| Arm grasp / place on tray | /arm/adaptive |
action common_msgs/action/ArmAdaptivePose |
| Gripper open/close | /hand_controller/gripper_cmd |
action control_msgs/action/GripperCommand |
| Head pitch / lift | /robot/control |
action common_msgs/action/RobotControl |
| Return to dock | /recharge/action |
action common_msgs/action/Recharge |
| Battery | /power/battery/state |
topic common_msgs/msg/BatteryState |
| Head camera | /berxel_upper/berxel_upper/color/image_raw |
topic sensor_msgs/msg/Image |
List what is running
ros2 action list
ros2 topic list
Always read the interface first
Field names are the contract. Before you send any goal, print its definition:
ros2 interface show common_msgs/action/Search
ros2 interface show common_msgs/action/ArmAdaptivePose
The part above the first --- is the goal, then comes the result, then the feedback. Constants such as TASK_ARM_ADAPTIVE=1 or AREA_TYPE_POINT=-1 are listed there too.
Read a topic
ros2 topic echo /power/battery/state --once # battery percent and charging status
ros2 topic hz /berxel_upper/berxel_upper/color/image_raw # camera frame rate (Ctrl-C to stop)
Send your first goal: the gripper
The gripper uses the standard control_msgs action. position 0.0 opens it, 0.3 closes it, and max_effort limits the force:
ros2 action send_goal /hand_controller/gripper_cmd control_msgs/action/GripperCommand \
"{command: {position: 0.0, max_effort: 30.0}}"
Search for an object
Put a toy on the floor about 1 m in front of the robot, then run:
ros2 action send_goal --feedback /searching_manager_action common_msgs/action/Search \
"{name: '玩具', area_type: -1}"
nameis the object label in Chinese, because that is the robot's vision vocabulary. For example: 玩具 = toy, 水瓶 = water bottle, 杯子 = cup, 鞋子 = shoes, 眼镜 = glasses.area_type: -1(AREA_TYPE_POINT) means "search around where I am".
The result includes error_code (0 = success) and object_boxes_6dpose, a list of grasp poses that you can pass straight to /arm/adaptive. Tutorial 3 does that from Python.
Ask for the rooms
ros2 action send_goal /map_manager common_msgs/action/MapManager "{cmd: 1}"
cmd: 1 is QUERY. Rooms are the objects with obj_level: 1.
Cancel anything
Press Ctrl-C while send_goal is running and the goal is cancelled. In your own code, every action client can cancel its goal. hnbot's /stop does exactly that.
How hnbot maps onto this
| hnbot call | Interfaces it uses |
|---|---|
robot.navigate("kitchen") |
/map_manager → /nav2_area_navi_points → /navigate_to_pose |
robot.find("toys") |
/searching_manager_action |
robot.pick(obj) |
/arm/adaptive with TASK_ARM_ADAPTIVE, gripper close |
robot.place_in("tray") |
/arm/adaptive with TASK_PALLET_ADAPTIVE, gripper open |
robot.dock() |
/recharge/action |
robot.photo() / robot.status() |
camera and battery topics |
English names are translated for you (toy car → 玩具汽车, living room → 客厅), and error codes are explained in plain English.
✅ Done. Next: Your first pick-and-place →