Commit 69d3877c authored by Marlene Böhmer's avatar Marlene Böhmer
Browse files

Added own crazyflie-lib repro as git module.

parent 4a3fd62e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -16,3 +16,6 @@
[submodule "salt/drone/crazyflie-lib-python"]
	path = salt/drone/crazyflie-lib-python
	url = https://github.com/bitcraze/crazyflie-lib-python.git
[submodule "salt/drone/my-crazyflie-lib-python"]
	path = salt/drone/my-crazyflie-lib-python
	url = git@git.nt.uni-saarland.de:s9meboeh/crazyflie-lib-python.git
+53 −0
Original line number Diff line number Diff line
"""
This script shows a simple scripted flight path using the MotionCommander class.

Simple example that connects to the crazyflie at `URI` and runs a
sequence. Change the URI variable to your Crazyflie configuration.
"""
import logging
import time

import cflib.crtp
from cflib.crazyflie.syncCrazyflie import SyncCrazyflie
from cflib.positioning.motion_commander import MotionCommander

URI = 'radio://0/80/2M'

# Only output errors from the logging framework
logging.basicConfig(level=logging.ERROR)

if __name__ == '__main__':
    # Initialize the low-level drivers (don't list the debug drivers)
    cflib.crtp.init_drivers(enable_debug_driver=False)

    with SyncCrazyflie(URI) as scf:
        # We take off when the commander is created
        with MotionCommander(scf) as mc:
            print('Taking off!')
            time.sleep(1)

            # There is a set of functions that move a specific distance
            # We can move in all directions
            print('Moving forward 0.5m')
            mc.forward(0.5)
            # Wait a bit
            time.sleep(1)

            print('Moving up 0.2m')
            mc.up(0.2)
            # Wait a bit
            time.sleep(1)

            print('Doing a 180deg circle')
            mc.circle_right(0.1, velocity=0.1, angle_degrees=180)

            print('Moving down 0.2m')
            mc.down(0.2)
            # Wait a bit
            time.sleep(1)

            print('Moving forward 0.5m')
            mc.forward(0.5)

            # We land when the MotionCommander goes out of scope
            print('Landing!')
+53 −0
Original line number Diff line number Diff line
"""
This script shows a simple scripted flight path using the MotionCommander class.

Simple example that connects to the crazyflie at `URI` and runs a
sequence. Change the URI variable to your Crazyflie configuration.
"""
import logging
import time

import cflib.crtp
from cflib.crazyflie.syncCrazyflie import SyncCrazyflie
from cflib.positioning.motion_commander import MotionCommander

URI = 'i2c://42'

# Only output errors from the logging framework
logging.basicConfig(level=logging.ERROR)

if __name__ == '__main__':
    # Initialize the low-level drivers (don't list the debug drivers)
    cflib.crtp.init_drivers(enable_debug_driver=False)

    with SyncCrazyflie(URI) as scf:
        # We take off when the commander is created
        with MotionCommander(scf) as mc:
            print('Taking off!')
            time.sleep(1)

            # There is a set of functions that move a specific distance
            # We can move in all directions
            print('Moving forward 0.5m')
            mc.forward(0.5)
            # Wait a bit
            time.sleep(1)

            print('Moving up 0.2m')
            mc.up(0.2)
            # Wait a bit
            time.sleep(1)

            print('Doing a 180deg circle')
            mc.circle_right(0.1, velocity=0.1, angle_degrees=180)

            print('Moving down 0.2m')
            mc.down(0.2)
            # Wait a bit
            time.sleep(1)

            print('Moving forward 0.5m')
            mc.forward(0.5)

            # We land when the MotionCommander goes out of scope
            print('Landing!')

salt/drone/init.sls

0 → 100644
+41 −0
Original line number Diff line number Diff line
pigpio:
    pkg.installed
    
python3-setuptools:
    pkg.installed

cf_lib_dir:
    file.directory:
        - name: /opt/crazyflie-lib-python
        - user: rna
        - group: rna
        - recurse:
            - user
            - group

cf_lib_repro:
    file.recurse:
        - name: /opt/crazyflie-lib-python
        - source: salt://drone/my-crazyflie-lib-python
        - clean: True
        - user: rna
        - group: rna
        - file_mode: keep

cf_lib_build:
    cmd.run:
        - name: python3 setup.py install
        - cwd: /opt/crazyflie-lib-python
        - watch:
            - file: cf_lib_repro
        - require:
            - file: cf_lib_repro

flightscripts:
    file.managed:
        - name: /home/rna/flightscript.py
        - source: salt://drone/flightscript.py
        - user: rna
        - group: rna
        - mode: 777
        - template: jinja
Original line number Diff line number Diff line
Subproject commit 6c41a1033564fda8b1061407d3b9751d8d8d407e