Skip to content

rotrics.dexarm

flex_drivers.rotrics.dexarm.DexArm

Bases: SerialInstrument

Rotrics DexArm robot arm.

Speaks G-code over serial at 115200 baud. Commands embed their own terminators (\r / \r\n) exactly as the firmware expects, and the arm acknowledges each command with a line containing ok — so this driver talks to the serial port directly through :meth:_send_cmd rather than the line-oriented base write/read.

go_home()

Go to the home position and enable the motors.

Should be called each time the arm is powered on.

set_workorigin()

Set the current position as the new work origin.

set_acceleration(acceleration, travel_acceleration, retract_acceleration=60)

Set the preferred starting acceleration for moves of different types.

Parameters:

Name Type Description Default
acceleration int

Printing acceleration. Used for moves that employ the current tool.

required
travel_acceleration int

Used for moves that include no extrusion.

required
retract_acceleration int

Used for extruder retraction moves.

60

set_module_type(module_type)

Set the type of end effector.

Parameters:

Name Type Description Default
module_type int

0 for pen holder module, 1 for laser engraving module, 2 for pneumatic module, 3 for 3D printing module.

required

get_module_type()

Get the type of end effector.

Returns:

Type Description
str | None

'PEN', 'LASER', 'PUMP', or '3D' (None if the arm did not report

str | None

a recognized module before acknowledging).

move_to(x=None, y=None, z=None, e=None, feedrate=2000, mode='G1', wait=True)

Move to a cartesian position.

Adds a linear move to the queue, performed after all previous moves complete.

Position is in millimeters by default (inches after G20); the center of the y axis is 300 mm.

Parameters:

Name Type Description Default
mode str

"G1" (default) or "G0" for fast mode.

'G1'
feedrate int

Sets the feedrate for all subsequent moves.

2000
wait bool

Block until the arm acknowledges the move.

True

fast_move_to(x=None, y=None, z=None, feedrate=2000, wait=True)

Fast move to a cartesian position (mode G0), in millimeters.

Parameters:

Name Type Description Default
feedrate int

Sets the feedrate for all subsequent moves.

2000
wait bool

Block until the arm acknowledges the move.

True

get_current_position()

Get the current position.

Returns:

Type Description
float | None

Position (x, y, z), extrusion e, and DexArm theta

float | None

(a, b, c).

delay_ms(value)

Pause the command queue for value milliseconds.

delay_s(value)

Pause the command queue for value seconds.

soft_gripper_pick()

Close the soft gripper.

soft_gripper_place()

Wide-open the soft gripper.

soft_gripper_nature()

Release the soft gripper to its natural state.

soft_gripper_stop()

Stop the soft gripper.

air_picker_pick()

Pick up an object.

air_picker_place()

Release an object.

air_picker_nature()

Release to natural state.

air_picker_stop()

Stop the picker.

laser_on(value=0)

Turn on the laser.

Parameters:

Name Type Description Default
value int

Set the power, range from 1 to 255.

0

laser_off()

Turn off the laser.

conveyor_belt_forward(speed=0)

Move the belt forward.

conveyor_belt_backward(speed=0)

Move the belt backward.

conveyor_belt_stop()

Stop the belt.

sliding_rail_init()

Initialize the sliding rail.