Skip to content

v1 Mantis: bring up the arm and Z, and a stop that halts the device - #1623

Merged
BioCam merged 2 commits into
mainfrom
mantis-v1-03-arm-bring-up
Nov 13, 2026
Merged

BioCam merged 2 commits into
mainfrom
mantis-v1-03-arm-bring-up

Conversation

@BioCam

@BioCam BioCam commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

The Problem

The Mantis arm (two arms driving one head, plus Z) has to be brought up after every power-on: energised, told where it is, homed. Each unit's arm is calibrated at the factory, so values from one unit put another's head in the wrong place. And a stop has to actually halt the device: abort what is queued, stop every motor and park, before the link closes.

PR Content/Solution

  • mantis.arm (v4), built when the absolute encoder board answers. Its calibration (each arm motor's offset, encoder reference and encoder correction) comes from the unit's configuration folder or a saved file, never from a recording; without it, bringing the arm up refuses before anything is sent.
  • setup() brings the arm and Z up as in the recorded v4 startup: energise, read where the arms are from the absolute encoders, set the following-error limits, move to idle, home Z. It only starts near idle; anywhere else it refuses and unpowers the arms. setup(skip_arm=True) reads only, nothing moves.
  • stop() halts the device: aborts the sequencer, stops every motor, parks an arm that was brought up (Z down to 20 mm), then releases the clamp. Each step runs even if one before it fails.
  • Kinematics (arm_kinematics.py): device units, inverse and forward kinematics and the encoder correction, as pure maths.
  • Reads: request_head_position, request_joint_position, request_absolute_joint_position, request_link_angles.
  • Resource model: the Z column and the arm's links join the 3D model, placed from a pose read.
  • LED bar: the bring-up shows in setup's colour.

Usage

mantis = Mantis(name="mantis", declared_configuration_json="my_mantis.json")
await mantis.setup()  # brings the arm and Z up
await mantis.arm.request_head_position()  # the idle position
await mantis.stop()  # halt, park, release

await mantis.setup(skip_arm=True)  # reads only

On the device

A Mantis v4 on Windows (D2XX), head clear, no chip:

result
read-only pose head at (14.983, 31.180) mm from the absolute encoders, idle within 0.02 mm
no arm calibration refused before anything was sent, nothing moved
cold bring-up at idle no fault; arms within 10⁻⁷ device units of idle; Z homed twice; the same commands in the same order as the recorded v4 startup
reads after the bring-up head (15.000, 31.177, −0.003) mm
stop() abort, three motor stops, Z read by its encoder before the arms moved, Z down to 20 mm (19.996 read back)
stop in the middle of five queued Z moves the item already playing finished, the rest never played, then the park
second setup in one process, after a USB reconnect, from the saved file alone the same bring-up each time; the saved file alone sent the same 155 commands in the same order
arm moved away from idle by hand refused with the head's position, no move sent, the arms unpowered

🤖 Generated with Claude Code

@BioCam
BioCam added this pull request to stack #1625 November 12, 2026 18:47
@BioCam
BioCam force-pushed the mantis-v1-03-arm-bring-up branch from f9eaacb to e00ab9d Compare November 12, 2026 19:00
@BioCam
BioCam force-pushed the mantis-v1-03-arm-bring-up branch from e00ab9d to 8a697ec Compare November 12, 2026 21:05
@BioCam
BioCam marked this pull request as ready for review November 12, 2026 21:18
@BioCam
BioCam requested a review from a team as a code owner November 12, 2026 21:18
@BioCam
BioCam force-pushed the mantis-v1-03-arm-bring-up branch 2 times, most recently from b24411f to 524c5bf Compare November 13, 2026 08:03
Base automatically changed from mantis-v1-02-sequencer-events to main November 13, 2026 08:29
On a v4 the arm is built when board 11 answers. Its calibration, each arm
motor's offset, encoder reference and encoder correction, comes from the
unit's configuration and correction files or a saved configuration,
never from a recording: without it, bringing the arm up refuses before
anything is sent. The kinematics are pure maths in arm_kinematics:
device units, inverse and forward kinematics, the encoder correction.

setup() brings the arm and Z up command for command as in the recorded
v4 startup: energise, declare from the absolute encoders, following
error, move to idle, home Z on its home-done event, declare and move to
idle twice, home Z. It moves only from near idle; elsewhere it refuses
and unpowers the arms. setup(skip_arm=True) reads only. stop() aborts
the sequencer, stops every motor, parks an arm brought up once every
motor stopped (Z up alone and read back by its encoder, then queued as
in the recorded close, Z down to 20 mm), then releases the clamp; each
step in its own try. A move that fails part way stops the motors it
started and logs where their encoders read. On a v4 the LED bar shows the bring-up in setup's
colour. The Z column and the arm's
links join the resource model, placed from a pose read. The simulation
brings a simulated arm up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BioCam
BioCam force-pushed the mantis-v1-03-arm-bring-up branch from 524c5bf to 159c54c Compare November 13, 2026 08:29
…ne comes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BioCam
BioCam merged commit 7f075f9 into main Nov 13, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant