[Unitree G1] How to detect motion command completion with G1 LocoClient APIs?

Hi everyone,

I’m working on an alignment application for the G1 using unitree_sdk2py and have a question about sequential motion control.

Background:
My app needs to execute multi-stage alignment motions:

  1. Move sideways to center on table
  2. Rotate to face table straight-on
  3. Move forward to target distance
  4. Stop and verify alignment

The Problem:
I’m relying on time.sleep(duration) to wait for each motion to complete, but this feels fragile. What if the robot takes longer to stabilize? What if I want to interrupt early based on sensor feedback?

My Questions:

  1. Is there an API to check if the previous API e.g SetVelocity() command has finished executing?
  2. Can I poll robot state (velocity, acceleration, etc.) to detect when motion has actually stopped?
  3. What’s the best practice for sequential motion commands - is time-based waiting the intended approach?

Any insights from Unitree engineers would be really helpful!
Thanks in advance!
Arshad

Hi,

  1. Everything is provided directly in the SDK. If I recalll correctly, you do not get feedback if the velocity has actually stopped but the it should be realtime as it executes.
  2. You can poll the /lowstate to check.
  3. Use active detection via the realsense camera or the livox mid360 for movement control instead of hard coding the movements.