At the end of chapter 6 the robot had a base driver that could talk to the controller board, drive the wheels and read the IMU. This chapter adds the parts that let it sense the room. First you describe the robot's shape to ROS, so it knows where every sensor sits. Then you learn the arm: its limits, its named poses and the rules that keep it from hitting itself or you. The depth camera rides on the end of the arm, so the arm is also the robot's neck, and every time it moves, the camera's view of the room moves with it. Then the LiDAR goes on /scan, and last the depth camera's vendor driver goes in and starts at boot.
Most of the code already sits in the rosorin_base package you copied to the robot in chapter 6. Here you check each part on the real robot, one at a time. On my robot the commands of the whole chapter took a little over an hour. Reading the explanations takes longer.
Put the robot on its stand, wheels in the air, with nothing within reach of the arm. In every robot shell in this chapter, start with:
source /opt/ros/humble/setup.bash
source ~/ros2_ws/install/setup.bash
Every sensor measures from its own position. The LiDAR sits 4.8 cm ahead of the body's centre and is mounted backwards. The camera rides on the arm. Before a LiDAR point or a camera pixel is any use, ROS has to know where that sensor was, relative to the body, at the moment it measured.
ROS keeps this as frames. A frame is a coordinate system fixed to something: the body (base_link), the LiDAR (laser), the camera (camera_link). A transform says where one frame sits inside another, as a shift in metres and a rotation. Transforms that never change are published once on /tf_static. Transforms that change, like every arm joint, are published again and again on /tf. Each frame has one parent, so they form a tree, and ROS can chain them: ask for base_link to camera_link and it multiplies its way down the arm. As everywhere in ROS, x points forward, y left and z up, and a positive yaw turns left.
The robot's shape is written in a URDF file, an XML list of rigid parts (links) and the joints between them. A stock ROS node, robot_state_publisher, reads the URDF and the arm's joint angles from /joint_states, and publishes the arm's frames from them. The base driver already publishes /joint_states ten times a second from the arm servos.
The geometry wasn't measured with a ruler. It was read out of the factory's own robot description, and only the numbers were kept, in one file, model/robot_model.json. An identical copy is installed with the package, because the base driver's arm collision check loads it at run time. On your laptop:
cd ~/CCode/rosorin-pro
python3 -c "import json; m = json.load(open('model/robot_model.json')); print(list(m)); print(m['source'])"
cmp model/robot_model.json ros2/rosorin_base/config/robot_model.json && echo identical
The first line should be ['source', 'pulse_to_rad', 'joints', 'boxes', 'chassis_heightmap'], the second a short note on where the numbers came from, and the last identical. The file holds the conversion from servo pulses to radians, eleven joints with their positions and axes, one bounding box per arm part and one for the LiDAR housing for the collision check, and the top surface of the chassis as heights on a 1 cm grid.
Look at two of the joints as they are stored:
python3 -c "import json; m = json.load(open('model/robot_model.json')); [print(k, json.dumps(m['joints'][k])) for k in ('joint1', 'lidar_joint')]"
joint1 {"type": "revolute", "parent": "base_link", "child": "link1", "xyz": [0.04662, 7.5437e-05, 0.16044], "rpy": [0.0087266, 0.0, 0.0], "axis": [-5.4513e-05, -0.0087266, -0.99996], "limit": [-2.09, 2.09]}
lidar_joint {"type": "fixed", "parent": "base_link", "child": "lidar_frame", "xyz": [0.048156, 7.5552e-05, 0.106748], "rpy": [0.0, 0.0, 3.141592653589793], "axis": [0.0, 0.0, 0.0], "limit": null}
Read joint1 like this. The arm's turntable sits 4.7 cm ahead of the body's centre and 16 cm up, and turns about an axis pointing almost straight down. Its limit of plus or minus 2.09 radians is the servo's full travel, not the limit the robot uses. The real limits come later in this chapter. The LiDAR joint is fixed, with a yaw of pi: the LiDAR faces backwards.
model/make_urdf.py turns robot_model.json into the URDF the robot runs. It's 70 lines, and building it yourself once is the best way to see what a URDF is. Set up a scratch folder on your laptop:
mkdir -p ~/learn/model
cp ~/CCode/rosorin-pro/model/robot_model.json ~/learn/model/
Then type the repo's model/make_urdf.py into ~/learn/model/make_urdf.py, or copy it there. Here's what it does. It writes one <joint> element per arm joint, with the parent and child links, the origin and, for the turning joints, the axis and limit. That's all robot_state_publisher needs. It leaves out two joints on purpose. The joint to base_footprint would give base_link a second parent, and later the odometry owns the transform into base_link. The LiDAR joint stays out because the LiDAR's frame is published separately, as laser. Then it adds collision boxes: the arm boxes as they are, the LiDAR box moved into base_link, and the chassis height map turned into a stack of 1 cm boxes, rounded up so they're never smaller than the chassis. Last, it adds the camera's optical frame. Cameras use a different convention, z out of the lens, x right and y down, and the rotation from camera_link to depth_camera_link turns one into the other. The camera driver stamps its depth images with depth_camera_link, so this joint is what lets a depth pixel be placed in the room.
Run it and compare the result with the repo's file:
cd ~/learn
python3 model/make_urdf.py
diff ~/learn/ros2/rosorin_base/urdf/rosorin.urdf ~/CCode/rosorin-pro/ros2/rosorin_base/urdf/rosorin.urdf && echo IDENTICAL
grep -c '<link' ~/learn/ros2/rosorin_base/urdf/rosorin.urdf
It prints the boxes it made, one line with 'base_link': 149 among the names and (chassis 148) at the end, then a wrote line ending in rosorin.urdf 10 links, then IDENTICAL and 11. The order of the names in the first line changes between runs; the file doesn't. The 149 boxes on base_link are the 148 chassis boxes and the LiDAR housing. It counts 10 links before it adds depth_camera_link, which is why the file has 11. If diff prints lines, you typed something differently; fix your copy until it's empty. Never edit rosorin.urdf by hand. Its second line says it's generated, and the next run overwrites it.
The URDF and the model are data files of the rosorin_base package, and the repo's setup.py and package.xml already install them. Copy the package from your laptop:
cd ~/CCode/rosorin-pro/ros2
rsync -a --exclude __pycache__ --exclude launch/ --exclude systemd/ rosorin_base/ rosorin:ros2_ws/src/rosorin_base/
The two excludes matter. The repo's finished launch file starts the LiDAR odometry from chapter 9, and its service file loads a workspace that chapter 9 creates. Either one would stop the base from starting now. The line above was not run as written: I ran it without --exclude systemd/, the finished service file landed in the package, and I put the chapter 6 one back by hand. Keep your own launch file and service from chapter 6. Then build on the robot:
cd ~/ros2_ws
source /opt/ros/humble/setup.bash
colcon build --packages-select rosorin_base 2>&1 | tail -1
ls install/rosorin_base/share/rosorin_base/urdf/ install/rosorin_base/share/rosorin_base/config/robot_model.json
The build ends with Summary: 1 package finished, and ls lists rosorin.urdf and the model file. robot_state_publisher itself came with ROS in chapter 6.
Two lines go into your own ~/ros2_ws/src/rosorin_base/launch/base.launch.py on the robot. The first reads the URDF once, at launch. It goes right after the two-line board = Node(...) statement:
urdf = open(os.path.join(share, 'urdf', 'rosorin.urdf')).read() # generated: model/make_urdf.py
The node goes into the list, right after the on_board_exit, line:
# arm + camera frames from /joint_states (board_driver); root base_link
Node(package='robot_state_publisher', executable='robot_state_publisher', name='robot_state_publisher',
parameters=[{'robot_description': urdf}]),
Build again. The touch makes sure colcon sees the launch file as changed:
cd ~/ros2_ws && touch src/rosorin_base/launch/base.launch.py
source /opt/ros/humble/setup.bash && colcon build --packages-select rosorin_base 2>&1 | tail -1
grep -c robot_state_publisher install/rosorin_base/share/rosorin_base/launch/base.launch.py
The last line should print 1 or more. If it prints 0, the installed launch file is still the old one: edit, touch and build again.
Restart the base so the launch file is read again. The two rosorin-mind lines do nothing on a robot built from this guide. They're for the robot's own loop, rosorin-mind, which chapter 13 describes but has no tested install step for. Where that service runs, they keep it from hanging while the driver restarts under it.
sudo systemctl stop rosorin-mind 2>/dev/null
sudo systemctl restart rosorin-base
sleep 15
systemctl is-active rosorin-base
sudo systemctl start rosorin-mind 2>/dev/null
timeout 6 ros2 topic hz /joint_states 2>&1 | grep -m1 average
timeout 5 ros2 topic echo --once /joint_states | grep -A6 position
ros2 node list | grep robot_state_publisher
timeout 6 ros2 topic hz /tf 2>&1 | grep -m1 average
You should see active, then average rate: 10.000 or close to it, then five positions in radians for joint1 to joint5. Mine read 0.0251, -1.2273, 1.9017, 1.4284 and 0.0 with the arm in its drive pose; yours depend on where the arm is. Then /robot_state_publisher, and /tf at about 10 Hz. Wait the full 15 seconds after a restart before you judge anything; the driver's topics take a few seconds to appear.
The LiDAR and the IMU never move relative to the body, so they get fixed transforms. Your launch file from chapter 6 already has them, as two static_transform_publisher nodes with the factory's numbers:
# factory pro/lidar.urdf.xacro lidar_joint; native angles published as-is, mount yaw pi
static_tf('tf_base_laser', ['0.048156', '0.0000756', '0.106748'], ['0', '0', '3.14159265'],
'base_link', 'laser'),
# factory pro/imu.urdf.xacro imu_joint
static_tf('tf_base_imu', ['-0.027258', '-0.0000564', '0.048046'], ['0', '-0.0087266', '1.5707'],
'base_link', 'imu_link'),
The LiDAR's own 0 degrees points to the robot's rear, so the robot's forward is the LiDAR's 180 degrees. The LiDAR reader publishes the sensor's angles unchanged, and this transform does the turning. The IMU sits 2.7 cm behind the centre, turned 90 degrees and tilted half a degree. One warning: don't use that yaw to guess which side of the robot an IMU axis points to. I tried, and the guess was wrong. Check both:
timeout 6 ros2 run tf2_ros tf2_echo base_link laser 2>&1 | grep -m2 -E "Translation|RPY \(degree"
timeout 6 ros2 run tf2_ros tf2_echo base_link imu_link 2>&1 | grep -m2 -E "Translation|RPY \(degree"
- Translation: [0.048, 0.000, 0.107]
- Rotation: in RPY (degree) [0.000, -0.000, 180.000]
- Translation: [-0.027, -0.000, 0.048]
- Rotation: in RPY (degree) [-0.000, -0.500, 89.994]
tf2_echo keeps printing until you stop it; the timeout and grep keep just the two lines you need. If it prints frame does not exist for an arm frame, robot_state_publisher isn't running or has no joint states. The driver publishes nothing on /joint_states while any of servos 1 to 5 doesn't answer. The camera frames get their check after you've moved the arm, below.
The arm is five joints and a claw, built from bus servos. A bus servo shares one serial line with the others; each has an ID and answers only frames addressed to it. You send "go to this position in this many milliseconds" and the servo's own controller drives there and holds. You can read back its position, supply voltage, temperature and whether its motor is powered. The controller board relays these frames to the servo bus. You'll never type one: the base driver builds them, and you call its services.
Each servo works in pulses from 0 to 1000, with 500 in the middle. 1000 pulses span 240 degrees, so one pulse is 0.24 degrees. ROS works in radians. The conversion is rad = (500 - pulse) * 0.0041887902047863905, so more pulses means a negative angle. Code that talks to servos uses pulses; code that talks to ROS uses radians.
The arm can hit the robot's own body, the LiDAR tower and you, and it drops when its servos lose power. So only the base driver talks to the servos. A second program publishing arm goals latches the emergency stop. The driver doesn't move the arm when it starts, and it never writes to the servos' stored settings.
Every joint has a mapped limit, in pulses. I found them before this build, by opening one joint at a time to the full range and sweeping it slowly, at 25 pulses a second, with the gamepad in my hand to stop it if anything got close. The limit is 20 pulses inside the point where it stopped. The driver refuses any goal outside these limits. It doesn't clamp the goal to the nearest limit, because a silent substitute hides the caller's mistake and moves the arm somewhere nobody asked for. A refused goal moves nothing.
Each servo also has a wider limit stored in its own memory, which silently caps motion. Servo 2 stops at 960 whatever you send. That explains every "960" or "961" you'll see on joint 2.
The mapped limits are a union over the poses I swept. Joint 3 at 44 is fine with the arm folded and not fine with the arm straight up. So a goal inside every joint's limit can still collide; the collision check further down covers combinations.
The limits and the named poses live in ros2/rosorin_base/config/arm_limits.yaml, which the launch file hands to the driver. This is the servo map with all of them, in pulses:
| Servo | Joint | Mapped limit | Rest | Fold | Tuck | Drive |
|---|---|---|---|---|---|---|
| 1 | base pan | 34-966 | 500 | 500 | 500 | 500 |
| 2 | shoulder | 95-941 | 776 | 860 | 980 | 793 |
| 3 | elbow | 40-881 | 211 | 45 | 48 | 51 |
| 4 | wrist tilt | 121-935 | 161 | 178 | 133 | 160 |
| 5 | claw rotate | 31-969 | 500 | 500 | 499 | 499 |
| 10 | claw | 131-631 | 499 | 499 | 629 | 499 |
Joint 1 turns the whole arm, about 112 degrees each way. Joint 5 rolls the camera, and joint 4 tilts it. The claw closes as its pulses rise. Goals move at most 250 pulses a second, and head jogs at most 300, which is 72 degrees a second. The same file holds the wheels' top speed, 0.35 m/s.
The four poses are the columns of the table. Rest is where the driver's arm/recover service goes. The arm stands up with the camera 0.38 m above the floor, looking about 5 degrees above level with the wrist at 161. From there the camera can look down only to 4 degrees below level, because the wrist's lower limit is 121. Rest used to be the folded S-coil shape, until I found that the claw hits the joint-2 servo in that shape. With the arm stretched out a little more, the claw rotates freely.
Fold is that old S-coil. It's now the step between rest and tuck, in both directions, because the path from tuck through the S-coil is the one I've run every day.
Tuck is the parking pose. The shoulder goes far back and the upper arm's motor comes to rest on the joint-2 servo, so the arm holds itself up with every servo switched off. The table says 980 for the shoulder, but the servo's stored limit stops it at 960, and that's close enough. Tuck is outside the mapped limit of joint 2 on purpose, so nothing can stream the arm there. Only the tuck service gets there, and then it switches the servos off. On my robot a tucked arm roughly doubles the battery life, and the servos stop heating.
Drive is the pose for driving. The camera tilts about 29 degrees down, so it sees the floor from 0.32 m to 4.2 m ahead. When the wheels are enabled, the driver always moves the arm to this pose first and refuses to enable the wheels if the arm isn't within 30 pulses of it afterwards. I learned that rule after the robot drove 4 m with the arm stretched sideways.
rosorin_base/arm.py holds the motion logic that needs neither ROS nor the serial port, so it can be tested on any computer. Moves follow a minimum-jerk curve, s(u) = 10u^3 - 15u^4 + 6u^5. Speed and acceleration are zero at both ends, so the arm starts and stops softly. The curve's peak speed is 1.875 times distance over duration, which gives the duration for a speed cap. When several joints move together, the slowest one sets the time and all of them arrive at once. The driver samples the curve every 40 ms and sends each sample as a 40 ms move. The same file has the limit check, the pulse-to-radian conversion and the frames. Chapter 6 copied it and its tests to the robot; if the tests are missing, copy them from your laptop with scp ~/CCode/rosorin-pro/ros2/rosorin_base/test/test_arm.py rosorin:ros2_ws/src/rosorin_base/test/. Run them:
cd ~/ros2_ws/src/rosorin_base
python3 -m pytest -q test/test_arm.py
The last line should read 14 passed. The tests check that a move starts and ends softly, that the peak speed stays under the cap, that limits refuse instead of clamping, that 375 pulses are 90 degrees, and the claw cases.
rosorin_base/arm_model.py computes where every arm part is from the joint angles, by chaining each joint's origin and rotation down the arm. With a box around each part, it asks whether any two boxes that aren't neighbours overlap, with a 5 mm margin, and whether any arm box dips into the chassis height map. It takes under 10 ms on the robot, fast enough to check every step of a move.
The driver runs this check on every head jog step that changes the pose, and on every point of a MoveIt path. It ignores one pair, link5 against the camera mount camera_link0, because any roll of joint 5 flags it falsely. It does not run the check on a single goal sent to arm/goal, on the named poses, or on the gamepad's arm mode. Those are checked against the mapped limits only. In a simulator test it accepted joint 2 at 150 from rest, which puts the claw into the LiDAR housing and the chassis in the model. So send goals you've checked with the model yourself, or move by jogging.
The boxes are a coarse stand-in. They're padded, so the model reports contact a little early. The factory chassis has a block at the rear that my robot doesn't have, probably the screen bracket. And the claw's fingers aren't modelled; the claw is one fixed box. Compute two poses yourself on the robot. Nothing moves:
cd ~/ros2_ws/src/rosorin_base
python3 -c "
from rosorin_base import arm_model
M = arm_model.ArmModel('config/robot_model.json')
for name, p in (('rest', {1: 500, 2: 776, 3: 211, 4: 161, 5: 500, 10: 499}), ('drive', {1: 500, 2: 793, 3: 51, 4: 160, 5: 499, 10: 499})):
F = M.link_frames(M.q_from_pulses(p))
print(name, F['camera_link'][:3, 3].round(3), arm_model.collisions(M, p))
"
rest [0.038 0. 0.383] []
drive [0.099 0.001 0.316] [('link5', 'camera_link0')]
The camera is 0.383 m above the floor at rest, with nothing touching. The drive pose shows the known false pair.
Keep these in your head before you move anything. The driver starts with the arm disabled and doesn't move it. Its emergency stop holds the servos where they are, never switches them off, because an arm with its torque off drops. The gamepad is meant to latch that stop with any button except MODE, and holding MODE for 2 seconds clears it. I didn't test that part; see the end of the chapter. Reading the servos blocks the driver for a moment, so it refuses servo reads while the wheels are enabled; the wheels' deadman must never stall. The claw counts as optional: if it stops answering, the arm and wheels carry on. If one of the five joint servos stops answering, every pose move refuses until it answers again. Check the cable first.
When the arm has been holding a pose with nothing to do for 120 seconds, with the wheels disabled and no emergency stop, the driver tucks it by itself. That's the auto-tuck. After a driver restart the driver doesn't know whether the arm is holding, so an arm left in a pose by the old driver stays there, holding, until something moves it.
After a power cut the servos go limp and the arm sags, sometimes until a servo reads below 0. A smooth move can't start from there, so arm/recover sends one slow move and lets the servos find their own way. Before you cut the power yourself, tuck the arm. Never call arm/relax unless the arm rests on itself; tuck is the only pose made for torque off. The claw refuses to switch off and keeps reporting torque on. I haven't found out why.
Watch the arm for every command below, and keep your hands out of its reach.
The wheels must be disabled for this. If they aren't, the driver answers refused: wheel motion enabled (reads would stall the deadman); disable them with ros2 service call /rosorin_board_driver/enable std_srvs/srv/SetBool "{data: false}".
timeout 15 ros2 service call /rosorin_board_driver/arm/read_state std_srvs/srv/Trigger | grep -o "message=.*" | cut -c1-600
You get a JSON message with position, voltage, temperature and torque state for each of the six servos. On mine, with the arm tucked, the positions were 494, 961, 46, 134 and 499 for servos 1 to 5, all with torque 0, and 629 for the claw with torque 1. Every servo read 12.6 to 12.7 V, close to the battery, and servo 3 read 40 degrees C. A servo that shows null everywhere isn't answering.
timeout 40 ros2 service call /rosorin_board_driver/arm/recover std_srvs/srv/Trigger
journalctl -u rosorin-base --since "-1 min" --no-pager -o cat | grep "arm recover"
The service answers success=True. That alone doesn't prove the arm got there, because a recover cut short by an emergency stop also returns success. From the tuck the journal shows the two steps, through fold to rest. The first pose in the first line is where your arm was tucked, so yours will differ by a few pulses:
arm recover {1: 499, 2: 963, 3: 45, 4: 131, 5: 498, 10: 629} -> {1: 500, 2: 860, 3: 45, 4: 178, 5: 500, 10: 499} in 1.1 s (single command, untuck from tuck)
arm recover {1: 500, 2: 860, 3: 45, 4: 178, 5: 500, 10: 499} -> {1: 500, 2: 776, 3: 211, 4: 161, 5: 500, 10: 499} in 1.4 s (single command, untuck from tuck)
followed by an arm recover result: line. Mine read back 498, 780, 206, 161 and 499 after 2.5 seconds, with "inside_limits": true. From anywhere other than the tuck, for example after a power cut, it takes one slow move of at least 3 seconds instead.
timeout 10 ros2 service call /rosorin_board_driver/arm/enable std_srvs/srv/SetBool "{data: true}"
timeout 10 ros2 topic pub --once -w 1 /arm/goal sensor_msgs/msg/JointState "{name: ['4'], position: [220.0]}"
sleep 3
timeout 10 ros2 topic pub --once -w 1 /arm/goal sensor_msgs/msg/JointState "{name: ['4'], position: [100.0]}"
sleep 1
timeout 10 ros2 service call /rosorin_board_driver/arm/enable std_srvs/srv/SetBool "{data: false}"
journalctl -u rosorin-base --since "-1 min" --no-pager -o cat | grep -E "arm (enabled|move|goal|hold)"
Enabling reads the pose and takes the arm for streaming. It refuses if the arm sits more than 10 pulses outside a limit; run arm/recover first then. A goal on arm/goal uses the servo ID as the name, '4', not joint4, and the position in pulses. The first goal tilts the wrist to 220. The second is below the wrist's limit of 121. The -w 1 waits for the driver to subscribe; without it the single message can be lost. The journal should show:
arm enabled at {1: 499, 2: 780, 3: 206, 4: 161, 5: 499, 10: 501}
arm move {4: 161} -> {4: 220} in 0.44 s
arm goal refused: servo 4 goal 100 outside limits [121, 935]
arm hold (disable)
The 0.44 seconds is 1.875 times 59 pulses over 250 pulses a second. Nothing moves on the refused goal, and the arm doesn't twitch when it's put on hold.
timeout 90 ros2 service call /rosorin_board_driver/arm/tuck std_srvs/srv/Trigger | grep -o "success=[A-Za-z]*\|\"tucked\": [a-z]*\|\"settled\": {[^}]*}"
The tuck closes the claw and moves to fold, then to the tuck approach with joint 2 capped at 960, then switches servos 1 to 5 off and checks the result from the servos' own read-back. It doesn't trust the command; it reads where the arm actually settled. Mine printed:
success=True
"tucked": true
"settled": {"1": 498, "2": 961, "3": 46, "4": 133, "5": 499, "10": 629}
Joints 2 to 4 must be within 25 pulses of the tuck reference, and servos 1 to 5 at torque 0. If it says tucked: false with the arm standing upright, the arm didn't settle onto the joint-2 servo; the driver keeps it held and tries again 120 seconds later.
Now recover again and leave the arm alone. Watch the countdown in the driver's state:
timeout 40 ros2 service call /rosorin_board_driver/arm/recover std_srvs/srv/Trigger >/dev/null
for i in 1 2 3; do timeout 6 ros2 topic echo --once --field data /rosorin_board_driver/state | grep -o '"auto_tuck_in_s": [0-9.]*'; sleep 30; done
Mine counted 118.5, 86.5 and 53.5. About 120 seconds after the recover the arm folds itself away, and the driver's journal shows AUTO-TUCK: arm idle 120 s while holding, followed 7 seconds later by an arm TUCK result with "tucked": true. If you look in the journal, read the result line after the AUTO-TUCK: line; the manual tuck before it logged one too. The state topic goes quiet while the tuck runs.
timeout 40 ros2 service call /rosorin_board_driver/arm/drive std_srvs/srv/Trigger
It answers success=True and a message with before, after and duration_s. Mine read back 794, 46 and 160 on joints 2 to 4 after 1.4 seconds. The elbow sags in this pose: 51 commanded, a few pulses less read back.
The camera is bolted to the wrist, so where it looks depends on the joints at that moment. With the arm in the drive pose, ask where the camera is:
timeout 6 ros2 run tf2_ros tf2_echo base_link camera_link 2>/dev/null | grep -m2 -E "Translation|RPY \(deg"
timeout 6 ros2 run tf2_ros tf2_echo base_link depth_camera_link 2>/dev/null | grep -m2 -E "Translation|RPY \(deg"
- Translation: [0.100, -0.000, 0.287]
- Rotation: in RPY (degree) [0.987, 30.476, -0.292]
- Translation: [0.100, -0.000, 0.287]
- Rotation: in RPY (degree) [-120.480, 0.851, -90.793]
The camera is 10 cm ahead of the body's centre and 28.7 cm up, pitched 30 degrees down at the floor. The depth frame has the same position with the optical rotation on top.
Now tuck the arm with the tuck command from above, and run the two tf2_echo lines again:
- Translation: [0.031, 0.002, 0.292]
- Rotation: in RPY (degree) [0.293, -3.358, -0.463]
- Translation: [0.031, 0.002, 0.292]
- Rotation: in RPY (degree) [-86.642, 0.292, -90.445]
The camera moved back 7 cm and now looks level, a few degrees up. The frames follow the arm. Put the arm back in the drive pose with the arm/drive call from above before the next test.
The robot's own loop, rosorin-mind from chapter 13, moves the head only by jogging. It sends joint velocities in radians per second on arm_controller/joint_jog, many times a second, and when the messages stop, the joint glides to a stop instead of freezing. The driver ramps the speed at 6 rad/s^2, caps it at 300 pulses a second, stops a joint at its limit, and runs the collision check on every step that changes the pose. The loop moves only joint 1 to pan, joint 4 to tilt and joint 5 for a head-tilt gesture.
A test script exercises this from your laptop's copy of the repo. It enables the arm, sends jogs at 50 Hz (pan at +0.3 rad/s for 2 seconds, -0.3 for 4, +0.3 for 2, then the wrist down and up), disables, and prints what /joint_states saw. Copy it from your laptop:
scp ~/CCode/rosorin-pro/scripts/arm_jog_test.py rosorin:setup/
Run it on the robot, with the arm free to pan, from the drive pose:
python3 ~/setup/arm_jog_test.py
Mine printed:
joint_states 366 msgs in 11.0 s (33 Hz); pan range -32.4..38.2 deg
pan velocity during steady +0.3 rad/s: mean 0.221 std 0.141 rad/s
and the journal had jog stopped by arm model veto: [('link1', 'gripper_link')]: the collision check stopped a step that would have put the claw into the arm's own base. The pan range isn't symmetric because a jog that names only the wrist doesn't stop the pan, so the pan keeps moving through the wrist part of the test. The mean speed came out below the commanded 0.3 rad/s. I haven't worked out why. Two minutes after the test the arm tucked itself, with the pan left where the test ended.
The single moves, recover, drive and tuck, block the driver while they run, so no joint states go out and the camera's transform stands still while the camera turns. For that moment the robot believes the camera points somewhere it doesn't. The driver says so on its arm_busy topic before and after each such move, and every program that places camera data in the room must ignore frames taken while it's set. You'll see that rule again in chapters 9 and 10.
The COIN-D6 on top of the robot spins about ten times a second and measures the distance to whatever is around it, about 400 times per turn, in one flat plane. It maps the room, places the robot on the map and keeps it off the walls. The base driver won't move the wheels on a software command unless scans keep arriving. I couldn't find a datasheet for it, so its serial protocol was worked out from captured bytes. Two small Python files in the package read it, and they never write to the port.
ROS publishes one turn as a sensor_msgs/LaserScan: a starting angle, the angle step, and a list of distances in metres, one per step, with inf where nothing came back. It also carries a time stamp. Consumers look up the robot's pose at that time to place the points, so the stamp has to be the time of the first ray. A stamp that's too new makes them wait for transforms that don't exist yet.
Chapter 5 gave the LiDAR's serial port a fixed name with a udev rule, one line in /etc/udev/rules.d/60-rosorin-lidar.rules:
SUBSYSTEM=="tty", KERNELS=="1-2.2.4:1.0", SYMLINK+="lidar"
It matches the USB position, not the device name, because the ttyUSB numbers can swap when a device reconnects. Check it:
ls -l /dev/lidar
The line should end in /dev/lidar -> ttyUSB0. If there's no ttyUSB at all, the CH340 module from chapter 5 isn't loaded. It's tied to the exact kernel build, so rebuild it after any kernel update.
The LiDAR starts sending as soon as it has power, at 230400 baud, with no start command. The reader opens the port exclusively, and the base service runs the reader, so stop the service first. That sends the wheels a stop and leaves the arm where it is. Do it with the wheels disabled.
sudo systemctl stop rosorin-base
stty -F /dev/lidar 230400 raw -echo && timeout 2 cat /dev/lidar > /tmp/lidar.bin
stat -c "%s bytes in 2s" /tmp/lidar.bin
xxd /tmp/lidar.bin | head -4
Mine printed 27531 bytes in 2s, about 13.7 KB a second. Packets start with the bytes aa 55. Your capture will usually start in the middle of a packet; mine had its first aa 55 at byte 32. An earlier capture that happened to start on a header looked like this:
00000000: aa55 0019 4f43 214e b613 8449 35f8 a535 .U..OC!N...I5..5
00000010: bccd 3540 dd27 d0ed 27b8 dc36 3c11 3718 ..5@.'..'..6<.7.
If stty or cat says "Device or resource busy", another program holds the port; fuser -v /dev/ttyUSB0 names it. The readers lock the port on purpose: two readers on one serial port silently split the bytes between them.
Each packet starts with the header aa 55. Byte 2 says whether the packet starts a new turn (bit 0 set; it then carries one sample). Byte 3 is the number of samples, 25 in a normal packet. Bytes 4 to 7 are the angles of the first and last sample, each a little-endian 16-bit number shifted right by one and divided by 64 to give degrees; the samples in between are spread evenly. Bytes 8 and 9 are a checksum, an XOR of 16-bit words. Then come the samples, three bytes each: an intensity byte, and a distance in millimetres made from the other two, (S2 << 6) | (S1 >> 2). The low 2 bits of S1 are unknown and ignored. The layout matches the "intensity" packet of YDLIDAR's TOF sensors.
Take a normal packet from the repo's capture: aa 55 | 00 | 19 | 49 16 | 03 21 | 84 7b | 10 4e 01. Byte 2 is 0x00, not a turn start. 0x19 is 25 samples, so the packet is 10 + 3 x 25 = 85 bytes long. The first angle is 0x1649 = 5705; shifted right, 2852; divided by 64, 44.56 degrees. The first sample's distance is (1 << 6) | (0x4e >> 2) = 83 mm. At 44.6 degrees and 83 mm that's the robot's own body. Its own parts show up at 33 to 57 degrees and 291 to 316 degrees in the LiDAR's angles, all closer than 11 cm.
rosorin_base/coin_d6.py does this. Serial reads arrive in arbitrary chunks, so its parser keeps a buffer, looks for aa 55, waits until the whole packet is there, and keeps it only if the checksum is right. On a bad checksum it drops just the two header bytes and searches again, because aa 55 also turns up inside sample bytes, and a false header must not swallow the real packet behind it.
Test it against 3000 bytes of the real stream. Copy the capture and its test from your laptop:
ssh rosorin 'mkdir -p ~/ros2_ws/src/rosorin_base/test'
scp ~/CCode/rosorin-pro/ros2/rosorin_base/test/coin_d6_sample.bin ~/CCode/rosorin-pro/ros2/rosorin_base/test/test_coin_d6.py rosorin:ros2_ws/src/rosorin_base/test/
On the robot:
cd ~/ros2_ws/src/rosorin_base
python3 -m pytest -q test/test_coin_d6.py
python3 -c "
from rosorin_base.coin_d6 import PacketParser
p=PacketParser(); d=open(\"test/coin_d6_sample.bin\",\"rb\").read(); k=p.feed(d)
print(\"pkts\",len(k),\"bad\",p.bad,\"first aa55 at\",d.find(bytes([0xaa,0x55])),\"leftover\",len(p.buf))"
pytest ends with 3 passed, and the one-liner prints:
pkts 37 bad 1 first aa55 at 30 leftover 9
That's 37 good packets, one false header rejected by its checksum, 30 bytes of a cut-off packet skipped at the start, and 9 bytes of an unfinished packet left at the end.
rosorin_base/lidar_reader.py turns packets into one scan per turn. It opens the port read-only and exclusive, so it can't send anything to the LiDAR. It puts each turn into 400 bins of 0.9 degrees; where two samples land in one bin, the nearer one wins. A turn is published when the next one starts, so its first ray was taken one turn earlier, and the reader stamps it that much in the past. When I stamped scans with the current time, the localization dropped every one of them and the robot drove 2.6 m past its goal into the things beyond it.
It survives two kinds of failure. If the USB device disappears, or no byte arrives for 2 seconds, it closes the port and keeps trying to open it again every half second. If its reading thread crashes, it exits the whole process, because a node whose thread has died looks alive and publishes nothing forever. The launch file then starts a new one 2 seconds later.
The LiDAR numbers its angles clockwise seen from above, and ROS angles run counter-clockwise, so the reader negates them when its clockwise parameter is set. It doesn't turn the scan to face forward; the base_link to laser transform does that. I found the direction with a floor test: the robot turned left in place, the gyro said +82.5 degrees, and the scans before and after implied a turn of -81. Opposite signs meant the angles run clockwise. That test drives the wheels, so it isn't a step here. Chapter 9's floor test turns the robot and compares the LiDAR's angle with the wheels and the EKF.
With the base still stopped, build and start the reader in one terminal:
source /opt/ros/humble/setup.bash
cd ~/ros2_ws && colcon build --packages-select rosorin_base 2>&1 | tail -1
source install/setup.bash
install/rosorin_base/lib/rosorin_base/lidar_reader
It logs reading /dev/lidar (read-only). Create ~/learn/scan_probe.py on the robot. It waits for one scan and prints what's in it:
import rclpy, math
from rclpy.node import Node
from sensor_msgs.msg import LaserScan
rclpy.init(); n=Node('probe'); got=[]
n.create_subscription(LaserScan,'scan',lambda m: got.append(m),10)
import time; t=time.time()
while not got and time.time()-t<5: rclpy.spin_once(n,timeout_sec=0.2)
m=got[0]; r=[x for x in m.ranges if math.isfinite(x)]
print("frame",m.header.frame_id,"bins",len(m.ranges),"finite",len(r),"min %.3f max %.3f"%(min(r),max(r)),"scan_time %.3f"%m.scan_time)
print("below range_min (self-returns kept in data, RViz/Nav2 ignore):",sum(1 for x in r if x<m.range_min))
In a second terminal:
source /opt/ros/humble/setup.bash
timeout 8 ros2 topic hz /scan 2>&1 | grep -m1 "average rate"
python3 ~/learn/scan_probe.py
average rate: 10.020
frame laser bins 400 finite 298 min 0.051 max 4.141 scan_time 0.100
below range_min (self-returns kept in data, RViz/Nav2 ignore): 51
Ten turns a second, 400 bins, frame laser. The robot's own body is still in the data, 51 values under 0.12 m. The scan's range_min of 0.12 m tells every consumer to ignore them. Stop the reader with Ctrl-C in the first terminal. If it exits at once with "Device or resource busy", the base service or the cat still holds the port.
The launch file you wrote in chapter 6 already starts the reader, as one node:
Node(package='rosorin_base', executable='lidar_reader', name='rosorin_lidar_reader',
respawn=True, respawn_delay=2.0,
parameters=[{'device': '/dev/lidar', 'frame_id': 'laser',
'clockwise': True}]),
respawn=True is the other half of the reader's exit on a crash. Restart the base:
sudo systemctl stop rosorin-mind 2>/dev/null
sudo systemctl restart rosorin-base
sleep 15
sudo systemctl start rosorin-mind 2>/dev/null
source /opt/ros/humble/setup.bash
timeout 8 ros2 topic hz /scan 2>/dev/null | tail -1
journalctl -u rosorin-base --since "-1 min" --no-pager | grep -i lidar | tail -3
The last line of ros2 topic hz read min: 0.099s max: 0.102s std dev: 0.00047s window: 56 on mine: one scan every 0.1 seconds, never more than a few milliseconds late. The journal shows reading /dev/lidar (read-only).
Two tests check that the LiDAR comes back by itself. Both need the wheels disabled, and neither moves anything. Do them on the stand.
The first unbinds the LiDAR's USB device for 3 seconds and binds it again, which is what a loose cable does:
echo 1-2.2.4 | sudo tee /sys/bus/usb/drivers/usb/unbind >/dev/null; sleep 3; echo 1-2.2.4 | sudo tee /sys/bus/usb/drivers/usb/bind >/dev/null; sleep 6
ls -l /dev/lidar
journalctl -u rosorin-base --since "-15s" --no-pager | grep lidar_reader | tail -4
/dev/lidar points at ttyUSB0 again, and the journal shows the reader noticing and recovering:
/dev/lidar: EOF (device gone); reopening
/dev/lidar reopened
Mine reopened 3.5 seconds after it noticed, and /scan came back without a restart.
The second kills the reader process. scripts/tests/scan_gate_live.py checks that the wheels are disabled, kills the reader with SIGKILL, watches the driver's own count of how old the newest scan is, and checks that a new reader appears. Copy it from your laptop:
ssh rosorin 'mkdir -p ~/setup/tests'
scp ~/CCode/rosorin-pro/scripts/tests/scan_gate_live.py rosorin:setup/tests/
On the robot:
source /opt/ros/humble/setup.bash && source ~/ros2_ws/install/setup.bash
python3 ~/setup/tests/scan_gate_live.py 2>&1 | tail -4
journalctl -u rosorin-base --since "-20 s" --no-pager | grep -iE "lidar|respawn|process has died" | tail -5
{"scan_age_before": 0.09, "killed_pids": ["4924"], "worst_scan_age_s": 4.39, "scans_back_after_s": 4.48, "reader_pids_now": ["5171"], "state_blocked": "disabled"}
PASS
The journal shows process has died with exit code -9, then process started with pid 2 seconds later, then reading /dev/lidar (read-only). Scans were back 4.5 seconds after the kill. This matters because when the LiDAR goes silent, every guard that depends on it goes quiet together. The respawn and the driver's scan gate are the answer, and the only way to know they work is to make the LiDAR fail.
A healthy LiDAR on this robot gives 10 Hz with 0.096 to 0.106 seconds between scans, and about 61 percent of the 400 bins with a usable return. It sees about 227 degrees of the room. The rest is a blind sector behind the robot plus the arm tower's shadow, which is why the robot never reverses. Ranges run from 0.12 to 8 m, and thin or glass things return little or nothing.
The robot's eyes are a Deptrum Aurora 930 depth camera on the arm. It gives a colour image, an infrared image and a depth image about 14 times a second. A depth image is 16 bits per pixel, each value a distance in millimetres, with 0 for "no reading". The driver also turns depth into a point cloud. The robot uses the camera to find people, to see obstacles below the LiDAR's plane, and to measure its own motion.
It's the one part of the robot that runs vendor code. The camera has no standard USB video interface, so there's no /dev/video device and no ordinary camera tool can use it. The only driver is Deptrum's: an open ROS wrapper plus a closed library, libdeptrum_stream_aurora900.so. I accepted that one exception on three conditions: the driver lives in its own workspace, ~/vendor_ws, not in ~/ros2_ws and nothing in /usr or /opt; the system gets one udev rule for this one USB id; and it runs in its own service, so a crash in the closed library can't take the wheels' driver down.
lsusb | grep 3251
You should see ID 3251:1930 Linux Foundation Aurora 930.
I found no public download of this driver. It ships with the kit's factory system: Hiwonder's install has the Deptrum source and the closed library in /home/ubuntu/third_party/aurora_ws/src/deptrum-ros-driver-aurora930-0.2.11. That's version 0.2.11 of the wrapper with library 1.1.22, built for ARM. Chapter 4 asked you to save it to your PC before you changed the drive, because the factory system holds the only copy and my second install reformatted that partition. Without a copy you can't install the camera, and the visual odometry, the obstacle map and the AI's vision have no input.
Keep the copy on your PC as a zstd-compressed tar archive whose top folder is vendor_ws, with the driver folder at vendor_ws/src/deptrum-ros-driver-aurora930-0.2.11, and a SHA256SUMS file next to it. The commands below expect it as ~/rosorin-vendor/vendor_ws.tar.zst. My archive came from a backup of an earlier system on this robot that had the driver installed, so I can't show you a tested command for packing it straight from the factory system. The driver folder as it ships includes a hidden .git folder, which you'll deal with in a moment.
From your laptop, check the archive on your PC and unpack only its source onto the robot:
ssh yourpc 'cd ~/rosorin-vendor && sha256sum -c SHA256SUMS'
ssh yourpc 'zstd -dc ~/rosorin-vendor/vendor_ws.tar.zst' | ssh rosorin 'tar -C /home/burgerbarn -xf - vendor_ws/src && echo EXTRACTED'
The first prints the archive's name and OK, the second EXTRACTED. Unpacking as burgerbarn, without sudo, makes the files yours. Taking only src means the driver is built fresh on the new system.
The driver folder is a git checkout, and its git remote address contains a GitLab access token. It came that way with the factory image, and it travels with every copy of the folder. Remove the remote without looking at it. Don't run git remote -v or print .git/config first, because anything you print can end up in a terminal log, a copied command or a backup.
On the robot, check the closed library's hash, remove the remote, check it's gone, and build:
sha256sum ~/vendor_ws/src/deptrum-ros-driver-aurora930-0.2.11/ext/*/lib/libdeptrum_stream_aurora900.so
git -C ~/vendor_ws/src/deptrum-ros-driver-aurora930-0.2.11 remote remove origin
grep -c gitlab-ci-token ~/vendor_ws/src/deptrum-ros-driver-aurora930-0.2.11/.git/config
set +u; source /opt/ros/humble/setup.bash
cd ~/vendor_ws && colcon build --cmake-args -DSTREAM_SDK_TYPE=AURORA930 -DCMAKE_BUILD_TYPE=Release 2>&1 | tail -5
The hash must be exactly this:
20de34b76345affa1bcb9141e7e1735cf85f600a2c6f039f08fa7176a2551aac /home/burgerbarn/vendor_ws/src/deptrum-ros-driver-aurora930-0.2.11/ext/deptrum-stream-aurora900-linux-aarch64-v1.1.22-18.04/lib/libdeptrum_stream_aurora900.so
If it's different, you have a different library from the one this robot runs; find out why before you use it. The grep prints 0. -DSTREAM_SDK_TYPE=AURORA930 picks the camera family, since the package covers other Deptrum cameras too. The set +u is there because ROS's setup script reads variables that may be unset. The build took about 43 seconds and ended like this:
Finished <<< deptrum-ros-driver-aurora930 [42.8s]
Summary: 1 package finished [43.4s]
1 package had stderr output: deptrum-ros-driver-aurora930
The stderr output is compiler warnings, such as This header is obsolete. That's normal for this package.
Check the token is gone for good. The first line must print nothing at all; a fatal: cannot change to line means the folder is missing. The second prints 0:
git -C ~/vendor_ws/src/deptrum-ros-driver-aurora930-0.2.11 remote
grep -c gitlab-ci-token ~/vendor_ws/src/deptrum-ros-driver-aurora930-0.2.11/.git/config
The build never uses the remote, so the camera keeps working. The token is still inside the archive on your PC, and in any backup made from a robot before you removed it. Remember that before you share either.
The camera's permission rule came in chapter 5: it lets members of the video group, and nobody else, open this one device. Check that it applied, and that the driver's launch files are installed (1-2.2.1 is the camera's USB position):
ls -l /dev/bus/usb/001/$(printf %03d $(cat /sys/bus/usb/devices/1-2.2.1/devnum))
ls ~/vendor_ws/install/deptrum-ros-driver-aurora930/share/deptrum-ros-driver-aurora930/launch
The device line starts crw-rw---- 1 root video, and the launch folder lists aurora930_launch.py, aurora930_multi_launch.py, sub_node_ci_aurora930_launch.py and viewer930_launch.py. If the group shows root instead of video, run the rule's udevadm trigger line from chapter 5 again.
Start it in the foreground first, so you see what it says. Use an interactive ssh session, not a background job: a job started with & from a non-interactive shell ignores Ctrl-C, and a forgotten driver holds the camera so the service can't open it later.
source /opt/ros/humble/setup.bash
source ~/vendor_ws/install/setup.bash
ros2 launch deptrum-ros-driver-aurora930 aurora930_launch.py
Among the first lines you should see hello aurora 900/930, device_count==========1 and BOOT_ORDER_1::Found 1 deptrum device. The count of 1 means it found the camera. A count of 0 means another driver already holds it (pgrep -af aurora930_node), the permission rule didn't apply, or the cable is loose.
In a second ssh session, list the topics and measure them:
source /opt/ros/humble/setup.bash
ros2 topic list | grep aurora
for t in /aurora/rgb/image_raw /aurora/depth/image_raw /aurora/points2; do printf "%s " $t; timeout 7 ros2 topic hz $t 2>&1 | grep -m1 "average rate" || echo none; done
top -bn1 | grep -E "aurora|%Cpu" | head -3
There are six topics:
/aurora/depth/image_raw
/aurora/ir/camera_info
/aurora/ir/image_raw
/aurora/points2
/aurora/rgb/camera_info
/aurora/rgb/image_raw
Mine measured colour at 14.801, depth at 12.864 and the point cloud at 7.689 Hz, with the driver using 31 percent of one core. Nothing on the robot reads the point cloud at boot. A depth frame of a living room is valid in about a third of its pixels. Holes on black, shiny or dark things are normal, and the driver's settings drop everything nearer than 0.15 m or farther than 4 m.
Now read the colour camera's intrinsics. A picture alone doesn't say which direction each pixel looks in. The camera_info topic next to each image carries the focal lengths and the image centre in pixels, as a 3x3 matrix k written as nine numbers, fx 0 cx 0 fy cy 0 0 1. With them a program can turn "this pixel is 1.2 m away" into a point in the room.
source /opt/ros/humble/setup.bash
timeout 12 ros2 topic echo --once /aurora/rgb/camera_info 2>/dev/null | grep -E "^height|^width"
timeout 12 ros2 topic echo --once /aurora/rgb/camera_info 2>/dev/null | sed -n "/^k:/,/^r:/p" | head -10 | tr -d " -" | tr "\n" " "; echo
height: 400
width: 640
k: 419.8874816894531 0.0 317.5320739746094 0.0 421.0333251953125 192.90916442871094 0.0 0.0 1.0
So fx is 419.9, cx 317.5, fy 421.0 and cy 192.9. The driver runs with depth aligned to the colour image: depth pixel (u, v) and colour pixel (u, v) look at the same spot, so code that reads depth takes these colour intrinsics. Two details catch people out later. The depth message still says depth_camera_link as its frame, although its pixels follow the colour camera. And colour and depth frames aren't stamped together; one colour frame came 72 ms after its depth frame, so anything that pairs them needs a time window.
Stop the driver with Ctrl-C in the first session.
The camera gets its own service, rosorin-camera, separate from rosorin-base. The unit file is systemd/rosorin-camera.service in the repo:
[Unit]
Description=ROSOrin depth camera (Deptrum Aurora 930 vendor driver, owner-approved exception; /aurora/*)
After=network-online.target rosorin-base.service
Wants=network-online.target
[Service]
User=burgerbarn
Environment=ROS_DOMAIN_ID=0
ExecStart=/bin/bash -c 'source /opt/ros/humble/setup.bash && source /home/burgerbarn/ros2_ws/install/setup.bash && source /home/burgerbarn/vendor_ws/install/setup.bash && exec ros2 launch deptrum-ros-driver-aurora930 aurora930_launch.py'
KillSignal=SIGINT
KillMode=mixed
TimeoutStopSec=10
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
It starts after the base but doesn't require it; neither needs the other. vendor_ws is sourced last, so it's the only place the vendor package comes from. SIGINT with KillMode=mixed sends Ctrl-C to ros2 launch only, which passes it on to the driver. If the driver dies, it comes back 5 seconds later.
scripts/install_camera_service.sh installs and starts it. It refuses to install without a built driver in ~/vendor_ws, and it stops a hand-started driver first, because that one would hold the camera. Copy the unit and both scripts from your laptop:
cd ~/CCode/rosorin-pro
scp systemd/rosorin-camera.service scripts/install_camera_service.sh scripts/rollback_camera_service.sh rosorin:setup/
Run it on the robot with sudo:
sudo bash ~/setup/install_camera_service.sh
It prints Created symlink and a status with active (running). Then check from a normal shell:
source /opt/ros/humble/setup.bash
systemctl show rosorin-camera -p ActiveState -p SubState -p NRestarts
timeout 8 ros2 topic hz /aurora/rgb/image_raw 2>&1 | grep -m1 "average rate"
timeout 8 ros2 topic hz /aurora/depth/image_raw 2>&1 | grep -m1 "average rate"
You want ActiveState=active, SubState=running and NRestarts=0, and NRestarts still 0 when you run it again a little later; mine read 0 both times, 35 seconds apart. A rising count with the state still active means the unit is crash-looping; read journalctl -u rosorin-camera -n 5. Mine read 14.802 for colour and 13.181 for depth. The rollback script, sudo bash ~/setup/rollback_camera_service.sh, is meant to disable and remove the unit; I haven't run it on this build.
Reboot the robot with sudo reboot and run the same check without starting anything. The camera should come up on its own. Right after a boot the first reading can be lower; mine read 12.917 twenty seconds after the start, then 14.024 and 15.017.
A driver can stall with its process alive and its topics silent. Once, after a boot, the service ran for 23 minutes without a single frame, and a restart fixed it. If timeout 6 ros2 topic hz /aurora/rgb/image_raw prints nothing while the service says it's running, run sudo systemctl restart rosorin-camera. The robot's own loop, rosorin-mind, carries a watchdog meant to do this restart by itself, but chapter 13 has no tested install step for that loop and I haven't tested the watchdog on this build, so check by hand.
The gamepad's emergency stop during an arm move wasn't tested on this build. It's meant to freeze the arm in place the moment you press any button except MODE, but I skipped the test, just as I skipped the wheel version in chapter 6. Until you've tested it on your own robot, don't count on it.
MoveIt, the arm path planner, is set up in the repo as the package ros2/rosorin_moveit, but it's parked. I installed and tested it on the stand once on the earlier build and didn't re-run it on this one. Its streaming part, MoveIt Servo, ran at about a sixth of the commanded speed, and I never found out why. Nothing starts MoveIt at boot, and the robot's head moves only through the jogging path above.
Putting the arm away on command isn't reliable yet. The robot's AI has an "arm off" command meant to tuck the arm. When I tried it, it lifted the arm out of its tucked pose before tucking it again, and it was called again and again. Use the driver's arm/tuck service, or let the auto-tuck do it.
The camera sometimes drops off USB. The kernel logs USB disconnect and error -71 for the camera's port, the driver can crash, and the service brings it back about 5 seconds later. In one session it happened 15 times, each during an arm move, and never in 47 minutes with the arm still. The LiDAR on the same hub never dropped. The camera's cable, flexed by the arm it rides on, is the likely cause, but a supply dip during servo current peaks hasn't been ruled out, and it isn't fixed. The first frame after a reconnect can be black.
Once, after a power-on, the LiDAR didn't show up on USB at all, and /scan never started. Software couldn't power-cycle the hub port. Re-seating the plug at the hub brought it back at 1-2.2.4 without a service restart, and the camera came back at 1-2.2.2 instead of 1-2.2.1, which the camera's permission check above looks for.
You're ready for the next chapter when your own make_urdf.py output matches the repo's URDF, /joint_states runs at about 10 Hz, tf2_echo shows the laser and imu_link frames with the numbers above, and the camera_link frame changes when the arm moves. test_arm.py must end with 14 passed, arm/read_state must list all six servos, arm/recover must reach rest with "inside_limits": true, a goal outside the limits must be refused with nothing moving, and arm/tuck must return "tucked": true, with an untouched arm tucking itself 120 seconds after a recover. /dev/lidar must point at a ttyUSB device, test_coin_d6.py must end with 3 passed, /scan must run at about 10 Hz in frame laser with 400 bins, and both failure tests must recover, ending in reopened and PASS. rosorin-camera must be enabled and give 13 to 15 Hz of colour images after a reboot without your help, the colour k must start with 419.88, and the driver folder's git remote must print nothing. Last, rosorin-base must be active again after all the tests.