Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Software
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Boards
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
LARN
RNA
Software
Commits
c7b26111
Commit
c7b26111
authored
Oct 07, 2019
by
Marlene Böhmer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update scripts, PRRT, cflib
parent
550cf702
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
173 additions
and
159 deletions
+173
-159
salt/drone/crazyflie-lib-python
salt/drone/crazyflie-lib-python
+1
-1
salt/drone/scripts/bridge.py
salt/drone/scripts/bridge.py
+1
-2
salt/drone/scripts/circle_flightscript.py
salt/drone/scripts/circle_flightscript.py
+48
-38
salt/drone/scripts/flightscript.py
salt/drone/scripts/flightscript.py
+0
-53
salt/drone/scripts/line_flightscript.py
salt/drone/scripts/line_flightscript.py
+47
-0
salt/drone/scripts/log_gen_flightscript.py
salt/drone/scripts/log_gen_flightscript.py
+51
-0
salt/drone/scripts/simple_flightscript.py
salt/drone/scripts/simple_flightscript.py
+15
-6
salt/drone/scripts/uart_flightscript.py
salt/drone/scripts/uart_flightscript.py
+0
-53
salt/drone/scripts/velocity_point_generation.py
salt/drone/scripts/velocity_point_generation.py
+10
-6
No files found.
crazyflie-lib-python
@
b3ef5eb2
Subproject commit b
9612f7d1905e98d4d22fa2367f144c6cd5c0ad0
Subproject commit b
3ef5eb222f83f71a5d0a6e7ab29965783e51523
salt/drone/scripts/bridge.py
View file @
c7b26111
#!/usr/bin/env python
#!/usr/bin/env python
3
import
logging
import
sys
...
...
@@ -176,4 +176,3 @@ if __name__ == '__main__':
except
KeyboardInterrupt
:
print
(
'
\n
'
)
bridge
.
stop
()
salt/drone/scripts/circle_flightscript.py
View file @
c7b26111
"""
This script shows a simple scripted flight path using the MotionCommander class.
#!/usr/bin/env python3
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
sys
import
cflib.crtp
from
cflib.crazyflie.syncCrazyflie
import
SyncCrazyflie
from
cflib.positioning.motion_commander
import
MotionCommander
URI
=
'radio://0/80/2M'
URI
=
''
if
len
(
sys
.
argv
)
>=
2
:
if
sys
.
argv
[
1
]
==
'radio'
:
URI
=
'radio://0/80/2M'
elif
sys
.
argv
[
1
]
==
'prrt'
:
URI
=
'prrt://10.8.0.208:5000'
elif
sys
.
argv
[
1
]
==
'serial'
:
URI
=
'serial://pi'
else
:
sys
.
exit
(
'Give a valid argument.'
)
else
:
sys
.
exit
(
'Give a commandline argument.'
)
# Only output errors from the logging framework
logging
.
basicConfig
(
level
=
logging
.
ERROR
)
...
...
@@ -21,43 +30,44 @@ if __name__ == '__main__':
cflib
.
crtp
.
init_drivers
(
enable_debug_driver
=
False
)
with
SyncCrazyflie
(
URI
)
as
scf
:
# n_points = 16 radius = 0.4 circle_time = 4
with
MotionCommander
(
scf
)
as
mc
:
mc
.
up
(
0.4
)
time
.
sleep
(
1.5
)
for
i
in
range
(
2
):
mc
.
start_linear_motion
(
0.0
,
-
0.12179274
798194117
,
0.6122934917841437
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.3468364021
1958267
,
0.5190773581143323
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.5190773581
143324
,
0.3468364021195829
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.612293491
7841437
,
0.12179274798194117
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.612293491
7841437
,
-
0.12179274798194117
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.5190773581
143324
,
-
0.34683640211958267
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.3468364021
195829
,
-
0.5190773581143324
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.12179274
798194117
,
-
0.6122934917841436
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.12179274
798194095
,
-
0.6122934917841437
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.3468364021
195829
,
-
0.5190773581143325
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.5190773581
143316
,
-
0.34683640211958244
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.612293491
7841443
,
-
0.12179274798194162
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.612293491
7841444
,
0.1217927479819414
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.5190773581
143318
,
0.34683640211958244
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.3468364021
1958267
,
0.5190773581143315
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.12179274
798194162
,
0.6122934917841443
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.12179274
8
,
0.6122934918
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.3468364021
,
0.5190773581
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.5190773581
,
0.3468364021
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.612293491
8
,
0.121792748
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.612293491
8
,
-
0.121792748
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.5190773581
,
-
0.3468364021
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.3468364021
,
-
0.5190773581
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
-
0.12179274
8
,
-
0.6122934918
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.12179274
8
,
-
0.6122934918
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.3468364021
,
-
0.5190773581
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.5190773581
,
-
0.3468364021
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.612293491
8
,
-
0.121792748
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.612293491
8
,
0.121792748
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.5190773581
,
0.3468364021
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.3468364021
,
0.5190773581
)
time
.
sleep
(
0.25
)
mc
.
start_linear_motion
(
0.0
,
0.12179274
8
,
0.6122934918
)
time
.
sleep
(
0.25
)
mc
.
stop
()
time
.
sleep
(
1.5
)
salt/drone/scripts/flightscript.py
deleted
100755 → 0
View file @
550cf702
"""
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!'
)
salt/drone/scripts/
uart_simpl
e_flightscript.py
→
salt/drone/scripts/
lin
e_flightscript.py
View file @
c7b26111
"""
This script shows a simple scripted flight path using the MotionCommander class.
#!/usr/bin/env python3
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
sys
import
cflib.crtp
from
cflib.crazyflie.syncCrazyflie
import
SyncCrazyflie
from
cflib.positioning.motion_commander
import
MotionCommander
URI
=
'serial://pi'
URI
=
''
if
len
(
sys
.
argv
)
>=
2
:
if
sys
.
argv
[
1
]
==
'radio'
:
URI
=
'radio://0/80/2M'
elif
sys
.
argv
[
1
]
==
'prrt'
:
URI
=
'prrt://10.8.0.208:5000'
elif
sys
.
argv
[
1
]
==
'serial'
:
URI
=
'serial://pi'
else
:
sys
.
exit
(
'Give a valid argument.'
)
else
:
sys
.
exit
(
'Give a commandline argument.'
)
# Only output errors from the logging framework
logging
.
basicConfig
(
level
=
logging
.
ERROR
)
...
...
@@ -21,9 +30,18 @@ if __name__ == '__main__':
cflib
.
crtp
.
init_drivers
(
enable_debug_driver
=
False
)
with
SyncCrazyflie
(
URI
)
as
scf
:
#
We take off when the commander is created
#
n_points = 2 radius = 0.25 circle_time = 2
with
MotionCommander
(
scf
)
as
mc
:
print
(
'Taking off!'
)
time
.
sleep
(
0.1
)
# We land when the MotionCommander goes out of scope
print
(
'Landing!'
)
time
.
sleep
(
1.5
)
for
i
in
range
(
5
):
mc
.
start_linear_motion
(
0.0
,
-
0.5
,
0.0
)
time
.
sleep
(
1.0
)
mc
.
stop
()
time
.
sleep
(
0.2
)
mc
.
start_linear_motion
(
0.0
,
0.5
,
-
0.0
)
time
.
sleep
(
1.0
)
mc
.
stop
()
time
.
sleep
(
0.2
)
time
.
sleep
(
1.3
)
salt/drone/scripts/
prrt_simple
_flightscript.py
→
salt/drone/scripts/
log_gen
_flightscript.py
View file @
c7b26111
"""
This script shows a simple scripted flight path using the MotionCommander class.
#!/usr/bin/env python3
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
sys
import
cflib.crtp
from
cflib.crazyflie.syncCrazyflie
import
SyncCrazyflie
from
cflib.positioning.motion_commander
import
MotionCommander
URI
=
'prrt://10.8.0.208:5000'
URI
=
''
if
len
(
sys
.
argv
)
>=
2
:
if
sys
.
argv
[
1
]
==
'radio'
:
URI
=
'radio://0/80/2M'
elif
sys
.
argv
[
1
]
==
'prrt'
:
URI
=
'prrt://10.8.0.208:5000'
elif
sys
.
argv
[
1
]
==
'serial'
:
URI
=
'serial://pi'
else
:
sys
.
exit
(
'Give a valid argument.'
)
else
:
sys
.
exit
(
'Give a commandline argument.'
)
# Only output errors from the logging framework
logging
.
basicConfig
(
level
=
logging
.
ERROR
)
...
...
@@ -21,9 +30,22 @@ if __name__ == '__main__':
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
(
0.1
)
# We land when the MotionCommander goes out of scope
time
.
sleep
(
0.5
)
print
(
'Moving forward'
)
mc
.
forward
(
0.3
)
time
.
sleep
(
0.5
)
print
(
'Moving up'
)
mc
.
up
(
0.2
)
print
(
'Turn left'
)
mc
.
turn_left
(
90
)
print
(
'Moving left'
)
mc
.
left
(
0.3
)
time
.
sleep
(
0.5
)
print
(
'Landing!'
)
salt/drone/scripts/simple_flightscript.py
View file @
c7b26111
"""
This script shows a simple scripted flight path using the MotionCommander class.
#!/usr/bin/env python3
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
sys
import
cflib.crtp
from
cflib.crazyflie.syncCrazyflie
import
SyncCrazyflie
from
cflib.positioning.motion_commander
import
MotionCommander
URI
=
'radio://0/80/2M'
URI
=
''
if
len
(
sys
.
argv
)
>=
2
:
if
sys
.
argv
[
1
]
==
'radio'
:
URI
=
'radio://0/80/2M'
elif
sys
.
argv
[
1
]
==
'prrt'
:
URI
=
'prrt://10.8.0.208:5000'
elif
sys
.
argv
[
1
]
==
'serial'
:
URI
=
'serial://pi'
else
:
sys
.
exit
(
'Give a valid argument.'
)
else
:
sys
.
exit
(
'Give a commandline argument.'
)
# Only output errors from the logging framework
logging
.
basicConfig
(
level
=
logging
.
ERROR
)
...
...
salt/drone/scripts/uart_flightscript.py
deleted
100755 → 0
View file @
550cf702
"""
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
=
'serial://pi'
# 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!'
)
\ No newline at end of file
salt/drone/scripts/velocity_point_generation.py
View file @
c7b26111
import
numpy
as
np
n_points
=
16
radius
=
0.4
time_for_segment
=
4
/
n_points
n_points
=
2
radius
=
0.25
circle_time
=
2
time_for_segment
=
circle_time
/
n_points
y_points
=
np
.
arange
(
n_points
+
1
,
dtype
=
np
.
float64
)
z_points
=
np
.
arange
(
n_points
+
1
,
dtype
=
np
.
float64
)
...
...
@@ -13,8 +14,8 @@ z_points = [x * 2*np.pi/n_points for x in z_points]
y_points
=
[
np
.
cos
(
x
)
for
x
in
y_points
]
z_points
=
[
np
.
sin
(
x
)
for
x
in
z_points
]
y_points
=
[
x
*
0.4
for
x
in
y_points
]
z_points
=
[
x
*
0.4
for
x
in
z_points
]
y_points
=
[
x
*
radius
for
x
in
y_points
]
z_points
=
[
x
*
radius
for
x
in
z_points
]
y_diff
=
[
y_points
[
i
+
1
]
-
y_points
[
i
]
for
i
in
range
(
n_points
)]
z_diff
=
[
z_points
[
i
+
1
]
-
z_points
[
i
]
for
i
in
range
(
n_points
)]
...
...
@@ -22,5 +23,8 @@ z_diff = [z_points[i+1]-z_points[i] for i in range(n_points)]
y_velocity
=
[
y_diff
[
i
]
/
time_for_segment
for
i
in
range
(
n_points
)]
z_velocity
=
[
z_diff
[
i
]
/
time_for_segment
for
i
in
range
(
n_points
)]
y_velocity
=
np
.
around
(
y_velocity
,
10
)
z_velocity
=
np
.
around
(
z_velocity
,
10
)
for
i
in
range
(
n_points
):
print
(
"mc.start_linear_motion(0.0,"
,
y_velocity
[
i
],
","
,
z_velocity
[
i
],
")
\n
time.sleep("
,
time_for_segment
,
")"
)
\ No newline at end of file
print
(
"mc.start_linear_motion(0.0,"
,
y_velocity
[
i
],
","
,
z_velocity
[
i
],
")
\n
time.sleep("
,
time_for_segment
,
")"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment