Skip to content

ROBOT_POSE

theficus edited this page Dec 24, 2021 · 16 revisions

ROBOT_POSE is the most commonly used message type. It is used both for sending commands to Mousr and receiving accelerometer information.

Sending commands to Mousr

When sending messages, the message contains 15 bytes.

There are three types of TX ROBOT_POSE message that I've observed:

  • Type 1 has no parameters. These are the simplest commands as most of the bytes are 0's.
  • Type 2 has ad hoc values for bytes 2-13.
  • Type 3 is used for controlling movement. Bytes 2-13 represent 3 different floating point values.

Type 1 structure

Byte(s) Data Type Value Note
1 Byte Always 0x30
2-13 N/A Zero fill
14 Byte Command
15 Byte New command*

Example: POWER_OFF

0x300000000000000000000000000900

Type 2 structure

Byte(s) Data Type Value Note
1 Byte Always 0x30
2-13 ?? Arbitrary value
14 Byte Command
15 Byte New command*

Example: SOUND_VOLUME (100%)

0x306400000000000000000000001300

Type 3 structure (Movement)

Byte(s) Data Type Value Note
1 Byte Always 0x30
2-5 Float Speed (0.0-100) Acceleration
6-9 Float Held Is button held?
9-13 Float Angle (-180.0 - 180.0) Degrees from center (yaw)
14 Byte Command
15 Byte New command*

Example: MOVE (move 90° from center at 23% acceleration)

0x30bdcd6c3e00000000a40eba420200

ROBOT_POSE Commands (TX)

The following commands can be sent to Mousr:

Command Type Value Hex Value Dec Type Description Notes
STOP 0x00 0 Type 1
SPIN 0x01 1 Type 3 Spins Mousr in place. Only bytes 9-13 ("Angle") are used.
MOVE 0x02 2 Type 3 Start movement using specified speed, tilt, and angle Movement will continue until STOP command is sent, Mousr hits something, or a speed value of 0 is specified.
RESET_HEADING 0x03 3 Type 1 Resets North to wherever Mousr's head is pointing "Angle" degrees are based on ths value.
GET_DEBUG_LOG 0x04 4 Type 1 Send debug log Receives CRASH_LOG_STRING message(s) followed by a CRASH_LOG_FINISH when debug log is finished sending.
SPIN_PLAN 0x05 5 ?? ??
ENTER_DFU_MODE 0x08 8 Type 1 Enters DFU mode to update device firmware
TURN_OFF 0x09 9 Type 1 Powers off Mousr Mousr will disconnect from BLE
SLEEP 0x0a 10 Type 1 Mousr goes into standby mode Mousr will remain connected to BLE
CONFIG_AUTO_MODE 0x0f 15 Type 2 Configures auto-play mode Bytes specify various mode attributes.
CHIRP 0x12 18 Type 2 Mousr makes sound 3rd byte contains the sound effect value. The standard "whistle" from the app is 6. There are 28 different Mousr chirps.
SOUND_VOLUME 0x13 19 Type 2 Sets volume level First byte is level in percent (0-100 / 0x00-0x64).
Flick_SIGNAL 0x17 23 ??
Reverse_SIGNAL 0x18 24 ??
Tail_Calib_SIGNAL 0x19 25 Type 1 Perform tail calibration Tail will move up and down while this happens.
Set_Tail_SIGNAL 0x1a 26 Type 2 Sets tail mode
INITIALIZE_DEVICE 0x1c 28 ??
FLIP_ROBOT 0x1f 32 Type 1 Flips robot NOOP unless Mousr is upside down
CFG_DRIVER_ASSIST 0x29 41 Type 2 Configures driver assist options
TUTORIAL_STEP 0x2d 45 Type 2 Executes a pre-programmed tutorial step
CMD_SET_TIME 0x2e 46 ??
INVALID 0x64 100 ??

Receiving status from Mousr

Mousr sends a constant stream of ROBOT_POSE messages to the UART TX characteristic. These messages contain information from Mousr's accelerometer. Unlike the 15 byte RX messages, these TX messages are (always?) 20 bytes long.

These appear to be sent at a rate of ~5 per second.

ROBOT_POSE TX structure

Byte(s) Data Type Value Note
1 Byte Always 0x30
2-5 Float Speed (0.0-100) Acceleration (unused by Mousr app)
6-9 Float Held (-180.0 - 180.0) Tilt (unused by Mousr app)
9-13 Float Angle (-180.0 - 180.0) Degrees from center (yaw)
14 Boolean 1 = flipped
15-20 ?? (unused by Mousr app)

Example: (1.15° from center, -0.2° tilt, -0.5% acceleration)

0x307b3c0b3fce824a3ebd45933f00030000000000