Skip to main content

How to Get Your Bot's Status and Location through SDK

Now that your SDK is running and your bot is connected, you can retrieve live data from your bot at any time β€” including battery level, GPS location, speed, and more.

What You'll Need


Moving Your Bot β€” POST /control

In your second terminal window, run this command to move your bot:

Mac/Linux:

curl --location 'http://localhost:8000/control' \ --header 'Content-Type: application/json' \ --data '{"command": {"linear": 1, "angular": 0, "lamp": 0}}'

Windows (PowerShell / VS Code terminal):

curl --location "http://localhost:8000/control" --header "Content-Type: application/json" --data '{"command": {"linear": 1, "angular": 0, "lamp": 0}}'

If it works, you'll see:

{ "message": "Command sent successfully" }

Understanding the parameters:

Parameter

What it does

Range

linear

Move forward (positive) or backward (negative)

-1.0 to 1.0

angular

Turn right (positive) or left (negative)

-1.0 to 1.0

lamp

Headlight on or off

0 (off) or 1 (on)

πŸ’‘ Use small values like 0.3–0.5 for gentle movement. Full 1.0 is maximum speed β€” only use it on a clear, open path!

⚠️ The bot will keep moving until you send a stop command. Always send {"linear": 0, "angular": 0} when you want it to stop!

Retrieving Bot Data β€” GET /data

In your second terminal window, run this command:

Mac/Linux:

curl --location 'http://localhost:8000/data'

Windows (PowerShell / VS Code terminal):

curl --location "http://localhost:8000/data"


Understanding the Response

You'll get back something like this:

{
"battery": 100,
"signal_level": 5,
"orientation": 128,
"lamp": 0,
"speed": 0,
"gps_signal": 31.25,
"latitude": 22.753774642944336,
"longitude": 114.09095001220703,
"vibration": 0.31,
"timestamp": 1724189733.208559,
"accels": [...],
"gyros": [...],
"mags": [...],
"rpms": [...]
}

Here's what each field means in plain English:

Field

What it means

battery

Battery percentage β€” 100 means fully charged, 0 means empty

signal_level

Network signal strength β€” higher is better (max 5)

orientation

Which direction the bot is facing in degrees (0–360)

lamp

Whether the headlight is on (1) or off (0)

speed

How fast the bot is currently moving

gps_signal

Strength of the GPS signal β€” higher means more accurate location

latitude

North/South position of the bot on the map

longitude

East/West position of the bot on the map

vibration

How much the bot is vibrating

timestamp

The exact time this data was recorded

accels

Accelerometer readings β€” measures movement and vibration

gyros

Gyroscope readings β€” measures rotation

mags

Magnetometer readings β€” measures magnetic field (used for compass direction)

rpms

Wheel motor speeds β€” shows how fast each wheel is spinning


Practical Tips

⚠️ If battery is below 20%, drive your bot back to its charging spot as soon as possible. The bot will shut down automatically when it runs out of power.

⚠️ If gps_signal is 0 or very low, your bot is likely indoors. GPS does not work indoors β€” take it outside for accurate location readings.

πŸ’‘ You can run /data as many times as you want while the SDK is running β€” it always returns the latest information from your bot.

πŸ’‘ The latitude and longitude values can be copied and pasted into Google Maps to see exactly where your bot is located on the map!

Did this answer your question?