mbot Extension
π₯Plug & Play
Watch the demo
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.
TLDR
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β
- goose CLI
- Run the
configurecommand:
goose configure
- Choose to add a
Command-line Extension.
β goose-configure
β
β What would you like to configure?
β Add Extension
β
β What type of extension would you like to add?
β β Built-in Extension
β β Command-line Extension (Run a local command or script)
β β Remote Extension (SSE)
β β Remote Extension (Streaming HTTP)
β
- Give your extension a name.
β goose-configure
β
β What would you like to configure?
β Add Extension
β
β What type of extension would you like to add?
β Command-line Extension
β
β What would you like to call this extension?
β mbot2
β
- Enter the command to run when this extension is used.
info
Replace
/path/to/java and /path/to/mbotmcp-0.0.1-SNAPSHOT.jar with your actual Java installation and JAR file paths.β goose-configure
β
β What would you like to configure?
β Add Extension
β
β What type of extension would you like to add?
β Command-line Extension
β
β What would you like to call this extension?
β mbot2
β
β What command should be run?
β /path/to/java -jar /path/to/mbotmcp-0.0.1-SNAPSHOT.jar
β
- Enter the number of seconds Goose should wait for actions to complete before timing out. Default is
300seconds.
β goose-configure
β
β What would you like to configure?
β Add Extension
β
β What type of extension would you like to add?
β Command-line Extension
β
β What would you like to call this extension?
β mbot2
β
β What command should be run?
β /path/to/java -jar /path/to/mbotmcp-0.0.1-SNAPSHOT.jar
β
β Please set the timeout for this tool (in secs):
β 300
β
- Enter a description for this extension.
β goose-configure
β
β What would you like to configure?
β Add Extension
β
β What type of extension would you like to add?
β Command-line Extension
β
β What would you like to call this extension?
β mbot2
β
β What command should be run?
β /path/to/java -jar /path/to/mbotmcp-0.0.1-SNAPSHOT.jar
β
β Please set the timeout for this tool (in secs):
β 300
β
β Enter a description for this extension:
β Control a MakeBlock mbot2 rover through MQTT and MCP
β
- Add environment variables for this extension.
info
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.β goose-configure
β
β What would you like to configure?
β Add Extension
β
β What type of extension would you like to add?
β Command-line Extension
β
β What would you like to call this extension?
β mbot2
β
β What command should be run?
β /path/to/java -jar /path/to/mbotmcp-0.0.1-SNAPSHOT.jar
β
β Please set the timeout for this tool (in secs):
β 300
β
β Enter a description for this extension:
β Control a MakeBlock mbot2 rover through MQTT and MCP
β
β Would you like to add environment variables?
β Yes
β
β Environment variable name:
β MQTT_SERVER_URI
β
β Environment variable value:
β βͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺ
β
β Add another environment variable?
β Yes
β
β Environment variable name:
β MQTT_USERNAME
β
β Environment variable value:
β βͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺ
β
β Add another environment variable?
β Yes
β
β Environment variable name:
β MQTT_PASSWORD
β
β Environment variable value:
β βͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺβͺ
β
β Add another environment variable?
β No
β
β Added mbot2 extension
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?