11. RoboMaster SDK 多機api匯總¶
目前多機支持的api的使用大部分都與單機相同,因此本文檔主要對多機目前支持的api做一個匯總。本文檔單獨介紹了多機中與單機用法不同的接口, 其餘api的具體參數類型、取值範圍以及返回值等詳細介紹參考單機部分。
11.1. 多機api匯總¶
11.1.1. EP 機器人部分¶
module | api |
chassis | drive_wheels(w1, w2, w3, w4, timeout) |
drive_speed(x, y, z, timeout) | |
move(x, y, z, xy_speed, z_speed) | |
gimbal | recenter(pitch_speed, yaw_speed) |
suspend() | |
resume() | |
move(pitch, yaw, pitch_speed, yaw_speed) | |
moveto(pitch, yaw, pitch_speed, yaw_speed) | |
blaser | fire(fire_type, times) |
set_led(brightness, effect) | |
led | set_led(comp, r, g, b, effect, freq) |
robotic_arm | recenter() |
move(x, y) | |
moveto(x, y) | |
gripper 待實現 | open(power) |
close(power) | |
pause() | |
play_sound(sound_id, times) |
11.1.2. 教育機器人部分¶
module | api |
flight | takeoff() |
land() | |
up(distance) | |
down(distance) | |
forward(distance) | |
backword(distance) | |
left(distance) | |
right(distance) | |
rotate(angle) | |
flip_forward() | |
flip_backward() | |
flip_left() | |
flip_right() | |
go(distance) | |
mission_pad_on() | |
mission_pad_off() | |
motor_on() | |
mortor_off() | |
led | set_led(r, g, b) |
set_led_blink(freq, r1, g1, b1, r2, g2, b2) | |
set_led_breath(freq, r, g, b) | |
set_mled_bright(bright) | |
set_mled_boot(display_graph) | |
set_mled_sc() | |
set_mled_graph(display_graph) | |
set_mled_char(color, display_char) | |
set_mled_char_scroll(direction, color, freq, display_str) | |
set_mled_char_scroll(direction, color, freq, display_graph) | |
battery | get_battery() |
以下兩個接口在多機中的使用與單機不同:
flight 模塊的 go() 指令:
go(go_dict) 參數: go_dict: {robot_id1: [x1, y1, z1, speed1, mid1], robot_id2: [x2, y2, z2, speed2, mid2], ... } 其中 robot_id 是飛機的編號, x y z 分別對應單機 go 指令的坐標 x y z, speed 對應單機 go 指令的移動速度 speed,mid 對應單機 go 指令的挑戰卡號碼 mid 返回值: multi_action 對像
led 模塊的指令:
新增command_dict參數,通過使用command_dict實現對單個飛機led的控制,功能與go類似 參數: command_dict: {robot_id1: [*args], robot_id2: [*args], ... } 其中 robot_id 是飛機的編號, *args為各led模塊的參數 返回值: multi_action 對像
battery 模塊的 get_battery() 指令:
get_battery() 參數: 無 會將飛機id和對應的電量打印至控制台