Skip to content

MiP_Motion

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

Class MiP_Motion

Manages MiP's drive, turn, posture, and balance systems.

Table of Contents


Public Functions

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 MiP's UART interface (~20 Hz max). Fire-and-forget command (no read-back verification possible).

Parameters:

Parameter Description
velocity Speed/direction (-32 to +32; negative = backward, positive = forward).
turnRate Turn rate/direction (-32 to +32; negative = left, positive = right).

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 Direction to drive (MIP_DRIVE_FORWARD or MIP_DRIVE_BACKWARD).
cm Distance to travel in centimeters (0-255 cm).
turnDirection Turn direction after driving (MIP_TURN_LEFT or MIP_TURN_RIGHT).
degrees Turn angle in degrees (0-360 degrees).

driveForward

Signature: void driveForward(uint8_t speed, uint16_t time)

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

Details:

Fire-and-forget command. Duration parameter is internally converted to 7ms hardware ticks (max duration ~1.78 seconds / 1785 ms).

Parameters:

Parameter Description
speed Drive speed (0-30).
time Duration in milliseconds (max 1785 ms).

driveBackward

Signature: void driveBackward(uint8_t speed, uint16_t time)

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

Details:

Fire-and-forget command. Duration parameter is internally converted to 7ms hardware ticks (max duration ~1.78 seconds / 1785 ms).

Parameters:

Parameter Description
speed Drive speed (0-30).
time Duration in milliseconds (max 1785 ms).

turnLeft

Signature: void turnLeft(uint16_t degrees, uint8_t speed)

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

Details:

Fire-and-forget command. Angle parameter is internally converted to 5° hardware units (max angle 1275°).

Parameters:

Parameter Description
degrees Turn angle in degrees (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 command. Angle parameter is internally converted to 5° hardware units (max angle 1275°).

Parameters:

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

stop

Signature: void stop()

Summary: Stops all motor motion immediately.

Details:

Fire-and-forget command.


fallForward

Signature: void fallForward()

Summary: Commands MiP to fall forward onto face position.


fallBackward

Signature: void fallBackward()

Summary: Commands MiP to fall backward onto back position.


getUp

Signature: void getUp(MiPGetUp getup=MIP_GETUP_FROM_EITHER)

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

Parameters:

Parameter Description
getup Which direction/side to attempt getting up from (default = MIP_GETUP_FROM_EITHER).

Clone this wiki locally