Skip to main content

Velocity Control

set_velocity_source()

Python
set_velocity_source(source: int) -> bool

Sets the velocity command source. Must be set to 2 (Navigation) before calling set_velocity(), otherwise velocity commands are silently ignored.

ValueSourceDescription
0JoystickJoystick control
1HandheldHandheld device (APP)
2NavigationClient control

Returns: True on success, False on timeout.

Example

Python
client.set_velocity_source(2) # switch to client control

get_velocity_source()

Python
get_velocity_source() -> int

Returns the current velocity command source value.


get_velocity_source_name()

Python
get_velocity_source_name() -> str

Returns the current velocity command source name string, e.g. "Navigation".


set_velocity()

Python
set_velocity(vx: float, vy: float, yaw: float, duration: float = 1.0)

Publishes a velocity command to the robot. The command is valid for duration seconds; the robot decelerates to a stop after it expires.

ParameterTypeDescription
vxfloatLinear velocity in X direction (forward positive, m/s)
vyfloatLinear velocity in Y direction (left positive, m/s)
yawfloatAngular velocity around Z axis (left-turn positive, rad/s)
durationfloatCommand validity duration (s), default 1.0

Example

Python
client.set_velocity_source(2)
client.set_fsm_state(3) # switch to RL Locomotion
time.sleep(1.0)

client.set_velocity(0.5, 0.0, 0.0, 3.0) # move forward at 0.5 m/s for 3 s
time.sleep(3.0)

client.set_velocity(0.0, 0.0, 0.0, 1.0) # stop