Velocity Control
set_velocity_source()
set_velocity_source(source: int) -> bool
Sets the velocity command source. Before calling set_velocity(), set the source to 2 (Navigation) and confirm by reading back, otherwise velocity commands are ignored by AuroraCore (the client gets no error; the robot log records Ignore velocity command because current velocity source is not 'Navigation').
| Value | Source | Description |
|---|---|---|
| 0 | Joystick | Joystick control |
| 1 | Handheld | Handheld device (APP) |
| 2 | Navigation | Navigation velocity source; used by AuroraClient velocity publishing |
Returns: True means the service accepted the request. Still confirm with get_velocity_source() before sending non-zero velocity.
Example
import os
import time
os.environ.setdefault("FASTDDS_BUILTIN_TRANSPORTS", "UDPv4") # required on the robot
from fourier_aurora_client import AuroraClient
client = AuroraClient.get_instance(domain_id=123, robot_name="grw")
try:
time.sleep(1.0)
if not client.set_velocity_source(2):
raise RuntimeError("velocity source request not accepted")
deadline = time.monotonic() + 2.0
while client.get_velocity_source() != 2:
if time.monotonic() >= deadline:
raise RuntimeError("velocity source did not switch to Navigation (2)")
time.sleep(0.05)
print(f"current source: {client.get_velocity_source()} ({client.get_velocity_source_name()})")
finally:
client.set_velocity_source(0) # hand control back to the joystick
client.close()
get_velocity_source()
get_velocity_source() -> int
Returns the current velocity command source value.
get_velocity_source_name()
get_velocity_source_name() -> str
Returns the current velocity command source name string, e.g. "Navigation".
set_velocity()
set_velocity(vx: float, vy: float, yaw: float, duration: float = 1.0)
Publishes a velocity command to the GR-W wheeled base. The command is published once and stays valid on the server for duration seconds, then expires automatically (e.g. a command with duration=0.5 decelerates within about 0.3 s after expiry). The GR-W velocity-control workflow uses state 3 (grw_policy_task); re-confirm state and velocity source after entering other states.
| Parameter | Type | Description |
|---|---|---|
vx | float | Linear velocity in X direction (forward positive, m/s) |
vy | float | Linear velocity in Y direction (left positive, m/s) |
yaw | float | Angular velocity around Z axis (left-turn positive, rad/s) |
duration | float | Command validity duration (s), default 1.0 |
Example
import os
import time
os.environ.setdefault("FASTDDS_BUILTIN_TRANSPORTS", "UDPv4") # required on the robot
from fourier_aurora_client import AuroraClient
client = AuroraClient.get_instance(domain_id=123, robot_name="grw")
try:
time.sleep(1.0)
if not client.set_fsm_state(3):
raise RuntimeError("state change request not accepted")
deadline = time.monotonic() + 4.0
while client.get_fsm_state() != 3:
if time.monotonic() >= deadline:
raise RuntimeError("state did not switch to grw_policy_task")
time.sleep(0.05)
if not client.set_velocity_source(2):
raise RuntimeError("velocity source request not accepted")
deadline = time.monotonic() + 2.0
while client.get_velocity_source() != 2:
if time.monotonic() >= deadline:
raise RuntimeError("velocity source did not switch to Navigation (2)")
time.sleep(0.05)
client.set_velocity(0.1, 0.0, 0.0, 1.0) # move forward ~10 cm at low speed
time.sleep(1.0)
client.set_velocity(0.0, 0.0, 0.0, 1.0) # stop
finally:
client.set_velocity(0.0, 0.0, 0.0, 1.0) # safety-net zero velocity
client.set_velocity_source(0) # hand control back to the joystick
client.close()