forked from USC-ACTLab/crazyswarm
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crazyflie_py: add support for setting groupMask (#384)
* crazyflie_py: add support for setting groupMask See #203 Only works with recent firmware versions.
- Loading branch information
Showing
3 changed files
with
55 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python | ||
|
||
from crazyflie_py import Crazyswarm | ||
|
||
|
||
def main(): | ||
swarm = Crazyswarm() | ||
timeHelper = swarm.timeHelper | ||
allcfs = swarm.allcfs | ||
|
||
# set group mask to enable group 1 and 4 (one by one) | ||
for cf in allcfs.crazyflies: | ||
cf.setGroupMask(0b00001001) | ||
|
||
print('Takeoff with a different mask (2) -> nothing should happen') | ||
allcfs.takeoff(targetHeight=0.5, duration=3.0, groupMask=2) | ||
timeHelper.sleep(3) | ||
|
||
print('Takeoff with correct mask (1) -> should work') | ||
allcfs.takeoff(targetHeight=0.5, duration=3.0, groupMask=1) | ||
timeHelper.sleep(3) | ||
allcfs.land(targetHeight=0.02, duration=3.0) | ||
timeHelper.sleep(3) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters