-
Notifications
You must be signed in to change notification settings - Fork 3
RaftMotorControlCommands
Rob Dobson edited this page Mar 3, 2026
·
1 revision
MotorControl accepts JSON commands through DeviceManager:
GET /devman/cmdjson?body={...}
The JSON body must include a device field that matches the configured device name.
Example (URL-encode the JSON in practice):
GET /devman/cmdjson?body={"device":"MotorControl","cmd":"motion","mode":"abs","pos":[50,50],"speed":75}
| Field | Type | Description |
|---|---|---|
device |
string | Device name from SysType (name field). |
cmd |
string | Command name (see below). |
| Field | Type | Description |
|---|---|---|
mode |
string | Motion mode (see below). Default: abs. |
pos |
array | Position array for position modes. Use null to skip axes. |
vel |
array | Velocity array for velocity modes. Use null to skip axes. |
speed |
number/string | Speed spec (see Speed Control). |
motorCurrent |
number | Motor current as percentage (0 = use default). |
nosplit |
bool | Prevent block splitting. |
homing |
bool | Mark as homing move. |
more |
bool | Hint that more moves are coming. |
outOfBounds |
string | Per-move override: allow, clamp, discard. |
imm |
bool | Immediate execution (stop, clear queue, then execute). |
idx |
number | Motion tracking index. |
endstops |
array | Endstop checks per axis (see Endstops). |
| Mode | Description |
|---|---|
abs |
Absolute position in units. |
rel |
Relative position in units. |
pos-abs-steps |
Absolute position in steps (bypasses kinematics). |
pos-rel-steps |
Relative position in steps (bypasses kinematics). |
vel |
Velocity in units/sec. |
vel-steps |
Velocity in steps/sec. |
prop or prop-abs
|
Proportionate absolute (0..1 mapped to axis bounds). |
prop-rel |
Proportionate relative (fraction of axis range). |
Numeric values are percentages. String values support unit suffixes:
| Suffix | Meaning |
|---|---|
pc, percent
|
Percentage of max. |
ups, unitsps
|
Units per second. |
upm, unitspm
|
Units per minute. |
mmps |
Millimeters per second. |
mmpm |
Millimeters per minute. |
sps |
Steps per second. |
Notes:
- Empty string means 100 percent of configured max.
- All speeds are capped by configured max.
endstops is an array with one entry per axis. Each axis entry is a 2-element array [min, max] using these codes:
| Code | Meaning |
|---|---|
T |
Check when moving toward the endstop. |
X |
No check for this endstop. |
1 |
Always check (hit). |
0 |
Reserved (not hit). |
Example (check min on axis 0, max on axis 1):
{
"device": "MotorControl",
"cmd": "motion",
"mode": "rel",
"pos": [-10, 10, null],
"endstops": [
["T", "X"],
["X", "T"],
["X", "X"]
]
}Absolute move:
{
"device": "MotorControl",
"cmd": "motion",
"mode": "abs",
"pos": [100.0, 50.0, 25.0],
"speed": 75
}Relative move:
{
"device": "MotorControl",
"cmd": "motion",
"mode": "rel",
"pos": [10.0, -5.0, null],
"speed": "20ups"
}Velocity mode:
{
"device": "MotorControl",
"cmd": "motion",
"mode": "vel",
"vel": [50.0, 0, 0],
"speed": "100mmps"
}Step-based move:
{
"device": "MotorControl",
"cmd": "motion",
"mode": "pos-abs-steps",
"pos": [1000, 2000, 1500],
"speed": "500sps"
}Immediate execution:
{
"device": "MotorControl",
"cmd": "motion",
"mode": "abs",
"pos": [0, 0, 0],
"imm": true,
"speed": 100
}Stops motion and optionally disables motors.
| Field | Type | Description |
|---|---|---|
disableMotors |
bool | Disable motors after stopping. |
{
"device": "MotorControl",
"cmd": "stop",
"disableMotors": true
}Sets current position as origin.
{
"device": "MotorControl",
"cmd": "setOrigin"
}| Field | Type | Description |
|---|---|---|
axisIdx |
number | Zero-based axis index. |
maxCurrentA |
number | Max current in amps. |
{
"device": "MotorControl",
"cmd": "maxCurrent",
"axisIdx": 0,
"maxCurrentA": 1.5
}| Field | Type | Description |
|---|---|---|
offAfterS |
number | Seconds to keep motors enabled after motion. |
{
"device": "MotorControl",
"cmd": "offAfter",
"offAfterS": 5.0
}Start pattern:
{
"device": "MotorControl",
"cmd": "startPattern",
"pattern": "homing-seek-center",
"forMs": 30000
}Stop pattern:
{
"device": "MotorControl",
"cmd": "stopPattern"
}Home shortcut (uses configured homingPattern):
{
"device": "MotorControl",
"cmd": "home",
"forMs": 30000
}Motion commands return:
RAFT_OKRAFT_BUSYRAFT_INVALID_DATARAFT_INVALID_OPERATIONRAFT_CANNOT_STARTRAFT_NOT_IMPLEMENTED