Skip to content

大疆Python API列表

Xuan Wu edited this page Oct 11, 2019 · 19 revisions

参考论坛帖机甲大师S1主要api汇总(武汉-总督)

注: 所有enum类型都在rm_define中. 调用时应如此使用: rm_define.robot_mode_free

系统

中文说明 英文API 参数 返回值
设置模式 robot.set_mode(mode) (enum) robot_mode_ [gimbal_follow/chassis_follow/free]
控制计时器 tools.timer_ctrl(behavior) (enum) timer_ [start/stop/reset]
设置放大倍数 media_ctrl.zoom_value_update(value) (int): [1, 4]
取计时器值 tools.timer_current() time_stamp(float)
取运行时间 tools.run_time_of_program() time (float)
取本地时间 tools.get_localtime(time) (enum) localtime_ [year/month/day/hour/minute/second] time(int)
取开动时间 tools.get_unixtime() time (float)

灯效(补完中)

中文说明 英文API 参数 返回值
设置闪烁 led_ctrl.set_flash(armor_enum, frequency) armor_enum(enum): armor_ [all/bottom_front/bottom_back/bottom_left/bottom_right/top_left/top_right]; frequency(int): [1, 10]
设置底盘LED led_ctrl.set_bottom_led(armor_enum, r, g, b, led_effect_enum) armor_enum(enum): armor_bottom_ [all/front/back/left/right]; r(int): [0, 255]; g(int): [0, 255]; b(int): [0, 255]; led_effect_enum(enum): effect_ [always_on/always_off/breath/flash]

说明

系统

设置模式

设置整机运动

控制计时器

控制计时器开始、暂停或结束计时

设置放大倍数

放大相机倍镜,局部图像更清晰

取计时器值

信息类: 获取计时器从开始到当前时刻的用时,返回秒数

取运行时间

信息类: 获取程序运行用时,返回秒数

取本地时间

信息类: 获取当前的时间信息,如年/月/日/时/分/秒等

取开动时间

信息类: 机器人启动时刻至今的时间间隔,返回累计的秒数,1)机器人的启动时刻是指上电时刻。2)如果机器人在断电后重启,会重新累计时间戳

灯效

设置闪烁

设置指定位置LED灯的闪烁频率,2Hz 即每秒闪烁 2 次

设置底盘LED

控制底盘指定位置LED灯的颜色和灯效:

  • 常亮,LED 灯保持点亮状态
  • 熄灭,LED 灯关闭
  • 呼吸,LED 灯明暗变化(由暗变亮再变暗)
  • 闪烁,LED 灯以一定频率闪烁
Clone this wiki locally