LOCO定位系统入门教程-在仿真环境下两只crazyflie同时起飞、着陆
说明:
- 介绍在仿真环境下两只crazyflie同时起飞、着陆
步骤:
- 进入目录
cd ~/crazyswarm/ros_ws/src/crazyswarm/scripts
- 执行脚本文件
python3 example_cmd_pos.py --sim
- 代码如下
from pycrazyswarm import *
import numpy as np
swarm = Crazyswarm()
timeHelper = swarm.timeHelper
allcfs = swarm.allcfs
Z = 0
# takeoff
while Z < 1.0:
for cf in allcfs.crazyflies:
pos = np.array(cf.initialPosition) + np.array([0, 0, Z])
cf.cmdPosition(pos)
timeHelper.sleep(0.1)
Z += 0.05
# land
while Z > 0.0:
for cf in allcfs.crazyflies:
pos = np.array(cf.initialPosition) + np.array([0, 0, Z])
cf.cmdPosition(pos)
timeHelper.sleep(0.1)
Z -= 0.05
# turn-off motors
for cf in allcfs.crazyflies:
cf.cmdStop()
- 在仿真环境下两只crazyflie同时起飞、着陆
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号