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和对应的电量打印至控制台