Repository navigation
Firmware
One PlatformIO project in firmware/, one binary per ROS 2 distro (minihexa for Jazzy, minihexa_lyrical
for Lyrical, where /cmd_vel is a TwistStamped). Build and flash are separate steps; never
pio run -t upload.
pio run -d firmware -e minihexa # build
pio test -d firmware -e native # IK, gait, servo, sensor and AHRS tests on the host
| path | what |
|---|---|
lib/hexa_kin |
body and leg geometry, leg IK and FK. Plain C++ |
lib/hexa_gait |
tripod gait: body twist in, foot positions out. Plain C++ |
lib/hexa_servo |
joint angle ↔ pulse, per-joint calibration, servo ids, the servo controller's frame, the simulated servo. Plain C++ |
lib/hexa_world |
the robot model: gait, IK and pulses for both modes; in sim mode the simulated servos and the true pose from the feet. Plain C++ |
lib/hexa_sensors |
the simulated IMU (QMI8658A) and ultrasonic. Plain C++ |
lib/hexa_ahrs |
the AHRS: orientation from the IMU's gyro and accelerometer (below). Plain C++ |
lib/hexa_power |
the final shutdown's low-battery trigger (Shutdown, below). Plain C++ |
lib/hexa_settings |
settings sent over Wi-Fi: the format and the rules (Robot settings, below). Plain C++ |
include/board_minihexa.h |
the controller board's pins and buses (verified on a robot) |
src/main.cpp |
applications, micro-ROS, console |
src/board_io.* |
the board's buses: the servo controller (UART), battery monitor, ultrasonic and IMU (I2C) |
src/qmi8658.* |
the QMI8658 driver, ported from linorobot2-cockpit |
src/link.* |
the micro-ROS link (USB serial or Wi-Fi UDP) and OTA updates |
src/syslog.* |
remote log lines over UDP syslog (linorobot2-cockpit's form and receiver) |
tools/ |
make_nvs.py (robot settings → NVS image), ota_upload.py, push_settings.py (settings over Wi-Fi) |
test/ |
Unity tests, native env |
The libraries have no Arduino dependency, so the firmware, the tests, the host simulator and the ROS 2 node (see simulation.md) all run the same model.
The NVS key app picks what boots:
-
base: micro-ROS over USB serial at 921600 baud, or over Wi-Fi (below). Subscribes
/cmd_vel,/gait_params,/shutdownand/body_pose; publishes the topics below. The gait runs at 50 Hz with or without an agent. A/cmd_velstream that stops for 0.5 s counts as zero: the robot finishes its steps and stands. -
console: line commands on the USB serial port. On a Wi-Fi link the port is free, so the base application
takes the same commands there too.
info(chip, revision, flash size, MAC, last reset, mode, IMU, sonar, gait, link),link,i2c(bus scan),bat,sonar,imu,trims,app base|console,sim on|off,reboot,shutdown(the final shutdown, below),pose [roll pitch yaw (deg) [x y z (mm)]](Body pose). Bench commands, sim mode only (the robot on a stand):servo <id> <us> [ms]moves one servo;foot <leg> <dx> <dy> <dz> [ms]moves one leg's foot by millimetres from its standing position, body frame, through the gait's IK and the servo calibration.
Press BOOT within two seconds after a reset to reach the console whatever app says. (BOOT held through the
reset starts the ROM bootloader instead, as on every ESP32.)
A loop stuck for 5 s trips the task watchdog: the board reboots and reconnects instead of freezing the gait
mid-stride. info says when that was the last reset.
Everything that belongs to one robot lives in the NVS namespace hexa, written as an NVS image with the
firmware (tools/make_nvs.py <settings file> <out.bin>, flashed at 0x9000; OTA updates leave it in place):
| key | value |
|---|---|
app |
base (default) or console
|
sim |
1 (default): simulated servos and sensors; 0: the real robot |
link |
serial (default) or wifi
|
ssid, psk
|
the Wi-Fi network (2.4 GHz) and its key |
agent, port
|
the micro-ROS agent's IPv4 address and UDP port (default 8888) |
ota_pw |
the OTA password; none: no OTA |
trims |
18 comma-separated servo trims in µs, by servo id: the vendor's "deviation" values |
idle_s |
seconds without a command that moves before the robot lies down (Gait, below), 0-3600; default 30; 0: never |
low_bat_mv |
the final shutdown's battery floor (Shutdown, below) in mV, 5600-8000; default 6400 (3.2 V a cell); 0: never |
syslog_ip, syslog_port
|
the UDP syslog sink (Syslog, below); port default 5140; none: no syslog |
tilt_hold |
body tilt feedback gain while standing (Tilt hold, below), 1/s, 0-5; default 1.5; 0: off |
yaw_hold |
heading hold / turn-rate feedback gain (Gait, below), 1/s, 0-5; default 1.0; 0: off |
gait |
tripod (default), quad, high or climb: the gait at boot (Gait, below) |
com |
x,y in mm (each within ±30): the centre of mass off the body's origin (x forward, y left), for the quadruped's sway; default 0,0
|
imu_level |
roll,pitch in degrees (each within ±10): how the IMU sits on its board, read with the body level (a level on the top plate) from the console's imu. Every IMU sample is turned into the body frame with it; none: the board is taken as level |
The settings file carries the Wi-Fi key and the OTA password: keep it private (mode 0600) and out of any public repository. Read the trims off the robot (the vendor firmware keeps them in its NVS) before our firmware replaces it.
Over Wi-Fi, without USB, tools/push_settings.py <board IP> <settings file> <password file> changes
settings on a board that has OTA. The file has the same lines, only the keys to change; the others stay. An
empty value (trims=) removes a key that has a default (app, sim, port, trims, imu_level,
idle_s, low_bat_mv, syslog_ip, syslog_port, yaw_hold, tilt_hold, gait, com). It goes through ArduinoOTA with the OTA password (read from the password file, never the command
line) and its MD5 check, into the unused spiffs partition. The board reboots, and the robot stands in its
boot pose. Before anything reads NVS, the board checks every line (lib/hexa_settings, the rules of
make_nvs.py). It writes the keys only if all pass, then erases the upload, so the upload is applied once.
info shows what happened (settings over Wi-Fi at boot). Some changes are refused because they would lose a
robot that can only be reached over Wi-Fi: link=serial, removing ssid, psk, agent or ota_pw, and
link=wifi without a network and an agent. A change of link, ssid or psk is on trial: if the board has
not joined the network 60 s after that boot, it puts the old values back and reboots. A new ota_pw holds
from the next upload on.
On a Wi-Fi link the board sends its log lines to a UDP syslog sink (syslog_ip, syslog_port, default 5140), in
linorobot2-cockpit's RFC 5424 form, so the cockpit's receiver (web/backend/syslog_manager.py) takes them as it
takes a linorobot2 board's; on Serial too, where Serial is free. Lines from before the network is up (the boot's)
wait in a backlog of 12 and go out when it is. A serial link sends none (no radio). The lines: boot (build,
mode, reset reason, the settings upload's result, idle and battery floor), agent sessions up and lost, a
health line every 30 s (battery, RSSI, sessions, slowest loop, late ticks, gait state, sonar, unreachable
feet), idle down and up, sonar changes, gait faults, shutdown, ota and settings events.
With link=wifi the board joins the network (modem sleep off) and talks to a micro-ROS agent over UDP
(micro_ros_agent udp4 -p 8888), one datagram per message. A Wi-Fi link that cannot work (no network or no
valid agent address) falls back to serial. The USB port then prints a status line on every change and every
30 s: network, address, signal, channel, power-save mode, agent, datagrams sent, refused and received, the OTA
state, the running partition and the first 16 hex digits of the running ELF's SHA-256 (sha256sum firmware.elf matches it).
With ota_pw set, the board takes ArduinoOTA updates on TCP 3232 (no mDNS): tools/ota_upload.py <board ip> <firmware.bin> <password file>. The gait is told to stand when an update starts. The partition table
(min_spiffs.csv) has two 1.9 MB app slots; each update goes to the other slot, so a failed one leaves the
running app in place. A wrong password is refused.
The link's quality is the access point's: a busy shared 2.4 GHz network gave pings of 30-50 ms with 250 ms peaks and up to half the sends refused (the driver's queue full), and the topics fell short of their rates; a dedicated access point gave 4.5 ms with 14 ms peaks and every check at its rate.
The NVS key sim (default on) chooses the simulated robot. On a bare ESP32 the base application walks simulated
servos and publishes their angles, plus the simulated IMU, ultrasonic and ground truth.
In real mode (sim=0, allowed because board_minihexa.h sets HEXA_BOARD_VERIFIED) the gait drives the 18
servos: every tick one frame to the servo controller with all 18 pulses (the first after boot over 1 s, from
wherever the legs hang to the stand). /joint_states carries the commanded angles, because a PWM servo reports
nothing back. The sensors are the real parts, each published only when it answers at boot: the QMI8658 as
/imu/data, the ultrasonic as /sonar, the battery monitor as /battery (that one in both modes). Nothing
simulated is published in real mode. The QMI8658 sits on the board turned a quarter turn: its x points left and its y back, so
every sample is mapped into the body frame (x forward, y left, z up) as (-chip y, chip x, chip z) before anything
else (found with body poses: a commanded roll read as pitch). imu_level is measured in the body frame.
The servos sit behind a servo controller on the board, which takes frames on a UART (230400 baud): header
55 55, function 01, length, command 01, count, move time (ms), then per servo its id and pulse (µs), and a
checksum (servo_bus_frame). Pulses run 500-2500 µs over 280° (409 µs/rad). The calibration (default_cal) is
the vendor's convention: at 1500 µs every joint sits at its zero (coxa and femur 0, tibia −90° from the femur);
a longer pulse turns every coxa counter-clockwise seen from above, lowers a right femur and raises a left one
(the left femur and tibia servos are mounted mirrored); the femur is held to 857-2143 µs (±90°). The vendor
numbers the legs 1-3 right rear, middle, front and 4-6 left front, middle, rear; servo id = (leg − 1) × 3 +
joint + 1 (servo_id). Each servo's trim is added to every pulse. The standing pose gives the vendor's
standing pulses (1500 / 1409 / 1357 µs right, 1500 / 1591 / 1643 left) within 1 µs.
A tripod gait (lib/hexa_gait). Defaults (GaitParams), tuned on a robot on glazed tile: a 0.4 s fastest cycle, each
foot down 70 % of it (both tripods down for a fifth of the cycle at each change), 30 mm lift, 60 mm longest
stride; top speed 214 mm/s (about 130 mm/s on tile from a standing start) and about 1.6 rad/s. Measured by the gyro and a camera against the earlier
1.0 s / 0.5 / 25 mm / 40 mm: turns reach 65-68 % of the command instead of 38-41 %, straight lines 67 % instead of
53 % (hard feet slip on tile; /odom/gait integrates the command, so it reads long by that much); more overlap helps
a little, a higher lift did not. The fastest cycle was 1.5 s (57 mm/s) until a sweep judged by the LiDAR found the
ground share the same from 1.5 s to 0.8 s (70-72 %) and higher at 0.65-0.5 s (80 %; 138 mm/s at 0.5 s). 0.4 s, the
default and the shortest allowed, walks 20 cm from standing at 128-132 mm/s against 113-117 at 0.5 s: 13 % faster for
25 % more steps, as the servos fall behind (sim/tools/cycle_sim.cpp, servos at most 10.5 rad/s: sideways they trail
their command by 39 deg at 0.5 s and 43 deg at 0.4 s).
Heading hold. The feet slip, so open loop a straight walk drifts (up to -0.24 rad in 20 s on tile) and a turn
makes 60-65 % of its rate. While the gait walks, the board integrates (commanded - measured) yaw rate from the
bias-corrected gyro (sim or real) and adds yaw_hold (NVS, default 1.0 /s; 0: off) times that heading lost to the
gait's yaw rate, plus a slowly learned steady part (0.5 /s² on the heading lost, so a steady slip is not held
by staying behind), the error capped at 0.3 rad and the trim at 0.25 rad/s, reset while standing. /odom/gait keeps
the commanded yaw rate: the trim only makes the body turn as commanded. The health line shows the heading lost.
Cadence. period_s is the fastest cycle, the one top speed needs. Asked for less, the gait slows its cycle,
up to max_period_s (3.0 s), so that the stride stays at 95 % of the longest: a step costs the servos about the
same whatever ground it covers, so fewer, longer steps save power (at 0.02 m/s about half the steps of a fixed
1.5 s cycle, a quarter of a fixed 0.8 s one). The cycle follows the command over about one cycle; faster than the cycle allows is clamped
meanwhile. A command that moves no foot faster than 2 mm/s counts as zero, so the gait does not step on the spot.
info and the health line show the cycle in use.
Reach. A command that changes mid-stance moves a stance foot on from where the last one left it. A reversal once carried a foot landed half a stride ahead a full stride further, 1.5 strides from its neutral spot. The gait now scales such a command down until every stance foot ends its stance within one stride of neutral, which is what a start from standing takes. A steady walk is never slowed; a reversal every 1.3 s covers 2.5 % less ground.
/gait_params (std_msgs/Float32MultiArray: period s, duty, lift m, longest stride m) changes them at run time.
They are taken when the gait next stands and only within bounds: period 0.5-3 s, duty 0.5-0.8, body height 0-40 mm,
lift 10 mm up to 40 mm plus the height (80 at most), stride 10 mm up to 65 mm less the height (60 at most).
info shows the ones in use. A fifth value switches the mode: 0 tripod, 1 quadruped, 2 high walk, 3 climb
pose; a sixth sets the body height (m). The mode's defaults come first, and a 0 among the other values keeps the
default's, so [0, 0, 0, 0, 1] is the quadruped as it comes and [0, 0, 0, 0, 0] the tripod's defaults.
High walk and climb pose. With gait=high or gait=climb (NVS, at boot), /gait_params's mode 2 or 3,
or the console's gait high or gait climb (both at run time, not kept), the body stands higher: every foot
goes lower in the body frame. The cockpit's Hexapod tab has buttons for all four modes. The switch is taken while
the robot stands: the body rises (or comes down for gait tripod) at 2 cm/s, and walking waits for it.
| mode | body up | belly off the floor | swing | stride | cycle | top speed |
|---|---|---|---|---|---|---|
| tripod | 0 | 45 mm | 30 mm | 60 mm | 0.4-3 s, duty 0.7 | 214 mm/s |
| high | 20 mm | 65 mm | 50 mm | 45 mm | 1.0-3 s, duty 0.7 | 64 mm/s |
| climb | 40 mm | 85 mm | 80 mm | 25 mm | 2.0-4 s, duty 0.75 | 17 mm/s |
The high walk steps over cables and pipes up to about 45 mm: the feet clear them and so does the belly. The
climb pose is the highest body the legs still walk with: a front foot reaches 80 mm above the floor, and the
belly clears 85 mm. A step any higher would meet the body, whatever the legs reach. The gait does not feel a step:
a foot landing on one is a foot landing high, which tilts the body until it steps off again. A raised body leaves
less leg for the stride, about 5 mm less for every 5 mm of height. The figures come from
sim/tools/high_walk_sim.cpp: every corner of the bounds above was walked at top speed each way, then for 120 s of
commands changing every 0.2-1 s, with no foot out of reach and every servo at least 37 µs inside its range (the
presets 117 µs or more). Nav2 is tuned for the tripod; drive the high walk and the climb pose by teleop. info and
the health line name the mode.
Quadruped. With gait=quad (NVS, at boot), /gait_params's mode 1 or the console's gait quad (both at
run time, not kept), the middle legs go up, 40 mm above the stance floor, and the four corner legs crawl one
at a time: left rear, left front, right rear, right front. Before each lift the body sways until the centre
of mass is 20 mm inside the triangle of the three feet that stay down. The centre of mass is the body's origin
plus com (NVS): measure it before walking on four, because 10 mm of error costs about 5 mm of margin. The
defaults (duty 0.88, period 2.5-4 s, stride 45 mm: 20 mm/s at most) and how they were chosen are in
simulation.md. The switch is taken while the robot stands: the middle feet
rise (or come down for gait tripod) in about a second, and walking waits for them. info shows the mode, the
sway and the centre of mass; the health line says (quad).
Idle. The servo controller has no "servos off": its protocol only sets pulses, and it holds the last ones,
so the servos are never unpowered while the board is on (a pulse of 0 is clamped to 500 µs: the joint swings to
its end stop and holds, tried on the robot). To save power the robot lies down instead: after
idle_s seconds (default 30, also from boot) without a /cmd_vel that moves, and once the gait stands, the
body lowers onto its belly over 3 s and the feet come down beside it (75 mm out from each hip, 15 mm under the
hip axis; the belly is 12-15 mm under it): it lies on its belly and six feet, steadier than on the belly alone,
and the servos hold only the legs. The next command that moves
stands it up again over 3 s; commands are taken as zero until it is up, so a stream of /cmd_vel walks on from
there (a single message sent while it lies down is dropped). info shows the setting and whether it is up,
lying down or between. Power off is the robot's switch.
Stopping. A zero command (or a lost stream) finishes the stride: every foot steps back onto its neutral
position and the gait stands. At a duty of 0.5 the last tripod lands on the very tick the other would lift, so
that tick is the stand. A stop that has not settled two cycles after the command went to zero is put down at once
(all feet on neutral) and logged as a gait fault; it is a backstop, and the tests never reach it.
Shutdown. The final shutdown puts the robot down and the ESP32 into deep sleep: Wi-Fi, the CPUs and the
link stop, and the board waits only for its BOOT button. It comes from /shutdown (std_msgs/String, data
shutdown; any other data is ignored), from the console's shutdown, or from a flat pack: the battery
monitor under low_bat_mv (default 6400 mV) for 30 readings in a row (1 Hz) taken while the gait stands or
lies down (walking sags the pack; those readings are not counted). The robot drops its command, finishes the
stride, lies down as in Idle, the micro-ROS session is closed, and the board sleeps (after 15 s at most, lying
down or not). Commands are dropped from the request on. The servo controller has no "servos off", so it keeps
holding the lying pose (on the belly and the feet: the legs only) and stays on with the battery monitor; the servo line is held
idle through the sleep. Press BOOT (or EN) to wake it: that is a boot, so the robot stands up into its boot
pose; the press that woke it does not select the console. info says woken from the final shutdown and
shows the floor. The power switch still cuts everything.
ros2 topic pub --once /shutdown std_msgs/msg/String "{data: shutdown}"
Body pose. /body_pose (or the console's pose) shifts the body (x forward, y left, z up: ±25, ±25,
±20 mm) and turns it (roll, pitch, yaw: ±15° each) over feet that stay where the gait puts them: every foot
target goes through the inverse pose before the IK, standing or walking. It is reached at 40 mm/s and 0.5 rad/s,
and only as far as every foot stays reachable with no pulse clamped: each axis alone reaches its limit standing,
all six at once about 70 % of them, so a combined pose stops where the legs end. While walking a fifth of it is
kept (every corner is reachable at top speed). Lying down eases it out and standing up brings it back; a pose
command counts as use (the idle timer starts again) and stands a resting robot up. It is not
locomotion: odometry does not see it, and the gyro's bias is learned only while it is still. info and the
health line show it.
Tilt hold. On the robot the body reached ~70 % of a commanded roll or pitch: the legs and servos give under
the load. Standing (real IMU only), the integral of (commanded - measured) roll and pitch, measured by the AHRS
against gravity, is added to the pose's roll and pitch: tilt_hold (NVS, default 1.5 /s; 0: off), at most 8°
each, within the pose limits and the reach gate; inside 0.3° of the target it holds still, so the pose settles, and it integrates only once the pose has reached its
target (on the ramp the error is the ramp's: integrating it overshot by 1-2°).
So a pose's roll and pitch are relative to gravity: a neutral pose is a level body, on a slope or straddling a
step. Walking, lying down or shutting down resets it. The simulated IMU does not feel a body pose, so sim mode has
none. The health line shows the trims.
Sonar lights. In real mode the ultrasonic is read at 10 Hz with or without an agent, and its two lights show what it sees: blue clear, yellow under 0.40 m, red under 0.20 m (20 mm of hysteresis), each change logged; a green heartbeat while the robot lies down (idle mode: a "lub-dub" double pulse every 1.6 s, never fully dark, so a robot lying still shows it is alive), and off at the final shutdown (the module stays powered). It is feedback only: stopping for an obstacle is the host's (nav2_collision_monitor or a test's guard). The sonar's cone is narrow (15°): a thin table leg beside its axis is not seen.
The board fuses the IMU itself (lib/hexa_ahrs), so /imu/data carries an orientation and no filter node is
needed on the host. It is Madgwick's gradient-descent filter for a 6-axis IMU, written from his 2010 report:
the gyro rate is integrated, and each sample takes a step of fixed size β down the gradient of the error between
the gravity the estimate predicts and the accelerometer's direction. It is the filter imu_filter_madgwick runs
for an IMU without a magnetometer; driven with the same samples and seeded alike, the two agree to 2.4e-5 rad
once the reference's fast inverse square root is replaced by an exact one (with it, the reference sits up to
0.3° away standing still).
-
Gain β = 0.1,
imu_filter_madgwick's default: a 10° tilt step settles within 0.5° in 0.84 s. Unmeasured on the robot. -
Seed: the first sample sets roll and pitch from gravity, with yaw 0, so the first message is already
level. Until then
orientation_covariance[0]is −1 (REP 145: no orientation). - Roll and pitch are absolute, levelled against gravity. They are the sensor's: a board mounted off level reads its own tilt (the simulated one, roll 1.0° and pitch −1.5°, shows up as such). Declared variance (0.2°)², from the filter's error in simulation.
- Yaw is the gyro's integral from 0 at boot. The QMI8658A has no magnetometer, so nothing anchors it and it drifts with what is left of the gyro's bias. Its declared variance is 10⁶: fuse the yaw rate, never this yaw as absolute.
-
Gyro bias (
GyroBias): a standing walker does not turn, and the gait knows when it stands (every foot down on its neutral position, nothing commanded). After 0.5 s standing the board averages the gyro (time constant 1 s) into a bias estimate and takes it out of every sample, before the AHRS and before/imu/data; walking, the estimate is held. A reading over 0.05 rad/s is motion, not bias, and is not learned. In simulation, 120 s standing drift the yaw 0.0045 rad at worst instead of 0.055. A robot turned slowly by hand while it stands would be learned as bias: nothing on board can tell the two apart. - Robustness: a gap over 0.5 s (a stalled loop) holds the estimate rather than integrating it as motion; a zero or non-finite accelerometer falls back to the gyro; a non-finite gyro is skipped.
-
Gravity stays in
linear_acceleration(REP 145): a consumer that wants motion removes it.
It runs on every IMU sample, connected to an agent or not, at the 50 Hz frame (dt = 20 ms). The ROS 2 node runs the same code. A real QMI8658A will need dt from the sample timestamps.
| topic | type | notes |
|---|---|---|
/cmd_vel |
geometry_msgs/Twist (Jazzy), TwistStamped (Lyrical) |
linear.x, linear.y, angular.z; clamped to the stride limit |
/joint_states |
sensor_msgs/JointState |
18 joints rf_coxa … lf_tibia; sim: simulated angle; real: commanded |
/odom/gait |
nav_msgs/Odometry |
integrated commanded body twist (dead reckoning, no slip), odom → base_footprint; covariances below |
/gait_params |
std_msgs/Float32MultiArray |
subscribed: the gait's parameters (above) |
/shutdown |
std_msgs/String |
subscribed: data shutdown = the final shutdown (above) |
/body_pose |
geometry_msgs/Pose |
subscribed: the body's shift (position, m) and turn (orientation) over planted feet (Body pose, below) |
/foot_offset |
std_msgs/Float32MultiArray |
subscribed: the balance probe, leg dx dy dz (leg 0-5: rf rm rr lr lm lf; m, |dx|, |dy| ≤ 0.02, dz 0-0.03) moves one foot off its spot while the robot stands; -1 0 0 0 or an empty array puts it back. A command that moves puts it back first. The tilt hold keeps its trims while a foot is off, so a tip shows on the IMU |
/imu/data |
sensor_msgs/Imu |
50 Hz, gyro bias taken out, with the AHRS's orientation (above). Sim: the simulated QMI8658A (simulation.md); real: the QMI8658 (±8 g, ±1024 dps, 224 Hz, on-chip low-pass ~30 Hz), in the body frame (the robot's imu_level) |
/sonar |
sensor_msgs/Range |
10 Hz. Sim: the simulated ultrasonic; real: the I2C module. Nothing within reach reads max_range, never +INF (nav2_collision_monitor treats an out-of-span reading as an invalid source and stops) |
/battery |
sensor_msgs/BatteryState |
1 Hz, the pack's voltage from the board's monitor (both modes; only when it answers) |
/sim/ground_truth |
nav_msgs/Odometry |
sim mode: the true pose, 5 Hz |
/odom/gait declares (gait_odom_variance, one table for the firmware and the ROS 2 node):
| x, y | yaw | z, roll, pitch | |
|---|---|---|---|
| pose | 0.01 | 0.05 | 10⁶ |
| twist, walking | 0.004 | 0.02 | 10⁶ |
| twist, standing | 1e-8 | 1e-8 | 10⁶ |
Walking, the feet slip and servos lag, so the twist is loose and an EKF's heading follows the gyro (2e-6). Standing, the body is still and the gait's zero is exact, declared tighter than the gyro: the EKF holds the heading on it (a zero-velocity update). Its pose is the integral of the same twist; the EKF does not fuse it.
Every published topic is best effort, and so is every subscription, keep-last 1: the board holds one received
message at a time (RMW_UXRCE_MAX_HISTORY=1, esp32.meta), and rclc's default (reliable, keep-last 10) would
make it keep the oldest. Both as linorobot2-cockpit's firmware. A reliable publisher matches. The one-shot
topics (/gait_params, /shutdown, /body_pose, /foot_offset) are idempotent: to be sure, send one again,
or read the board's log line for it.
At 921600 baud the link carries about 90 KB/s. The topics above are about 50 KB/s of messages (/joint_states
452 B and /odom/gait 732 B at 25 Hz, /imu/data 332 B at 50 Hz, the rest small or slow). With ground truth
at 25 Hz it was 65 KB/s, and rates fell to ~88 % as the link saturated. Keep new topics inside the budget, or move
the robot to Wi-Fi.
The executor polls with a zero timeout. With 1 ms, the micro-ROS client's framed read sometimes never returned (it takes each read's elapsed time off its timeout in whole milliseconds) and the loop hung for good: about half the sessions at full load, on both distros. A core dump showed the loop inside that read.
Body frame x forward, y left, z up. Legs rf rm rr lr lm lf (clockwise from the front right); tripod A = rf, rr,
lm. Joints per leg: coxa (yaw), femur (pitch, 0 = horizontal, + lifts the knee), tibia (relative to the femur,
0 = straight, − folds the foot down). Joint index = leg × 3 + joint.
The leg lengths, hip positions and mount directions in hexa_kin.cpp are the vendor's design figures
(hardware-minihexa.md): coxa 28.5 mm, femur 52 mm, tibia 72 mm (foot plate included);
hips at (±56.5, ±31.5) mm and (0, ±43.4) mm; corner legs pointing out at 45°, middle legs straight out.
Home · Hardware: miniHexa · Architecture · Simulation · LiDAR, SLAM, Nav2 and exploration · Camera and vision · Web UI: Hexapod tab