Products

GDK v2.6.3 โ€” Python API Reference

Version: v1.0Release Date: 2026-07-04Genie G2

The Genie Development Kit (GDK) is the official Python SDK for programming the Agibot G02 humanoid robot. It exposes a set of modules for sensor access, robot control, navigation, mapping, and human-robot interaction โ€” all under a single Python package: agibot_gdk.


Important Notes
  • Initialization order: Always call gdk_init() first, then instantiate module objects.
  • Release order: Close individual module objects (close_camera(), close_lidar(), etc.) before calling gdk_release().
  • DDS warmup: Add time.sleep(1โ€“2) after creating any module object to allow DDS subscriptions to connect.
  • Error handling: All methods raise RuntimeError (or std::runtime_error from the C++ backend) on failure. Wrap calls in try/except.
  • Timestamps: All timestamps are in nanoseconds. Time synchronization with the robot is required before using latency statistics APIs.
  • Unimplemented methods: get_imu_fps(), get_imu_latency(), get_lidar_fps(), get_lidar_latency(), high_precision_navi(), and record_spec_loc() are documented but not yet active in v2.6.3.
  • Navigation prerequisite: normal_navi(), high_precision_navi(), and relative_move() require the robot to be relocalized using the G02 Pad application first.
  • Map switching: Do not call switch_map() while a navigation task is running.
  • Chassis modes: move_chassis() supports Ackermann steering (linear.x) and crab walking (linear.y). Request the appropriate mode via request_chassis_control() before sending velocity commands.

Robot Hardware Overview

The G02 is a mobile humanoid robot with the following physical structure:

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚          HEAD           โ”‚
                    โ”‚  Stereo cameras (L/R)   โ”‚
                    โ”‚  Fisheye cameras (L/R/Back)โ”‚
                    โ”‚  Color camera + Depth   โ”‚
                    โ”‚  Neck joints            โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                 โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚                  โ”‚                  โ”‚
        LEFT ARM           WAIST / LIFT        RIGHT ARM
        (joints)           (pitch + lift)       (joints)
              โ”‚                  โ”‚                  โ”‚
        LEFT END                 โ”‚             RIGHT END
        EFFECTOR                 โ”‚             EFFECTOR
        (gripper/tool)           โ”‚             (gripper/tool)
        Left hand camera         โ”‚             Right hand camera
                                 โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚         CHASSIS         โ”‚
                    โ”‚  Front LiDAR + Back LiDARโ”‚
                    โ”‚  Front IMU + Back IMU   โ”‚
                    โ”‚  Chassis IMU            โ”‚
                    โ”‚  Ultrasonic radars      โ”‚
                    โ”‚  Mobile base            โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Key body segments and their GDK identifiers:

SegmentDescription
right_arm / left_arm6-DOF arms with error, control, and estop state
right_end / left_endEnd effectors (grippers/tools); model is readable
waistWaist pitch joint
liftVertical lift mechanism
neck / headHead with 3-axis motion
chassisMobile base (Ackermann or crab-walk drive modes)

GDK Architecture

All GDK functionality is accessed through the agibot_gdk Python package. The SDK uses DDS (Data Distribution Service) as its internal communication layer. Every module creates its own DDS subscriber/publisher, so a short time.sleep() after instantiation is required to let the connection establish.

Package layout:

ModuleClass / FunctionRole
commongdk_init(), gdk_release()System lifecycle
typesEnums, data structuresShared data types
robotRobotJoint & body state + control
tfTFCoordinate frame transforms
imuImuInertial measurement data
cameraCameraImage data from all cameras
lidarLidarPoint cloud data
ultrasonicradarUltrasonicRadarProximity sensing
slamSlamMapping and localization
mapMapMap management
pncPncPath planning and navigation
interactionInteractionVoice, display, media playback

Lifecycle: Init & Release

Every GDK program must call gdk_init() before using any module and gdk_release() before exiting.

import agibot_gdk

result = agibot_gdk.gdk_init()
if result != agibot_gdk.GDKRes.kSuccess:
    exit(1)

# ... use GDK modules ...

agibot_gdk.gdk_release()

Module Reference


Common

Core system lifecycle functions.

FunctionParametersReturnsDescription
gdk_init()โ€”GDKResInitialize the GDK system. Must be called first.
gdk_release()โ€”GDKResRelease all GDK resources. Must be called on exit.

Types

Shared enumerations and data structures used across all modules.

Enumerations

GDKRes โ€” Return status code for all GDK operations.

ValueMeaning
kSuccessOperation succeeded
kInvalidInputInvalid input parameter
kInvalidOutputInvalid output parameter
kRuntimeErrorRuntime error
kUnknownUnknown error

CameraType โ€” Identifies which physical camera to access.

ValueCamera
kHeadStereoLeft / kHeadStereoRightHead stereo pair
kHeadColorHead color camera
kHeadDepthHead depth (RGBD) camera
kHeadLeftFisheye / kHeadRightFisheye / kHeadBackFisheyeHead fisheye cameras
kHandLeftColor / kHandRightColorWrist-mounted color cameras
kHandLeftDepth / kHandRightDepthWrist-mounted depth cameras

In normal mode only head stereo, hand color, head color, and head depth cameras are active by default. Additional cameras require developer mode.

LidarType โ€” Front or back LiDAR.

ValueSensor
kLidarFrontFront-facing LiDAR
kLidarBackRear-facing LiDAR

ImuType โ€” Which IMU unit to read.

ValueSensor
kImuFrontFront IMU
kImuBackRear IMU
kImuChassisChassis IMU

EndEffectorControlGroup โ€” Which arm(s) to include in a motion command.

ValueGroup
kLeftArm / kRightArm / kBothArmsArms only
kBothArmsWaistLiftArms + waist + lift
kBothArmsWaistPitchArms + waist pitch
kBothArmsWaistArms + waist
(and symmetric left/right variants)

SensorExtrinsicType โ€” Pre-defined sensor-to-sensor or sensor-to-base_link transform pairs (used with TF.get_tf_from_sensor()).

Examples: kHeadLeftStereoToHeadRightStereo, kChassisFrontLidarToBaseLink, kHeadRGBDToHeadLink3, etc.

Data Structures

TypeFieldsUnits
Vector3x, y, z (float)meters (or rad/s for angular)
Quaternionx, y, z, w (float)dimensionless
Poseposition: Vector3, orientation: Quaternionm + dimensionless
Twistlinear: Vector3, angular: Vector3m/s + rad/s
Wrenchforce: Vector3, torque: Vector3N + Nยทm
Imagetimestamp_ns, width, height, encoding, color_format, bit_depth, data: bytesโ€”
PointCloudtimestamp_ns, width, height, point_step, row_step, is_dense, fields, data: bytesโ€”
ImuDatatimestamp_ns, angular_velocity: Vector3, linear_acceleration: Vector3rad/s + m/sยฒ
LatencyStatsmax_latency_ms, avg_latency_ms, p99_latency_ms, p999_latency_ms, p9999_latency_msms

Robot

agibot_gdk.Robot() โ€” Controls joints and reads body state for the G02.

Wait ~2 seconds after instantiation before calling any method.

State Reading

MethodReturnsDescription
get_joint_states()dictAll joint positions, velocities, torques, motor currents, and error codes
get_whole_body_status()dictPer-segment error codes, control flags, estop state, and end-effector model names
get_motion_control_status()MotionControlStatusEnd-effector frame poses, velocities, wrenches, collision pairs, current mode
get_end_state()dictEnd-effector state
get_chassis_power_state()โ€”Chassis power information
get_chest_power_state()โ€”Chest (upper body) power information

get_joint_states() return structure:

{
  "timestamp": int,        # nanoseconds
  "nums": int,             # number of joints
  "states": [
    {
      "name": str,
      "mode": int,         # 0=stop, 1=G1_servo, 2=path_plan, 5=G2_servo
      "motor_position": float,   # radians (use this, not "position")
      "motor_velocity": float,   # rad/s
      "motor_current": float,    # amperes
      "effort": float,           # Nยทm
      "error_code": int
    }, ...
  ]
}

Joint Control โ€” Path Planning Mode

MethodDescription
joint_control_request()Switch joint control mode
move_head_joint(...)Move head joints via path planning
move_waist_joint(...)Move waist joint via path planning
move_arm_joint(...)Move arm joints via path planning

Joint Control โ€” Servo Mode

MethodDescription
joint_servo_control(...)Generic servo control
move_head_joint_servo(...)Direct servo command to head
move_waist_joint_servo(...)Direct servo command to waist
move_arm_joint_servo(...)Direct servo command to arm(s)

End-Effector Control

MethodDescription
move_ee_pos(...)Move end-effector position (G2 servo mode)
end_effector_pose_control(...)Full 6-DOF end-effector pose command

TF (Coordinate Transforms)

agibot_gdk.TF() โ€” Query real-time coordinate transforms between robot frames.

The root frame is base_link (center of the chassis). All transforms use (translation: Vector3, rotation: Quaternion) representation.

MethodParametersReturnsDescription
get_all_tf_from_base_link()โ€”list[TransformStamped]All known transforms from base_link
get_tf_from_base_link(child_frame_id)strTransformTransform from base_link to a named frame
get_tf_from_sensor(sensor_extrinsic_type)SensorExtrinsicTypeTransformPre-defined sensor-to-sensor extrinsic
lookup_transform_latest(target, source, return_timestamp=False)str, str(Transform, int or None)Latest transform between any two frames
lookup_transform(target, source, time_ns)str, str, intTransformTime-interpolated transform at a specific timestamp
can_transform(target, source)str, strboolCheck if a transform path exists
get_all_frame_names()โ€”list[str]All available coordinate frame names

IMU

agibot_gdk.Imu() โ€” Reads angular velocity and linear acceleration from any of the robotโ€™s IMU units.

MethodParametersReturnsDescription
get_latest_imu(type, timeout)ImuType, float (ms)ImuDataMost recent IMU sample
get_nearest_imu(type, timestamp, timeout)ImuType, int (ns), float (ms)ImuDataClosest sample to a given timestamp
get_imu_fps(type)ImuTypeintData rate in Hz (not yet implemented)
get_imu_latency(type, window_seconds)ImuType, floatLatencyStatsLatency statistics (requires time sync; not yet implemented)
close_imu()โ€”GDKResRelease IMU resources

Camera

agibot_gdk.Camera() โ€” Retrieves images from any of the robotโ€™s cameras.

MethodParametersReturnsDescription
get_latest_image(type, timeout)CameraType, float (ms)ImageMost recent frame
get_nearest_image(type, timestamp, timeout)CameraType, int (ns), float (ms)ImageFrame closest to a given timestamp
get_image_shape(type)CameraTypetuple(int, int)(width, height) without transferring pixel data
get_image_fps(type)CameraTypefloatCamera frame rate
get_image_latency(type, window_seconds)CameraType, floatLatencyStatsLatency statistics (requires time sync)
close_camera()โ€”โ€”Release camera resources

Image encoding values: "rgb8", "bgr8", "mono8", "mono16", "32FC1" (depth float).


Lidar

agibot_gdk.Lidar() โ€” Streams point clouds from the front or rear LiDAR.

MethodParametersReturnsDescription
get_latest_pointcloud(type, timeout)LidarType, float (ms)PointCloudMost recent scan
get_nearest_pointcloud(type, timestamp, timeout)LidarType, int (ns), float (ms)PointCloudScan closest to a given timestamp
get_lidar_fps(type)LidarTypefloatScan rate (not yet implemented)
get_lidar_latency(type, window_seconds)LidarType, floatLatencyStatsLatency statistics (requires time sync; not yet implemented)
close_lidar()โ€”GDKResRelease LiDAR resources

Point cloud fields typically contain x, y, z, and intensity. Raw bytes in data must be parsed using the fields descriptor.


UltrasonicRadar

agibot_gdk.UltrasonicRadar() โ€” Reads distance measurements from the array of ultrasonic sensors on the chassis.

MethodParametersReturnsDescription
get_latest_ultrasonic_radar()โ€”dictLatest readings from all sensors
get_nearest_ultrasonic_radar(timestamp_ns)int (ns)dictReadings closest to a given timestamp
get_ultrasonic_radar_fps()โ€”floatUpdate rate in Hz
get_ultrasonic_radar_latency(window_seconds)floatLatencyStatsLatency statistics
close_ultrasonic_radar()โ€”GDKResRelease resources

Return dict structure:

{
  "timestamp_ns": int,
  "ultrasonic_radar_datas": [
    {"id": int, "distance_mm": int, "fault_state": int},
    ...
  ]
}

fault_state == 0 means the sensor is healthy. Distance is in millimeters.

Note: get_nearest_ultrasonic_radar() does not include an id field in each sensor dict.


SLAM

agibot_gdk.Slam() โ€” Controls simultaneous localization and mapping.

MethodParametersReturnsDescription
get_slam_state()โ€”int1=mapping, 2=stopped, 0=cancelled
start_mapping()โ€”โ€”Begin building a new map
stop_mapping()โ€”โ€”Finish and save the current map
cancel_mapping()โ€”โ€”Discard the current mapping session
get_odom_info()โ€”OdomInfoRich odometry: pose, velocity, acceleration, localization confidence and state, slip detection
get_curr_pose()โ€”PoseCurrent position and orientation in the map frame
record_spec_loc()โ€”โ€”Save current position as charging dock location (not yet released)

OdomInfo key fields: pose, twist, velocity, velocity_body, acceleration, ang_vel, orientation_euler, is_stationary, is_sliping, loc_confidence, loc_state.


Map

agibot_gdk.Map() โ€” Manages the set of stored maps on the robot.

MethodParametersReturnsDescription
get_curr_map()โ€”MapNameCurrently active map (id, name, is_curr_map)
get_all_map()โ€”list[MapName]All stored maps
switch_map(map_id)intโ€”Activate a different map (do not call during active navigation)
remove_map(map_id)intโ€”Permanently delete a stored map

Map IDs are uint8 (0โ€“255). Deletion is irreversible.


PNC (Planning & Control)

agibot_gdk.Pnc() โ€” Sends navigation goals and manages task execution. Requires prior relocation on the G02 Pad before calling navigation methods.

Task State

MethodReturnsDescription
get_task_state()PNCTaskStateCurrent task state, message, id, and type

Task states: 0=idle, 1=starting, 2=running, 3=pausing, 4=paused, 5=resuming, 6=cancelling, 7=cancelled, 8=failed, 9=success. Task types: 0=idle, 1=normal navigation, 2=remote control.

MethodParametersDescription
normal_navi(target)NaviReq (map frame)Navigate to a pose with obstacle avoidance
high_precision_navi(target)NaviReq (map frame)High-precision navigation (not yet released)
relative_move(target)NaviReq (base_link frame)Small-range displacement, stop-on-obstacle, no detour

Task Control

MethodParametersDescription
cancel_task(task_id)intCancel an in-progress navigation task
pause_task(task_id)intPause a running task
resume_task(task_id)intResume a paused task

Remote / Direct Chassis Control

MethodParametersDescription
request_chassis_control(control_mode)int (0=Ackermann, 1=crab)Acquire chassis control in remote mode
move_chassis(twist)TwistSend velocity commands directly to the chassis

Interaction

agibot_gdk.Interaction() โ€” Controls voice, audio, video, and display output. Requires cross-network-segment access; run with --privileged if inside a Docker container.

Voice / Audio

MethodParametersDescription
set_language(language)Language.kLanguageChinese or kLanguageEnglishSet TTS/ASR language
set_volume(volume)int (0โ€“100)Set speaker volume
set_wakeup_switch(is_on)boolEnable/disable wake word detection
set_audio_switch(is_on)boolEnable/disable audio subsystem
set_call_mode(is_on)boolEnter/exit call mode (continuous listening, no wake word needed)
play_tts(text)strConvert text to speech and play it
play_audio(audio_path)strPlay an audio file from disk
get_func_status()โ€”Returns VoiceFuncStatus with wakeup state, volume, language settings, etc.
get_asr_text()โ€”Retrieve transcribed speech text (use in call mode)
register_callback(...)โ€”Register callback for ASR events

Display / Video

MethodParametersDescription
set_display_switch(is_on)boolEnable/disable the display
play_video(video_path, loop_count)str, intPlay a video file; loop_count=-1 for infinite loop

Usage Pattern

Every GDK program follows this lifecycle:

import agibot_gdk
import time

# 1. Initialize
if agibot_gdk.gdk_init() != agibot_gdk.GDKRes.kSuccess:
    exit(1)

try:
    # 2. Instantiate needed modules
    robot = agibot_gdk.Robot()
    camera = agibot_gdk.Camera()
    time.sleep(2)  # Allow DDS connections to establish

    # 3. Use APIs
    joints = robot.get_joint_states()
    image = camera.get_latest_image(agibot_gdk.CameraType.kHeadStereoLeft, 1000.0)

except Exception as e:
    print(f"Error: {e}")

finally:
    # 4. Close module resources before releasing GDK
    camera.close_camera()

    # 5. Release
    agibot_gdk.gdk_release()
On this page