Skip to content

MiP_Motion

github-actions[bot] edited this page Aug 10, 2026 · 9 revisions

Class MiP_Motion

Manages MiP's drive system.

Public Elements

MIP_CMD_CONTINUOUS_DRIVE

Signature: constexpr uint8_t MIP_CMD_CONTINUOUS_DRIVE

Summary: MiP protocol command bytes used by the motion subsystem.

Details:

These values are placed in the first byte of requests sent to the MiP (and appear in the corresponding responses). See the official MiP BLE Protocol for the complete list.


MIP_CMD_DISTANCE_DRIVE

Signature: constexpr uint8_t MIP_CMD_DISTANCE_DRIVE


MIP_CMD_TURN_LEFT

Signature: constexpr uint8_t MIP_CMD_TURN_LEFT


MIP_CMD_TURN_RIGHT

Signature: constexpr uint8_t MIP_CMD_TURN_RIGHT


MIP_CMD_DRIVE_FORWARD

Signature: constexpr uint8_t MIP_CMD_DRIVE_FORWARD


MIP_CMD_DRIVE_BACKWARD

Signature: constexpr uint8_t MIP_CMD_DRIVE_BACKWARD


MIP_CMD_STOP

Signature: constexpr uint8_t MIP_CMD_STOP


MIP_CMD_SET_POSITION

Signature: constexpr uint8_t MIP_CMD_SET_POSITION


MIP_CMD_GET_UP

Signature: constexpr uint8_t MIP_CMD_GET_UP


MIP_CONTINUOUS_DRIVE_DELAY

Signature: constexpr uint8_t MIP_CONTINUOUS_DRIVE_DELAY


MiP_Motion

Signature: MiP_Motion(MiP &mip)

Summary: Constructs the drive system manager.

Parameters:

Parameter Description
mip A reference to the main MiP object to access core services.

continuousDrive

Signature: void continuousDrive(int8_t velocity, int8_t turnRate)

Summary: Sends continuous drive command (velocity + turn rate).

Details:

Rate-limited internally to avoid overwhelming the MiP (~20 Hz max). Fire-and-forget (no verification possible).

Parameters:

Parameter Description
velocity -32 to +32 (negative = backward).
turnRate -32 to +32 (negative = left).

distanceDrive

Signature: void distanceDrive(MiPDriveDirection driveDirection, uint8_t cm, MiPTurnDirection turnDirection, uint16_t degrees)

Summary: Drives a specific distance then optionally turns.

Details:

Fire-and-forget command.

Parameters:

Parameter Description
driveDirection Forward or backward.
cm Distance in centimeters.
turnDirection Turn direction after driving.
degrees Turn angle in degrees (0-360).

driveForward

Signature: void driveForward(uint8_t speed, uint16_t time)

Summary: Drives forward for a limited time at given speed.

Details:

Fire-and-forget. Time is internally converted to 7ms units.

Parameters:

Parameter Description
speed Drive speed (0-30).
time Duration in milliseconds (max ~1.78 seconds).

driveBackward

Signature: void driveBackward(uint8_t speed, uint16_t time)

Summary: Drives backward for a limited time at given speed.

Details:

Fire-and-forget. Time is internally converted to 7ms units.

Parameters:

Parameter Description
speed Drive speed (0-30).
time Duration in milliseconds (max ~1.78 seconds).

turnLeft

Signature: void turnLeft(uint16_t degrees, uint8_t speed)

Summary: Turns left by the specified angle at given speed.

Details:

Fire-and-forget. Angle is internally converted to 5° units.

Parameters:

Parameter Description
degrees Turn angle (max 1275°).
speed Turn speed (0-24).

turnRight

Signature: void turnRight(uint16_t degrees, uint8_t speed)

Summary: Turns right by the specified angle at given speed.

Details:

Fire-and-forget. Angle is internally converted to 5° units.

Parameters:

Parameter Description
degrees Turn angle (max 1275°).
speed Turn speed (0-24).

stop

Signature: void stop()

Summary: Stops all motion.

Details:

Fire-and-forget.


fallForward

Signature: void fallForward()

Summary: Commands MiP to fall forward (face down).


fallBackward

Signature: void fallBackward()

Summary: Commands MiP to fall backward (on its back).


getUp

Signature: void getUp(MiPGetUp getup=MIP_GETUP_FROM_EITHER)

Summary: Commands MiP to get up from a fallen position.

Parameters:

Parameter Description
getup Which way to attempt getting up (default = either side).

Clone this wiki locally