3.6 KiB
| title | description |
|---|---|
| mbot Extension | Control a MakeBlock mbot2 rover through MQTT and MCP as a goose Extension |
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import YouTubeShortEmbed from '@site/src/components/YouTubeShortEmbed'; import GooseDesktopInstaller from '@site/src/components/GooseDesktopInstaller'; import CLIExtensionInstructions from '@site/src/components/CLIExtensionInstructions';
This tutorial will get you started with deemkeen's MQTT MCP server for the MakeBlock mbot2 rover, and outline some code changes we made along the way.
:::tip Quick Install Command
/path/to/java -jar /path/to/mbotmcp-0.0.1-SNAPSHOT.jar
Environment Variables
MQTT_SERVER_URI: tcp://1.2.3.4:1883
MQTT_PASSWORD: <string or blank>
MQTT_USERNAME: <string or blank>
:::
Configuration
Replace/path/to/java and /path/to/mbotmcp-0.0.1-SNAPSHOT.jar with your actual Java installation and JAR file paths.
}
infoNote={
<>
MQTT_SERVER_URI has a value like tcp://1.2.3.4:1883. MQTT_USERNAME and MQTT_PASSWORD are required to exist, but can be empty strings if your MQTT server does not require authentication.
}
/>
Example Usage
The available commands allow you to drive the mbot2 rover around, including:
- "turn left" or "turn right""
- drive "forward" or "backward"
- "explore" randomly
- "stop" exploring
- "beep"
The default distance to travel is 70cm (about 27 inches), and the turn angles are set to 90 degrees. You can change these values in the Python code on the mbot2. The mbot2 has a lot of other capabilities with the proximity sensors, lights, and color detection sensor on the bottom of the unit that you can add to the Python code, and will need to update the Java code to include those commands via MCP.
goose Interaction
( O)> Let my mbot2 explore the area
Okay, let's get the mbot2 rover moving. I will send it on a mission to explore the area.
> Mbotexplore
( O)> stop the rover, turn left and move forward
Alright, I will stop the rover, turn to the left, and then move it forward.
> Mbotstop
> Mbotleft
> Mbotforward
( O)> let's move backward and beep so I know when it's finished
Sure, I will move the rover backward and beep when it's done.
> Mbotbackward
> Mbotbeep
Okay, the mbot2 has moved and beeped. What else would you like to do with the rover?