Merge pull request #1222 from paparazzi/master_cleanup

Master cleanup of deprecated parts

Based on the meeting I removed some deprecated parts of Paparazzi.
fixes #1214

This removes:
- ardrone2_sdk board and associated subsystems
- vision submodule
- default_ardrone.xml telemetry file (use default_rotorcraft.xml instead)

And renames the ardrone2_raw board and airframe file to simply ardrone2.
Also add some sensible modules/settings to the default configurations...
This commit is contained in:
Felix Ruess
2015-07-08 18:00:25 +02:00
52 changed files with 211 additions and 2396 deletions
-3
View File
@@ -7,9 +7,6 @@
[submodule "sw/ext/fatfs"]
path = sw/ext/fatfs
url = https://github.com/enacuavlab/fatfs.git
[submodule "sw/ext/ardrone2_vision"]
path = sw/ext/ardrone2_vision
url = https://github.com/tudelft/ardrone2_vision.git
[submodule "sw/ext/chibios"]
path = sw/ext/chibios
url = https://github.com/mabl/ChibiOS.git
@@ -5,7 +5,7 @@
<firmware name="rotorcraft">
<define name="DEBUG_VFF_EXTENDED"/>
<configure name="HOST" value="192.168.1.$(AC_ID)"/>
<target name="ap" board="ardrone2_raw">
<target name="ap" board="ardrone2">
<define name="USE_SONAR"/>
<define name="USE_BARO_MEDIAN_FILTER"/>
<define name="AUTOPILOT_DISABLE_AHRS_KILL"/>
@@ -5,7 +5,7 @@
<firmware name="rotorcraft">
<define name="DEBUG_VFF_EXTENDED"/>
<configure name="HOST" value="192.168.1.$(AC_ID)"/>
<target name="ap" board="ardrone2_raw">
<target name="ap" board="ardrone2">
<define name="USE_SONAR"/>
<define name="USE_BARO_MEDIAN_FILTER"/>
<define name="AUTOPILOT_DISABLE_AHRS_KILL"/>
@@ -1,10 +1,10 @@
<!DOCTYPE airframe SYSTEM "../../airframe.dtd">
<airframe name="ardrone2_raw">
<airframe name="ardrone2">
<firmware name="rotorcraft">
<!-- Main autopilot target -->
<target name="ap" board="ardrone2_raw">
<target name="ap" board="ardrone2">
<define name="USE_INS_NAV_INIT"/>
<configure name="AHRS_PROPAGATE_FREQUENCY" value="200"/>
+48 -48
View File
@@ -1,160 +1,160 @@
<conf>
<aircraft
name="Ardrone2_raw_181"
name="Ardrone2_181"
ac_id="181"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_182"
name="Ardrone2_182"
ac_id="182"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_183"
name="Ardrone2_183"
ac_id="183"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_184"
name="Ardrone2_184"
ac_id="184"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_185"
name="Ardrone2_185"
ac_id="185"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_186"
name="Ardrone2_186"
ac_id="186"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_187"
name="Ardrone2_187"
ac_id="187"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_188"
name="Ardrone2_188"
ac_id="188"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_189"
name="Ardrone2_189"
ac_id="189"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_190"
name="Ardrone2_190"
ac_id="190"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_191"
name="Ardrone2_191"
ac_id="191"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_192"
name="Ardrone2_192"
ac_id="192"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_193"
name="Ardrone2_193"
ac_id="193"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_194"
name="Ardrone2_194"
ac_id="194"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_195"
name="Ardrone2_195"
ac_id="195"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft_vision.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
/>
<aircraft
name="Ardrone2_raw_196"
name="Ardrone2_196"
ac_id="196"
airframe="airframes/TUDelft/IMAV2013/ardrone2_raw.xml"
airframe="airframes/TUDelft/IMAV2013/ardrone2.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/TUDelft/IMAV2013_rotorcraft.xml"
settings=" settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml settings/modules/flight_time.xml"
gui_color="red"
@@ -1,23 +1,23 @@
<!DOCTYPE airframe SYSTEM "airframe.dtd">
<airframe name="ardrone2_raw">
<airframe name="ardrone2">
<firmware name="rotorcraft">
<target name="ap" board="ardrone2_raw"/>
<target name="ap" board="ardrone2"/>
<target name="nps" board="pc">
<subsystem name="fdm" type="jsbsim"/>
</target>
<subsystem name="telemetry" type="transparent_udp"/>
<subsystem name="radio_control" type="datalink"/>
<define name="USE_SONAR" value="TRUE"/>
<!-- Subsystem section -->
<subsystem name="telemetry" type="transparent_udp"/>
<subsystem name="radio_control" type="datalink"/>
<subsystem name="motor_mixing"/>
<subsystem name="actuators" type="ardrone2"/>
<subsystem name="imu" type="ardrone2"/>
<!-- gps: "ublox" or change to "sirf" for usage with parrot flight recorder -->
<subsystem name="gps" type="ublox"/>
<subsystem name="stabilization" type="int_quat"/>
<subsystem name="ahrs" type="int_cmpl_quat"/>
@@ -25,9 +25,12 @@
</firmware>
<modules main_freq="512">
<!-- remove the gps_ubx_ucenter module if you use the sirf gps (flight recorder) -->
<load name="gps_ubx_ucenter.xml"/>
<load name="send_imu_mag_current.xml"/>
<load name="logger_file.xml"/>
<load name="air_data.xml"/>
<load name="geo_mag.xml"/>
<!--load name="logger_file.xml"/-->
<!--load name="video_rtp_stream.xml"/-->
</modules>
@@ -94,6 +97,7 @@
<!-- local magnetic field -->
<!-- http://wiki.paparazziuav.org/wiki/Subsystem/ahrs#Local_Magnetic_Field -->
<section name="AHRS" prefix="AHRS_">
<!-- values used if no GPS fix, on 3D fix is update by geo_mag module -->
<!-- Toulouse -->
<define name="H_X" value="0.513081"/>
<define name="H_Y" value="-0.00242783"/>
+5 -5
View File
@@ -3,20 +3,19 @@
<airframe name="ardrone2_indi">
<firmware name="rotorcraft">
<target name="ap" board="ardrone2_raw">
<target name="ap" board="ardrone2">
<define name="AUTOPILOT_DISABLE_AHRS_KILL"/>
<subsystem name="telemetry" type="transparent_udp"/>
<subsystem name="radio_control" type="datalink"/>
</target>
<target name="nps" board="pc">
<subsystem name="fdm" type="jsbsim"/>
<subsystem name="radio_control" type="ppm"/>
</target>
<define name="USE_SONAR" value="FALSE"/>
<!-- Subsystem section -->
<!-- Subsystem section -->
<subsystem name="telemetry" type="transparent_udp"/>
<subsystem name="radio_control" type="datalink"/>
<subsystem name="motor_mixing"/>
<subsystem name="actuators" type="ardrone2"/>
<subsystem name="imu" type="ardrone2"/>
@@ -32,6 +31,7 @@
<modules main_freq="512">
<load name="gps_ubx_ucenter.xml"/>
<load name="send_imu_mag_current.xml"/>
<load name="air_data.xml"/>
<load name="logger_file.xml"/>
</modules>
+1 -1
View File
@@ -3,7 +3,7 @@
<airframe name="ardrone2_opticflow">
<firmware name="rotorcraft">
<target name="ap" board="ardrone2_raw"/>
<target name="ap" board="ardrone2"/>
<!--target name="nps" board="pc">
<subsystem name="fdm" type="jsbsim"/>
@@ -1,9 +1,9 @@
<!DOCTYPE airframe SYSTEM "airframe.dtd">
<airframe name="ardrone2_raw">
<airframe name="ardrone2_optitrack">
<firmware name="rotorcraft">
<target name="ap" board="ardrone2_raw">
<target name="ap" board="ardrone2">
<define name="FAILSAFE_DESCENT_SPEED" value="0.5"/>
<configure name="USE_MAGNETOMETER" value="0"/>
</target>
-145
View File
@@ -1,145 +0,0 @@
<!DOCTYPE airframe SYSTEM "airframe.dtd">
<airframe name="ardrone2_sdk">
<firmware name="rotorcraft">
<target name="ap" board="ardrone2_sdk">
<define name="USE_INS_NAV_INIT" />
<define name="ROTORCRAFT_COMMANDS_YAW_ALWAYS_ENABLED"/>
<!-- <define name="ARDRONE2_DEBUG" /> -->
<!-- <define name="USE_GPS_HEIGHT" /> -->
<!-- <define name="ARDRONE_FLIGHT_INDOOR" /> -->
<!-- <define name="ARDRONE_WITHOUT_SHELL" /> -->
<!-- <define name="ARDRONE_OWNER_MAC" value="00:24:d7:47:f0:f4" /> -->
</target>
<subsystem name="radio_control" type="datalink" />
<subsystem name="telemetry" type="transparent_udp" />
<subsystem name="gps" type="ardrone2" />
<subsystem name="ahrs" type="ardrone2" />
<subsystem name="ins" type="ardrone2" />
<subsystem name="actuators" type="ardrone2" />
<subsystem name="stabilization" type="passthrough"/>
<subsystem name="imu" type="ardrone2" />
</firmware>
<modules main_freq="512">
<load name="sys_mon.xml" />
</modules>
<commands>
<axis name="PITCH" failsafe_value="0" />
<axis name="ROLL" failsafe_value="0" />
<axis name="YAW" failsafe_value="0" />
<axis name="THRUST" failsafe_value="0" />
</commands>
<servos driver="Default" />
<section name="STABILIZATION_RATE" prefix="STABILIZATION_RATE_">
<define name="SP_MAX_P" value="10000" />
<define name="SP_MAX_Q" value="10000" />
<define name="SP_MAX_R" value="10000" />
<define name="DEADBAND_P" value="20" />
<define name="DEADBAND_Q" value="20" />
<define name="DEADBAND_R" value="200" />
<define name="REF_TAU" value="4" />
<!-- feedback -->
<define name="GAIN_P" value="400" />
<define name="GAIN_Q" value="400" />
<define name="GAIN_R" value="350" />
<define name="IGAIN_P" value="75" />
<define name="IGAIN_Q" value="75" />
<define name="IGAIN_R" value="50" />
<!-- feedforward -->
<define name="DDGAIN_P" value="300" />
<define name="DDGAIN_Q" value="300" />
<define name="DDGAIN_R" value="300" />
</section>
<section name="STABILIZATION_ATTITUDE" prefix="STABILIZATION_ATTITUDE_">
<!-- setpoints -->
<define name="SP_MAX_PHI" value="30." unit="deg" />
<define name="SP_MAX_THETA" value="30." unit="deg" />
<define name="SP_MAX_R" value="90." unit="deg/s" />
<define name="DEADBAND_A" value="0" />
<define name="DEADBAND_E" value="0" />
<define name="DEADBAND_R" value="250" />
</section>
<section name="GUIDANCE_V" prefix="GUIDANCE_V_">
<define name="HOVER_KP" value="425" />
<define name="HOVER_KD" value="200" />
<define name="HOVER_KI" value="125" />
<define name="NOMINAL_HOVER_THROTTLE" value="0.5"/>
<define name="ADAPT_THROTTLE_ENABLED" value="FALSE"/>
</section>
<section name="GUIDANCE_H" prefix="GUIDANCE_H_">
<define name="MAX_BANK" value="30." unit="deg" />
<define name="PGAIN" value="7" />
<define name="DGAIN" value="2" />
<define name="IGAIN" value="0" />
</section>
<section name="AUTOPILOT">
<define name="MODE_STARTUP" value="AP_MODE_NAV" />
<define name="MODE_MANUAL" value="AP_MODE_RC_DIRECT" />
<define name="MODE_AUTO1" value="AP_MODE_HOVER_Z_HOLD" />
<define name="MODE_AUTO2" value="AP_MODE_NAV" />
</section>
<section name="BAT">
<define name="CATASTROPHIC_BAT_LEVEL" value=".2" unit="V" />
<define name="CRITIC_BAT_LEVEL" value="1.9" unit="V" />
<define name="LOW_BAT_LEVEL" value="2.5" unit="V" />
<define name="MAX_BAT_LEVEL" value="10.0" unit="V" />
</section>
<section name="IMU" prefix="IMU_">
<define name="ACCEL_X_NEUTRAL" value="2072" />
<define name="ACCEL_Y_NEUTRAL" value="2040" />
<define name="ACCEL_Z_NEUTRAL" value="2047" />
<define name="ACCEL_X_SENS" value="19.1079036954" integer="16" />
<define name="ACCEL_Y_SENS" value="19.5393623518" integer="16" />
<define name="ACCEL_Z_SENS" value="19.6539180847" integer="16" />
<define name="ACCEL_X_SIGN" value="1" />
<define name="ACCEL_Y_SIGN" value="-1" />
<define name="ACCEL_Z_SIGN" value="-1" />
<define name="GYRO_P_SENS_NUM" value="4359" />
<define name="GYRO_P_SENS_DEN" value="1000" />
<define name="GYRO_Q_SENS_NUM" value="4359" />
<define name="GYRO_Q_SENS_DEN" value="1000" />
<define name="GYRO_R_SENS_NUM" value="4359" />
<define name="GYRO_R_SENS_DEN" value="1000" />
<define name="GYRO_P_SIGN" value="1" />
<define name="GYRO_Q_SIGN" value="-1" />
<define name="GYRO_R_SIGN" value="-1" />
<define name="MAG_X_NEUTRAL" value="118" />
<define name="MAG_Y_NEUTRAL" value="-65" />
<define name="MAG_Z_NEUTRAL" value="110" />
<define name="MAG_X_SENS" value="14.6416865144" integer="16" />
<define name="MAG_Y_SENS" value="14.5167340835" integer="16" />
<define name="MAG_Z_SENS" value="15.1670335124" integer="16" />
<define name="MAG_X_SIGN" value="-1" />
<define name="MAG_Y_SIGN" value="1" />
<define name="MAG_Z_SIGN" value="-1" />
<!-- roll -->
<define name="BODY_TO_IMU_PHI" value="0." unit="deg" />
<!-- pitch -->
<define name="BODY_TO_IMU_THETA" value="0." unit="deg" />
<!-- yaw -->
<define name="BODY_TO_IMU_PSI" value="0." unit="deg" />
</section>
</airframe>
+1 -4
View File
@@ -110,10 +110,7 @@
<!-- local magnetic field -->
<!-- http://wiki.paparazziuav.org/wiki/Subsystem/ahrs#Local_Magnetic_Field -->
<section name="AHRS" prefix="AHRS_">
<!-- Toulouse -->
<!--define name="H_X" value="0.513081"/>
<define name="H_Y" value="-0.00242783"/>
<define name="H_Z" value="0.858336"/-->
<!-- values used if no GPS fix, on 3D fix is update by geo_mag module -->
<!-- Delft -->
<define name="H_X" value="0.3892503"/>
<define name="H_Y" value="0.0017972"/>
@@ -49,6 +49,12 @@
<servo name="LEFT" no="3" min="1000" neutral="1100" max="1900"/>
</servos>
<modules>
<load name="gps_ubx_ucenter.xml"/>
<load name="geo_mag.xml"/>
<load name="air_data.xml"/>
</modules>
<commands>
<axis name="ROLL" failsafe_value="0"/>
<axis name="PITCH" failsafe_value="0"/>
@@ -88,9 +94,11 @@
</section>
<section name="AHRS" prefix="AHRS_">
<define name="H_X" value="0.3770441"/>
<define name="H_Y" value="0.0193986"/>
<define name="H_Z" value="0.9259921"/>
<!-- values used if no GPS fix, on 3D fix is update by geo_mag module -->
<!-- Toulouse -->
<define name="H_X" value="0.513081"/>
<define name="H_Y" value="-0.00242783"/>
<define name="H_Z" value="0.858336"/>
</section>
<section name="INS" prefix="INS_">
@@ -1,14 +1,13 @@
# Hey Emacs, this is a -*- makefile -*-
#
# ardrone2_sdk.makefile
# ardrone2.makefile
#
# http://wiki.paparazziuav.org/wiki/AR.Drone_2_-_Specifications
#
BOARD=ardrone
BOARD_VERSION=2
BOARD_TYPE=sdk
BOARD_CFG=\"boards/$(BOARD)$(BOARD_VERSION)_$(BOARD_TYPE).h\"
BOARD_CFG=\"boards/$(BOARD)$(BOARD_VERSION).h\"
ARCH=linux
$(TARGET).ARCHDIR = $(ARCH)
@@ -17,8 +16,8 @@ ap.MAKEFILE = ardrone2
# -----------------------------------------------------------------------
USER=foobar
HOST=192.168.1.1
SUB_DIR=sdk
HOST?=192.168.1.1
SUB_DIR=paparazzi
FTP_DIR=/data/video
TARGET_DIR=$(FTP_DIR)/$(SUB_DIR)
# -----------------------------------------------------------------------
@@ -30,20 +29,24 @@ ARDRONE2_IP_ADDRESS_PROBE ?= 1
# -----------------------------------------------------------------------
# The GPS sensor is connected trough USB so we have to define the device
GPS_PORT ?= UART1
GPS_BAUD ?= B57600
GPS_PORT ?= UART1
GPS_BAUD ?= B57600
# The datalink default uses UDP
MODEM_HOST ?= 192.168.1.255
MODEM_HOST ?= 192.168.1.255
# for distinction between SDK and RAW version
ap.CFLAGS +=-DARDRONE2_SDK
# handle linux signals by hand
$(TARGET).CFLAGS += -DUSE_LINUX_SIGNAL -D_GNU_SOURCE
# Link static (Done for GLIBC)
$(TARGET).CFLAGS += -DLINUX_LINK_STATIC
$(TARGET).LDFLAGS += -static
# -----------------------------------------------------------------------
# default LED configuration
RADIO_CONTROL_LED ?= none
RADIO_CONTROL_LED ?= 6
BARO_LED ?= none
AHRS_ALIGNER_LED ?= none
GPS_LED ?= none
SYS_TIME_LED ?= none
AHRS_ALIGNER_LED ?= 5
GPS_LED ?= 3
SYS_TIME_LED ?= 0
+3 -55
View File
@@ -1,56 +1,4 @@
# Hey Emacs, this is a -*- makefile -*-
#
# ardrone2_raw.makefile
#
# http://wiki.paparazziuav.org/wiki/AR.Drone_2_-_Specifications
#
$(info Error: ardrone2_raw has been renamed to ardrone2)
$(info Please replace <target name="ap" board="ardrone2_raw"/> with <target name="ap" board="ardrone2"/>)
BOARD=ardrone
BOARD_VERSION=2
BOARD_TYPE=raw
BOARD_CFG=\"boards/$(BOARD)$(BOARD_VERSION)_$(BOARD_TYPE).h\"
ARCH=linux
$(TARGET).ARCHDIR = $(ARCH)
# include conf/Makefile.ardrone2 (with specific upload rules) instead of only Makefile.linux:
ap.MAKEFILE = ardrone2
# -----------------------------------------------------------------------
USER=foobar
HOST?=192.168.1.1
SUB_DIR=raw
FTP_DIR=/data/video
TARGET_DIR=$(FTP_DIR)/$(SUB_DIR)
# -----------------------------------------------------------------------
ARDRONE2_START_PAPARAZZI ?= 0
ARDRONE2_WIFI_MODE ?= 0
ARDRONE2_SSID ?= ardrone2_paparazzi
ARDRONE2_IP_ADDRESS_BASE ?= 192.168.1.
ARDRONE2_IP_ADDRESS_PROBE ?= 1
# -----------------------------------------------------------------------
# The GPS sensor is connected trough USB so we have to define the device
GPS_PORT ?= UART1
GPS_BAUD ?= B57600
# The datalink default uses UDP
MODEM_HOST ?= 192.168.1.255
# for distinction between RAW and SDK version
$(TARGET).CFLAGS +=-DARDRONE2_RAW
# handle linux signals by hand
$(TARGET).CFLAGS += -DUSE_LINUX_SIGNAL
# Link static (Done for GLIBC)
$(TARGET).CFLAGS += -DLINUX_LINK_STATIC
$(TARGET).LDFLAGS += -static
# -----------------------------------------------------------------------
# default LED configuration
RADIO_CONTROL_LED ?= 6
BARO_LED ?= none
AHRS_ALIGNER_LED ?= 5
GPS_LED ?= 3
SYS_TIME_LED ?= 0
$(error The ardrone2_raw board has been renamed to ardrone2)
+15 -26
View File
@@ -25,7 +25,7 @@
name="Bumblebee_Quad"
ac_id="40"
airframe="airframes/examples/bumblebee_quad.xml"
radio="radios/cockpitSX.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/control/stabilization_rate.xml settings/estimation/ahrs_int_cmpl_quat.xml"
@@ -102,7 +102,7 @@
name="Quad_LisaMX"
ac_id="30"
airframe="airframes/examples/quadrotor_lisa_mx.xml"
radio="radios/spektrum.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/estimation/ahrs_float_mlkf.xml"
@@ -113,11 +113,11 @@
name="Quad_LisaM_2"
ac_id="162"
airframe="airframes/examples/quadrotor_lisa_m_2_pwm_spektrum.xml"
radio="radios/cockpitSX.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/control/stabilization_rate.xml settings/estimation/ahrs_int_cmpl_quat.xml"
settings_modules=""
settings_modules="modules/gps_ubx_ucenter.xml modules/air_data.xml"
gui_color="white"
/>
<aircraft
@@ -139,14 +139,14 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml"
settings_modules="modules/servo_switch.xml modules/rotorcraft_cam.xml modules/digital_cam.xml"
settings_modules="modules/servo_switch.xml modules/rotorcraft_cam.xml modules/digital_cam.xml modules/nav_survey_rectangle_rotorcraft.xml"
gui_color="white"
/>
<aircraft
name="Quad_Navstik"
ac_id="180"
airframe="airframes/examples/quadrotor_navstik.xml"
radio="radios/cockpitSX.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/control/stabilization_rate.xml settings/estimation/ahrs_int_cmpl_quat.xml"
@@ -198,35 +198,24 @@
gui_color="blue"
/>
<aircraft
name="ardrone2_raw"
name="ardrone2"
ac_id="201"
airframe="airframes/ardrone2_raw.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
airframe="airframes/ardrone2.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml"
settings_modules="modules/gps_ubx_ucenter.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int_quat.xml settings/estimation/ahrs_int_cmpl_quat.xml settings/estimation/body_to_imu.xml"
settings_modules="modules/gps_ubx_ucenter.xml modules/air_data.xml"
gui_color="red"
/>
<aircraft
name="ardrone2_sdk"
ac_id="200"
airframe="airframes/ardrone2_sdk.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml"
settings_modules=""
gui_color="blue"
/>
<aircraft
name="bebop"
ac_id="202"
airframe="airframes/bebop.xml"
radio="radios/cockpitSX.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/estimation/ahrs_secondary.xml settings/estimation/ahrs_float_mlkf.xml settings/estimation/ahrs_int_cmpl_quat.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/estimation/ahrs_secondary.xml settings/estimation/ahrs_float_mlkf.xml settings/estimation/ahrs_int_cmpl_quat.xml settings/control/stabilization_att_int_quat.xml"
settings_modules="modules/air_data.xml modules/video_rtp_stream.xml"
gui_color="red"
/>
@@ -245,7 +234,7 @@
name="quadshot"
ac_id="19"
airframe="airframes/examples/quadshot_asp21_spektrum.xml"
radio="radios/spektrum.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/estimation/ahrs_int_cmpl_quat.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int_quat.xml"
+20 -31
View File
@@ -212,7 +212,7 @@
name="Quad_LisaMX"
ac_id="30"
airframe="airframes/examples/quadrotor_lisa_mx.xml"
radio="radios/spektrum.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/estimation/ahrs_float_mlkf.xml"
@@ -223,11 +223,11 @@
name="Quad_LisaM_2"
ac_id="162"
airframe="airframes/examples/quadrotor_lisa_m_2_pwm_spektrum.xml"
radio="radios/cockpitSX.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/control/stabilization_rate.xml settings/estimation/ahrs_int_cmpl_quat.xml"
settings_modules=""
settings_modules="modules/gps_ubx_ucenter.xml modules/air_data.xml"
gui_color="white"
/>
<aircraft
@@ -238,14 +238,14 @@
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml"
settings_modules="modules/servo_switch.xml modules/rotorcraft_cam.xml modules/digital_cam.xml"
settings_modules="modules/servo_switch.xml modules/rotorcraft_cam.xml modules/digital_cam.xml modules/nav_survey_rectangle_rotorcraft.xml"
gui_color="white"
/>
<aircraft
name="Quad_Navstik"
ac_id="180"
airframe="airframes/examples/quadrotor_navstik.xml"
radio="radios/cockpitSX.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/control/stabilization_rate.xml settings/estimation/ahrs_int_cmpl_quat.xml"
@@ -318,47 +318,36 @@
settings_modules=""
gui_color="blue"
/>
<aircraft
name="ardrone2"
ac_id="201"
airframe="airframes/ardrone2.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int_quat.xml settings/estimation/ahrs_int_cmpl_quat.xml settings/estimation/body_to_imu.xml"
settings_modules="modules/gps_ubx_ucenter.xml modules/air_data.xml"
gui_color="red"
/>
<aircraft
name="ardrone2_opticflow"
ac_id="2"
airframe="airframes/ardrone2_opticflow_hover.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml"
settings_modules="modules/gps_ubx_ucenter.xml modules/cv_opticflow.xml"
gui_color="blue"
/>
<aircraft
name="ardrone2_raw"
ac_id="201"
airframe="airframes/ardrone2_raw.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_rate.xml settings/control/stabilization_att_int.xml"
settings_modules="modules/gps_ubx_ucenter.xml"
gui_color="red"
/>
<aircraft
name="ardrone2_sdk"
ac_id="200"
airframe="airframes/ardrone2_sdk.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_ardrone.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml"
settings_modules=""
gui_color="blue"
/>
<aircraft
name="bebop"
ac_id="202"
airframe="airframes/bebop.xml"
radio="radios/cockpitSX.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int.xml settings/estimation/ahrs_secondary.xml settings/estimation/ahrs_float_mlkf.xml settings/estimation/ahrs_int_cmpl_quat.xml"
settings="settings/rotorcraft_basic.xml settings/control/rotorcraft_guidance.xml settings/estimation/ahrs_secondary.xml settings/estimation/ahrs_float_mlkf.xml settings/estimation/ahrs_int_cmpl_quat.xml settings/control/stabilization_att_int_quat.xml"
settings_modules="modules/air_data.xml modules/video_rtp_stream.xml"
gui_color="red"
/>
@@ -399,7 +388,7 @@
name="quadshot"
ac_id="19"
airframe="airframes/examples/quadshot_asp21_spektrum.xml"
radio="radios/spektrum.xml"
radio="radios/dummy.xml"
telemetry="telemetry/default_rotorcraft.xml"
flight_plan="flight_plans/rotorcraft_basic.xml"
settings="settings/rotorcraft_basic.xml settings/estimation/ahrs_int_cmpl_quat.xml settings/control/rotorcraft_guidance.xml settings/control/stabilization_att_int_quat.xml"
+3 -5
View File
@@ -137,10 +137,8 @@ endif
ifeq ($(BOARD), booz)
ns_CFLAGS += -DUSE_DAC
ns_srcs += $(SRC_ARCH)/mcu_periph/dac_arch.c
else ifeq ($(BOARD)$(BOARD_TYPE), ardronesdk)
ns_srcs += $(SRC_BOARD)/electrical_dummy.c
else ifeq ($(BOARD)$(BOARD_TYPE), ardroneraw)
ns_srcs += $(SRC_BOARD)/electrical_raw.c
else ifeq ($(BOARD), ardrone)
ns_srcs += $(SRC_BOARD)/electrical.c
else ifeq ($(BOARD), bebop)
ns_srcs += $(SRC_BOARD)/electrical.c
endif
@@ -169,7 +167,7 @@ ifeq ($(ARCH), stm32)
ns_srcs += $(SRC_ARCH)/led_hw.c
endif
ifeq ($(BOARD)$(BOARD_TYPE), ardroneraw)
ifeq ($(BOARD), ardrone)
ns_srcs += $(SRC_BOARD)/gpio_ardrone.c
endif
@@ -1,16 +0,0 @@
# Hey Emacs, this is a -*- makefile -*-
#
# Fixed point complementary filter using euler angles for attitude estimation
#
AHRS_CFLAGS = -DUSE_AHRS
AHRS_CFLAGS += -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_ardrone2.h\"
AHRS_SRCS += subsystems/ahrs.c
AHRS_SRCS += subsystems/ahrs/ahrs_ardrone2.c
ap.CFLAGS += $(AHRS_CFLAGS)
ap.srcs += $(AHRS_SRCS)
nps.CFLAGS += $(AHRS_CFLAGS)
nps.srcs += $(AHRS_SRCS)
@@ -1,11 +1,5 @@
# Actuator drivers for both ardrone versions are conditionally included here
# The AT-command and RAW drivers are not interchangeble
# Actuator drivers for the raw ardrone version are included here
ifeq ($(BOARD_TYPE), sdk)
$(TARGET).srcs += $(SRC_BOARD)/actuators_at.c
$(TARGET).srcs += $(SRC_BOARD)/at_com.c
else ifeq ($(BOARD_TYPE), raw)
$(TARGET).CFLAGS += -DACTUATORS
$(TARGET).srcs += $(SRC_BOARD)/actuators_ardrone2_raw.c
endif
ap.CFLAGS += -DACTUATORS
ap.srcs += $(SRC_BOARD)/actuators.c
@@ -26,7 +26,7 @@ else ifeq ($(BOARD), navstik)
BARO_BOARD_SRCS += $(SRC_BOARD)/baro_board.c
# Ardrone baro
else ifeq ($(BOARD)$(BOARD_TYPE), ardroneraw)
else ifeq ($(BOARD), ardrone)
BARO_BOARD_SRCS += $(SRC_BOARD)/baro_board.c
# Bebop baro
@@ -1,15 +1,9 @@
# imu AR.Drone2
ifeq ($(BOARD_TYPE), sdk)
imu_CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_ardrone2_sdk.h\" -DUSE_IMU
imu_CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_ardrone2.h\" -DUSE_IMU
imu_srcs += $(SRC_SUBSYSTEMS)/imu.c
imu_srcs += $(SRC_SUBSYSTEMS)/imu/imu_ardrone2_sdk.c
else ifeq ($(BOARD_TYPE), raw)
imu_CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_ardrone2_raw.h\" -DUSE_IMU
imu_srcs += $(SRC_SUBSYSTEMS)/imu.c
imu_srcs += $(SRC_SUBSYSTEMS)/imu/imu_ardrone2_raw.c
imu_srcs += $(SRC_SUBSYSTEMS)/imu/imu_ardrone2.c
imu_srcs += $(SRC_BOARD)/navdata.c
endif
# add it for all targets except sim, fbw and nps
+1 -15
View File
@@ -1960,21 +1960,7 @@
<!--229 is free -->
<message name="AHRS_ARDRONE2" id="230">
<field name="state" type="uint32" />
<field name="control_state" type="uint32" values="DEFAULT|INIT|LANDING|FLYING|HOVERING|TEST|TRANS_TAKEOFF|TRANS_GOTOFIX|TRANS_LANDING|TRANS_LOOPING"/>
<field name="phi" type="float" unit="mdeg"/>
<field name="theta" type="float" unit="mdeg"/>
<field name="psi" type="float" unit="mdeg"/>
<field name="speed_x" type="float" unit="m/s"/>
<field name="speed_y" type="float" unit="m/s"/>
<field name="speed_z" type="float" unit="m/s"/>
<field name="accel_x" type="float" unit="m/s^2"/>
<field name="accel_y" type="float" unit="m/s^2"/>
<field name="accel_z" type="float" unit="m/s^2"/>
<field name="altitude" type="int32" unit="cm"/>
<field name="battery" type="uint32" unit="%"/>
</message>
<!--230 is free -->
<message name="ROTORCRAFT_STATUS" id="231">
<field name="link_imu_nb_err" type="uint32"/>
-147
View File
@@ -1,147 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE telemetry SYSTEM "telemetry.dtd">
<telemetry>
<process name="Main">
<mode name="default" key_press="d">
<message name="AUTOPILOT_VERSION" period="11.1"/>
<message name="DL_VALUE" period="1.1"/>
<message name="ROTORCRAFT_STATUS" period="1.2"/>
<message name="ROTORCRAFT_FP" period="0.25"/>
<message name="ALIVE" period="2.1"/>
<message name="INS_REF" period="5.1"/>
<message name="ROTORCRAFT_NAV_STATUS" period="1.6"/>
<message name="WP_MOVED" period="1.3"/>
<message name="ROTORCRAFT_CAM" period="1."/>
<message name="GPS_INT" period=".25"/>
<message name="INS" period=".25"/>
<message name="I2C_ERRORS" period="4.1"/>
<message name="UART_ERRORS" period="3.1"/>
<message name="DATALINK_REPORT" period="5.1"/>
<message name="STATE_FILTER_STATUS" period="3.2"/>
<message name="OPTIC_FLOW_EST" period="0.25"/>
</mode>
<mode name="ppm">
<message name="DL_VALUE" period="0.5"/>
<message name="ALIVE" period="2.1"/>
<message name="ROTORCRAFT_CMD" period=".05"/>
<message name="PPM" period="0.5"/>
<message name="RC" period="0.5"/>
<message name="ROTORCRAFT_RADIO_CONTROL" period="0.5"/>
<message name="ROTORCRAFT_STATUS" period="1"/>
</mode>
<mode name="raw_sensors">
<message name="ROTORCRAFT_STATUS" period="1.2"/>
<message name="DL_VALUE" period="0.5"/>
<message name="ALIVE" period="2.1"/>
<message name="IMU_ACCEL_RAW" period=".05"/>
<message name="IMU_GYRO_RAW" period=".05"/>
<message name="IMU_MAG_RAW" period=".05"/>
<message name="BARO_RAW" period=".1"/>
<message name="ARDRONE_NAVDATA" period=".05"/>
</mode>
<mode name="scaled_sensors">
<message name="ROTORCRAFT_STATUS" period="1.2"/>
<message name="DL_VALUE" period="0.5"/>
<message name="ALIVE" period="2.1"/>
<message name="IMU_GYRO_SCALED" period=".075"/>
<message name="IMU_ACCEL_SCALED" period=".075"/>
<message name="IMU_MAG_SCALED" period=".1"/>
</mode>
<mode name="ahrs">
<message name="ROTORCRAFT_STATUS" period="1.2"/>
<message name="DL_VALUE" period="0.5"/>
<message name="ALIVE" period="2.1"/>
<message name="FILTER_ALIGNER" period="2.2"/>
<message name="FILTER" period=".5"/>
<message name="AHRS_GYRO_BIAS_INT" period="0.08"/>
<message name="AHRS_QUAT_INT" period=".25"/>
<!-- <message name="AHRS_EULER_INT" period=".1"/> -->
<!-- <message name="AHRS_RMAT_INT" period=".5"/> -->
<message name="AHRS_ARDRONE2" period=".1"/>
</mode>
<mode name="rate_loop">
<message name="ROTORCRAFT_STATUS" period="1.2"/>
<message name="DL_VALUE" period="0.5"/>
<message name="ALIVE" period="2.1"/>
<message name="RATE_LOOP" period=".02"/>
</mode>
<mode name="attitude_setpoint_viz" key_press="v">
<message name="ROTORCRAFT_STATUS" period="1.2"/>
<message name="DL_VALUE" period="0.5"/>
<message name="ALIVE" period="0.9"/>
<message name="ROTORCRAFT_RADIO_CONTROL" period="0.1"/>
<message name="AHRS_REF_QUAT" period="0.05"/>
</mode>
<mode name="attitude_loop" key_press="a">
<message name="ROTORCRAFT_STATUS" period="1.2"/>
<message name="DL_VALUE" period="0.5"/>
<message name="ALIVE" period="0.9"/>
<message name="STAB_ATTITUDE" period=".03"/>
<message name="STAB_ATTITUDE_REF" period=".03"/>
</mode>
<mode name="vert_loop" key_press="v">
<message name="ROTORCRAFT_STATUS" period="1.2"/>
<message name="DL_VALUE" period="0.5"/>
<message name="ALIVE" period="0.9"/>
<message name="VFF_EXTENDED" period=".04"/>
<message name="VERT_LOOP" period=".05"/>
<message name="INS_Z" period=".05"/>
<message name="INS" period=".11"/>
<message name="INS_REF" period="5.1"/>
</mode>
<mode name="h_loop" key_press="h">
<message name="ALIVE" period="0.9"/>
<message name="HOVER_LOOP" period="0.062"/>
<message name="GUIDANCE_H_REF" period="0.062"/>
<message name="STAB_ATTITUDE" period="0.4"/>
<!--<message name="STAB_ATTITUDE_REF" period="0.4"/>-->
<message name="ROTORCRAFT_FP" period="0.8"/>
<message name="ROTORCRAFT_STATUS" period="1.2"/>
<message name="ROTORCRAFT_NAV_STATUS" period="1.6"/>
<message name="INS_REF" period="5.1"/>
<!-- HFF messages are only sent if USE_HFF -->
<message name="HFF" period=".05"/>
<message name="HFF_GPS" period=".03"/>
<message name="HFF_DBG" period=".2"/>
</mode>
<mode name="aligner">
<message name="ALIVE" period="0.9"/>
<message name="FILTER_ALIGNER" period="0.02"/>
</mode>
<mode name="tune_hover">
<message name="DL_VALUE" period="1.1"/>
<message name="ROTORCRAFT_STATUS" period="1.2"/>
<message name="ALIVE" period="2.1"/>
<message name="GUIDANCE_H_INT" period="0.05"/>
<!--<message name="ROTORCRAFT_TUNE_HOVER" period=".1"/>-->
<!-- <message name="GPS_INT" period=".20"/> -->
<!--<message name="INS2" period=".05"/>
<message name="INS3" period=".20"/>-->
<message name="INS_REF" period="5.1"/>
</mode>
<mode name="mag_current_calibration">
<message name="ROTORCRAFT_STATUS" period="1.2"/>
<message name="DL_VALUE" period="0.5"/>
<message name="ALIVE" period="2.1"/>
<message name="IMU_MAG_CURRENT_CALIBRATION" period="0.05"/>
</mode>
</process>
</telemetry>
+11 -1
View File
@@ -25,6 +25,7 @@
<message name="STATE_FILTER_STATUS" period="3.2"/>
<message name="AIR_DATA" period="1.3"/>
<message name="SURVEY" period="2.5"/>
<message name="OPTIC_FLOW_EST" period="0.25"/>
</mode>
<mode name="ppm">
@@ -46,6 +47,7 @@
<message name="IMU_GYRO_RAW" period=".05"/>
<message name="IMU_MAG_RAW" period=".05"/>
<message name="BARO_RAW" period=".1"/>
<message name="ARDRONE_NAVDATA" period=".05"/>
</mode>
<mode name="scaled_sensors">
@@ -101,7 +103,8 @@
<message name="VFF" period=".05"/>
<message name="VFF_EXTENDED" period=".05"/>
<message name="VERT_LOOP" period=".05"/>
<message name="INS" period=".05"/>
<message name="INS_Z" period=".05"/>
<message name="INS" period=".11"/>
<message name="INS_REF" period="5.1"/>
</mode>
@@ -138,6 +141,13 @@
<message name="INS_REF" period="5.1"/>
</mode>
<mode name="mag_current_calibration">
<message name="ROTORCRAFT_STATUS" period="1.2"/>
<message name="DL_VALUE" period="0.5"/>
<message name="ALIVE" period="2.1"/>
<message name="IMU_MAG_CURRENT_CALIBRATION" period="0.05"/>
</mode>
</process>
</telemetry>
+1 -1
View File
@@ -31,7 +31,7 @@
#include <stdint.h>
#include BOARD_CONFIG
#if defined BOARD_ARDRONE2_SDK || defined BOARD_ARDRONE2_RAW
#if defined BOARD_ARDRONE2
extern uint32_t led_hw_values;
#define LED_INIT(i) { led_hw_values &= ~(1<<i); }
#define LED_ON(i) { led_hw_values |= (1<<i); }
@@ -24,12 +24,12 @@
*/
/**
* @file boards/ardrone/actuators_ardrone2_raw.c
* Actuator driver for ardrone2-raw version
* @file boards/ardrone/actuators.c
* Actuator driver for ardrone2 version
*/
#include "subsystems/actuators.h"
#include "actuators_ardrone2_raw.h"
#include "actuators.h"
#include "mcu_periph/gpio.h"
#include "led_hw.h"
#include "mcu_periph/sys_time.h"
@@ -53,7 +53,7 @@
* 190 2.5
* 130 3.0
*/
int actuator_ardrone2_raw_fd; /**< File descriptor for the port */
int actuator_ardrone2_fd; /**< File descriptor for the port */
#define ARDRONE_GPIO_PORT 0x32524
@@ -83,18 +83,18 @@ void actuators_ardrone_init(void)
led_hw_values = 0;
//open mot port
actuator_ardrone2_raw_fd = open("/dev/ttyO0", O_RDWR | O_NOCTTY | O_NDELAY);
if (actuator_ardrone2_raw_fd == -1) {
actuator_ardrone2_fd = open("/dev/ttyO0", O_RDWR | O_NOCTTY | O_NDELAY);
if (actuator_ardrone2_fd == -1) {
perror("open_port: Unable to open /dev/ttyO0 - ");
return;
}
fcntl(actuator_ardrone2_raw_fd, F_SETFL, 0); //read calls are non blocking
fcntl(actuator_ardrone2_raw_fd, F_GETFL, 0);
fcntl(actuator_ardrone2_fd, F_SETFL, 0); //read calls are non blocking
fcntl(actuator_ardrone2_fd, F_GETFL, 0);
//set port options
struct termios options;
//Get the current options for the port
tcgetattr(actuator_ardrone2_raw_fd, &options);
tcgetattr(actuator_ardrone2_fd, &options);
//Set the baud rates to 115200
cfsetispeed(&options, B115200);
cfsetospeed(&options, B115200);
@@ -105,7 +105,7 @@ void actuators_ardrone_init(void)
options.c_oflag &= ~OPOST; //clear output options (raw output)
//Set the new options for the port
tcsetattr(actuator_ardrone2_raw_fd, TCSANOW, &options);
tcsetattr(actuator_ardrone2_fd, TCSANOW, &options);
//reset IRQ flipflop - on error 106 read 1, this code resets 106 to 0
gpio_setup_input(ARDRONE_GPIO_PORT, ARDRONE_GPIO_PIN_IRQ_INPUT);
@@ -157,11 +157,11 @@ void actuators_ardrone_init(void)
int actuators_ardrone_cmd(uint8_t cmd, uint8_t *reply, int replylen)
{
if (full_write(actuator_ardrone2_raw_fd, &cmd, 1) < 0) {
if (full_write(actuator_ardrone2_fd, &cmd, 1) < 0) {
perror("actuators_ardrone_cmd: write failed");
return -1;
}
return full_read(actuator_ardrone2_raw_fd, reply, replylen);
return full_read(actuator_ardrone2_fd, reply, replylen);
}
#include "autopilot.h"
@@ -236,7 +236,7 @@ void actuators_ardrone_set_pwm(uint16_t pwm0, uint16_t pwm1, uint16_t pwm2, uint
cmd[2] = ((pwm1 & 0x1ff) << 3) | ((pwm2 & 0x1ff) >> 6);
cmd[3] = ((pwm2 & 0x1ff) << 2) | ((pwm3 & 0x1ff) >> 7);
cmd[4] = ((pwm3 & 0x1ff) << 1);
full_write(actuator_ardrone2_raw_fd, cmd, 5);
full_write(actuator_ardrone2_fd, cmd, 5);
RunOnceEvery(20, actuators_ardrone_led_run());
}
@@ -265,10 +265,10 @@ void actuators_ardrone_set_leds(uint8_t led0, uint8_t led1, uint8_t led2, uint8_
cmd[0] = 0x60 | ((led0 & 1) << 4) | ((led1 & 1) << 3) | ((led2 & 1) << 2) | ((led3 & 1) << 1);
cmd[1] = ((led0 & 2) << 3) | ((led1 & 2) << 2) | ((led2 & 2) << 1) | ((led3 & 2) << 0);
full_write(actuator_ardrone2_raw_fd, cmd, 2);
full_write(actuator_ardrone2_fd, cmd, 2);
}
void actuators_ardrone_close(void)
{
close(actuator_ardrone2_raw_fd);
close(actuator_ardrone2_fd);
}
@@ -24,12 +24,12 @@
*/
/**
* @file boards/ardrone/actuators_ardrone2_raw.h
* @file boards/ardrone/actuators.h
* Actuator driver for ardrone2-raw version
*/
#ifndef ACTUATORS_ARDRONE2_RAW_H_
#define ACTUATORS_ARDRONE2_RAW_H_
#ifndef ACTUATORS_ARDRONE2_H_
#define ACTUATORS_ARDRONE2_H_
#include <stdint.h>
@@ -59,4 +59,4 @@ void actuators_ardrone_set_pwm(uint16_t pwm0, uint16_t pwm1, uint16_t pwm2, uint
void actuators_ardrone_set_leds(uint8_t led0, uint8_t led1, uint8_t led2, uint8_t led3);
void actuators_ardrone_close(void);
#endif /* ACTUATORS_ARDRONE2_RAW_H_ */
#endif /* ACTUATORS_ARDRONE2_H_ */
-73
View File
@@ -1,73 +0,0 @@
/*
* Copyright (C) 2012-2013 Freek van Tienen
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* @file boards/ardrone/actuators_at.c
* ardrone2-sdk actuators are driven by external software controller by AT-commands
*/
#include "subsystems/ahrs/ahrs_ardrone2.h"
#include "actuators_at.h"
#include "generated/airframe.h"
#include "boards/ardrone/at_com.h"
void actuators_init(void)
{
init_at_com();
}
void actuators_set(pprz_t commands[])
{
//Calculate the thrus, roll, pitch and yaw from the PPRZ commands
float thrust = ((float)(commands[COMMAND_THRUST] - MAX_PPRZ / 2) / (float)MAX_PPRZ) * 2.0f;
float roll = ((float)commands[COMMAND_ROLL] / (float)MAX_PPRZ);
float pitch = ((float)commands[COMMAND_PITCH] / (float)MAX_PPRZ);
float yaw = ((float)commands[COMMAND_YAW] / (float)MAX_PPRZ);
//Starting engine
if(thrust > 0 && (ahrs_ardrone2.control_state == CTRL_DEFAULT || ahrs_ardrone2.control_state == CTRL_INIT
|| ahrs_ardrone2.control_state == CTRL_LANDED)) {
at_com_send_ref(REF_TAKEOFF);
}
//Check emergency or stop engine
if ((ahrs_ardrone2.state & ARDRONE_EMERGENCY_MASK) != 0) {
at_com_send_ref(REF_EMERGENCY);
} else if(thrust < -0.9 && !(ahrs_ardrone2.control_state == CTRL_DEFAULT ||
ahrs_ardrone2.control_state == CTRL_INIT || ahrs_ardrone2.control_state == CTRL_LANDED)) {
at_com_send_ref(0);
}
//Calibration
if ((ahrs_ardrone2.state & ARDRONE_MAGNETO_NEEDS_CALIB) != 0 &&
(ahrs_ardrone2.control_state == CTRL_FLYING || ahrs_ardrone2.control_state == CTRL_HOVERING)) {
at_com_send_calib(0);
}
//Moving
if ((ahrs_ardrone2.state & ARDRONE_MAGNETO_NEEDS_CALIB) == 0 &&
(ahrs_ardrone2.control_state == CTRL_FLYING || ahrs_ardrone2.control_state == CTRL_HOVERING)) {
at_com_send_pcmd(1, thrust, roll, pitch, yaw);
}
//Keep alive (FIXME)
at_com_send_config("general:navdata_demo", "FALSE");
}
-36
View File
@@ -1,36 +0,0 @@
/*
* Copyright (C) 2012-2013 Freek van Tienen
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* @file boards/ardrone/actuators_at.h
* ardrone2-sdk actuators are driven by external software controller by AT-commands
*/
#ifndef BOARDS_ARDRONE_ACTUATORS_AT_H
#define BOARDS_ARDRONE_ACTUATORS_AT_H
#include "paparazzi.h"
extern void actuators_init(void);
extern void actuators_set(pprz_t commands[]);
#define SetActuatorsFromCommands(commands, AP_MODE) actuators_set(commands)
#endif /* BOARDS_ARDRONE_ACTUATORS_AT_H */
-208
View File
@@ -1,208 +0,0 @@
/*
* Copyright (C) 2012-2013 Freek van Tienen
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* @file boards/ardrone/at_com.c
* Sending and receiving of AT-commands specified by the ardrone API
*/
#include "at_com.h"
#include "boards/ardrone2_sdk.h"
#include "generated/airframe.h"
#include <stdlib.h>
#include <stdio.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
int packet_seq = 1; //Packet sequence number
int at_socket = -1, //AT socket connection
navdata_socket = -1; //Navdata socket connection
struct sockaddr_in pc_addr, //Own pc address
drone_at, //Drone AT address
drone_nav, //Drone nav address
from; //From address
bool_t at_com_ready = FALSE; //Status of the at communication
char sessionId[9]; //THe config session ID
void at_com_send(char *command);
void init_at_config(void);
//Init the at_com
void init_at_com(void)
{
//Check if already initialized
if (at_com_ready) {
return;
}
//Create the at and navdata socket
if ((at_socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
printf("at_com: at_socket error (%s)\n", strerror(errno));
}
if ((navdata_socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
printf("at_com: navdata_socket error (%s)\n", strerror(errno));
}
//For recvfrom
pc_addr.sin_family = AF_INET;
pc_addr.sin_addr.s_addr = htonl(INADDR_ANY);
pc_addr.sin_port = htons(9800);
//For sendto AT
drone_at.sin_family = AF_INET;
drone_at.sin_addr.s_addr = inet_addr(ARDRONE_IP);
drone_at.sin_port = htons(ARDRONE_AT_PORT);
//For sendto navadata init
drone_nav.sin_family = AF_INET;
drone_nav.sin_addr.s_addr = inet_addr(ARDRONE_IP);
drone_nav.sin_port = htons(ARDRONE_NAVDATA_PORT);
//Bind the navdata socket
if (bind(navdata_socket, (struct sockaddr *) &pc_addr, sizeof(pc_addr)) < 0) {
printf("at_com: bind error (%s)\n", strerror(errno));
}
//Set unicast mode on
int one = 1;
sendto(navdata_socket, &one, 4, 0, (struct sockaddr *) &drone_nav,
sizeof(drone_nav));
//Init at config
init_at_config();
//Set at_com to ready
at_com_ready = TRUE;
}
//Init the at config
void init_at_config(void)
{
//Generate a session id
uint32_t binaryId = (uint32_t) rand();
binaryId = (0 != binaryId) ? binaryId : 1u;
snprintf(sessionId, 9, "%08x", binaryId);
sessionId[8] = '\0';
//Send session, application and user id:
at_com_send_config("custom:session_id", sessionId);
at_com_send_config("custom:application_id", "9D7BFD45");
at_com_send_config("custom:profile_id", "2BF07F58");
//Send config values
at_com_send_config("control:euler_angle_max", "0.52");
at_com_send_config("control:altitude_max", "20000");
at_com_send_config("control:control_vz_max", "2000");
at_com_send_config("control:control_yaw", "6.11");
//Send config values with the airframe.h
#ifndef ARDRONE_FLIGHT_INDOOR
at_com_send_config("control:outdoor", "TRUE");
#else
at_com_send_config("control:outdoor", "FALSE");
#endif
#ifndef ARDRONE_WITHOUT_SHELL
at_com_send_config("control:flight_without_shell", "FALSE");
#else
at_com_send_config("control:flight_without_shell", "TRUE");
#endif
#ifdef ARDRONE_OWNER_MAC
at_com_send_config("network:owner_mac", ARDRONE_OWNER_MAC);
#endif
}
//Recieve a navdata packet
int at_com_recieve_navdata(unsigned char *buffer)
{
int l = sizeof(from);
int n;
// FIXME(ben): not clear why recvfrom() and not recv() is used.
n = recvfrom(navdata_socket, buffer, ARDRONE_NAVDATA_BUFFER_SIZE, 0x0,
(struct sockaddr *) &from, (socklen_t *) &l);
return n;
}
//Send an AT command
void at_com_send(char *command)
{
sendto(at_socket, command, strlen(command), 0, (struct sockaddr *) &drone_at,
sizeof(drone_at));
}
//Send a Config
void at_com_send_config(char *key, char *value)
{
char command[256];
sprintf(command, "AT*CONFIG_IDS=%d,\"%s\",\"2BF07F58\",\"9D7BFD45\"\r",
packet_seq++, sessionId);
at_com_send(command);
sprintf(command, "AT*CONFIG=%d,\"%s\",\"%s\"\r", packet_seq++, key, value);
at_com_send(command);
}
//Send a Flat trim
void at_com_send_ftrim(void)
{
char command[256];
sprintf(command, "AT*FTRIM=%d\r", packet_seq++);
at_com_send(command);
}
//Send a Ref
void at_com_send_ref(int bits)
{
char command[256];
sprintf(command, "AT*REF=%d,%d\r", packet_seq++, bits | REF_DEFAULT);
at_com_send(command);
}
//Send a Pcmd
void at_com_send_pcmd(int mode, float thrust, float roll, float pitch,
float yaw)
{
int f_thrust, f_roll, f_pitch, f_yaw;
char command[256];
//Change the floats to ints(dereferencing)
memcpy(&f_thrust, &thrust, sizeof thrust);
memcpy(&f_roll, &roll, sizeof roll);
memcpy(&f_pitch, &pitch, sizeof pitch);
memcpy(&f_yaw, &yaw, sizeof yaw);
sprintf(command, "AT*PCMD=%d,%d,%d,%d,%d,%d\r", packet_seq++, mode, f_roll,
f_pitch, f_thrust, f_yaw);
at_com_send(command);
}
//Send a Calib
void at_com_send_calib(int device)
{
char command[256];
sprintf(command, "AT*CALIB=%d,%d\r", packet_seq++, device);
at_com_send(command);
}
-212
View File
@@ -1,212 +0,0 @@
/*
* Copyright (C) 2012-2013 Freek van Tienen
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* @file boards/ardrone/at_com.h
* Sending and receiving of AT-commands specified by the ardrone API
*/
#include "math/pprz_algebra_float.h"
#ifndef BOARDS_ARDRONE_AT_COM_H
#define BOARDS_ARDRONE_AT_COM_H
#define NAVDATA_HEADER (0x55667788)
//Define the AT_REF bits
typedef enum {
REF_TAKEOFF = 1U << 9,
REF_EMERGENCY = 1U << 8,
REF_DEFAULT = 0x11540000
} AT_REFS;
//Define control states
typedef enum {
CTRL_DEFAULT,
CTRL_INIT,
CTRL_LANDED,
CTRL_FLYING,
CTRL_HOVERING,
CTRL_TEST,
CTRL_TRANS_TAKEOFF,
CTRL_TRANS_GOTOFIX,
CTRL_TRANS_LANDING,
CTRL_TRANS_LOOPING,
CTRL_NUM_STATES
} CTRL_STATES;
//Define the AR.Drone states
typedef enum {
ARDRONE_FLY_MASK = 1U << 0, /*!< FLY MASK : (0) ardrone is landed, (1) ardrone is flying */
ARDRONE_VIDEO_MASK = 1U << 1, /*!< VIDEO MASK : (0) video disable, (1) video enable */
ARDRONE_VISION_MASK = 1U << 2, /*!< VISION MASK : (0) vision disable, (1) vision enable */
ARDRONE_CONTROL_MASK = 1U << 3, /*!< CONTROL ALGO : (0) euler angles control, (1) angular speed control */
ARDRONE_ALTITUDE_MASK = 1U << 4, /*!< ALTITUDE CONTROL ALGO : (0) altitude control inactive (1) altitude control active */
ARDRONE_USER_FEEDBACK_START = 1U << 5, /*!< USER feedback : Start button state */
ARDRONE_COMMAND_MASK = 1U << 6, /*!< Control command ACK : (0) None, (1) one received */
ARDRONE_CAMERA_MASK = 1U << 7, /*!< CAMERA MASK : (0) camera not ready, (1) Camera ready */
ARDRONE_TRAVELLING_MASK = 1U << 8, /*!< Travelling mask : (0) disable, (1) enable */
ARDRONE_USB_MASK = 1U << 9, /*!< USB key : (0) usb key not ready, (1) usb key ready */
ARDRONE_NAVDATA_DEMO_MASK = 1U << 10, /*!< Navdata demo : (0) All navdata, (1) only navdata demo */
ARDRONE_NAVDATA_BOOTSTRAP = 1U << 11, /*!< Navdata bootstrap : (0) options sent in all or demo mode, (1) no navdata options sent */
ARDRONE_MOTORS_MASK = 1U << 12, /*!< Motors status : (0) Ok, (1) Motors problem */
ARDRONE_COM_LOST_MASK = 1U << 13, /*!< Communication Lost : (1) com problem, (0) Com is ok */
ARDRONE_SOFTWARE_FAULT = 1U << 14, /*!< Software fault detected - user should land as quick as possible (1) */
ARDRONE_VBAT_LOW = 1U << 15, /*!< VBat low : (1) too low, (0) Ok */
ARDRONE_USER_EL = 1U << 16, /*!< User Emergency Landing : (1) User EL is ON, (0) User EL is OFF*/
ARDRONE_TIMER_ELAPSED = 1U << 17, /*!< Timer elapsed : (1) elapsed, (0) not elapsed */
ARDRONE_MAGNETO_NEEDS_CALIB = 1U << 18, /*!< Magnetometer calibration state : (0) Ok, no calibration needed, (1) not ok, calibration needed */
ARDRONE_ANGLES_OUT_OF_RANGE = 1U << 19, /*!< Angles : (0) Ok, (1) out of range */
ARDRONE_WIND_MASK = 1U << 20, /*!< WIND MASK: (0) ok, (1) Too much wind */
ARDRONE_ULTRASOUND_MASK = 1U << 21, /*!< Ultrasonic sensor : (0) Ok, (1) deaf */
ARDRONE_CUTOUT_MASK = 1U << 22, /*!< Cutout system detection : (0) Not detected, (1) detected */
ARDRONE_PIC_VERSION_MASK = 1U << 23, /*!< PIC Version number OK : (0) a bad version number, (1) version number is OK */
ARDRONE_ATCODEC_THREAD_ON = 1U << 24, /*!< ATCodec thread ON : (0) thread OFF (1) thread ON */
ARDRONE_NAVDATA_THREAD_ON = 1U << 25, /*!< Navdata thread ON : (0) thread OFF (1) thread ON */
ARDRONE_VIDEO_THREAD_ON = 1U << 26, /*!< Video thread ON : (0) thread OFF (1) thread ON */
ARDRONE_ACQ_THREAD_ON = 1U << 27, /*!< Acquisition thread ON : (0) thread OFF (1) thread ON */
ARDRONE_CTRL_WATCHDOG_MASK = 1U << 28, /*!< CTRL watchdog : (1) delay in control execution (> 5ms), (0) control is well scheduled */
ARDRONE_ADC_WATCHDOG_MASK = 1U << 29, /*!< ADC Watchdog : (1) delay in uart2 dsr (> 5ms), (0) uart2 is good */
ARDRONE_COM_WATCHDOG_MASK = 1U << 30, /*!< Communication Watchdog : (1) com problem, (0) Com is ok */
ARDRONE_EMERGENCY_MASK = 1U << 31 /*!< Emergency landing : (0) no emergency, (1) emergency */
} ARDRONE_STATES;
//Navdata option packet without data
typedef struct _navdata_option_t {
uint16_t tag;
uint16_t size;
uint8_t data[1];
} __attribute__((packed)) navdata_option_t;
//Main navdata packet
typedef struct _navdata_t {
uint32_t header; /*!< Always set to NAVDATA_HEADER */
uint32_t ardrone_state; /*!< Bit mask built from def_ardrone_state_mask_t */
uint32_t sequence; /*!< Sequence number, incremented for each sent packet */
uint32_t vision_defined;
navdata_option_t options[1];
} __attribute__((packed)) navdata_t;
//Navdata checksum packet
typedef struct _navdata_cks_t {
uint16_t tag;
uint16_t size;
uint32_t cks;
} __attribute__((packed)) navdata_cks_t;
//Navdata demo option
typedef struct _navdata_demo_t {
uint16_t tag; /*!< Navdata block ('option') identifier */
uint16_t size; /*!< set this to the size of this structure */
uint32_t ctrl_state; /*!< Flying state (landed, flying, hovering, etc.) defined in CTRL_STATES enum. */
uint32_t vbat_flying_percentage; /*!< battery voltage filtered (mV) */
float theta; /*!< UAV's pitch in milli-degrees */
float phi; /*!< UAV's roll in milli-degrees */
float psi; /*!< UAV's yaw in milli-degrees */
int32_t altitude; /*!< UAV's altitude in centimeters */
float vx; /*!< UAV's estimated linear velocity */
float vy; /*!< UAV's estimated linear velocity */
float vz; /*!< UAV's estimated linear velocity */
uint32_t num_frames; /*!< streamed frame index */ // Not used -> To integrate in video stage.
// Camera parameters compute by detection
struct FloatMat33 detection_camera_rot; /*!< Deprecated ! Don't use ! */
struct FloatVect3 detection_camera_trans; /*!< Deprecated ! Don't use ! */
uint32_t detection_tag_index; /*!< Deprecated ! Don't use ! */
uint32_t detection_camera_type; /*!< Type of tag searched in detection */
// Camera parameters compute by drone
struct FloatMat33 drone_camera_rot; /*!< Deprecated ! Don't use ! */
struct FloatVect3 drone_camera_trans; /*!< Deprecated ! Don't use ! */
} __attribute__((packed)) navdata_demo_t;
//Navdata physical measures option
typedef struct _navdata_phys_measures_t {
uint16_t tag;
uint16_t size;
float accs_temp;
uint16_t gyro_temp;
struct FloatVect3 phys_accs;
struct FloatVect3 phys_gyros;
uint32_t alim3V3; // 3.3volt alim [LSB]
uint32_t vrefEpson; // ref volt Epson gyro [LSB]
uint32_t vrefIDG; // ref volt IDG gyro [LSB]
} __attribute__((packed)) navdata_phys_measures_t;
//Navdata gps packet
typedef double float64_t; //TODO: Fix this nicely, but this is only used here
typedef float float32_t; //TODO: Fix this nicely, but this is only used here
typedef struct _navdata_gps_t {
uint16_t tag; /*!< Navdata block ('option') identifier */
uint16_t size; /*!< set this to the size of this structure */
float64_t lat; /*!< Latitude */
float64_t lon; /*!< Longitude */
float64_t elevation; /*!< Elevation */
float64_t hdop; /*!< hdop */
int32_t data_available; /*!< When there is data available */
uint8_t unk_0[8];
float64_t lat0; /*!< Latitude ??? */
float64_t lon0; /*!< Longitude ??? */
float64_t lat_fuse; /*!< Latitude fused */
float64_t lon_fuse; /*!< Longitude fused */
uint32_t gps_state; /*!< State of the GPS, still need to figure out */
uint8_t unk_1[40];
float64_t vdop; /*!< vdop */
float64_t pdop; /*!< pdop */
float32_t speed; /*!< speed */
uint32_t last_frame_timestamp; /*!< Timestamp from the last frame */
float32_t degree; /*!< Degree */
float32_t degree_mag; /*!< Degree of the magnetic */
uint8_t unk_2[16];
struct {
uint8_t sat;
uint8_t cn0;
} channels[12];
int32_t gps_plugged; /*!< When the gps is plugged */
uint8_t unk_3[108];
float64_t gps_time; /*!< The gps time of week */
uint16_t week; /*!< The gps week */
uint8_t gps_fix; /*!< The gps fix */
uint8_t num_sattelites; /*!< Number of sattelites */
uint8_t unk_4[24];
float64_t ned_vel_c0; /*!< NED velocity */
float64_t ned_vel_c1; /*!< NED velocity */
float64_t ned_vel_c2; /*!< NED velocity */
float64_t pos_accur_c0; /*!< Position accuracy */
float64_t pos_accur_c1; /*!< Position accuracy */
float64_t pos_accur_c2; /*!< Position accuracy */
float32_t speed_acur; /*!< Speed accuracy */
float32_t time_acur; /*!< Time accuracy */
uint8_t unk_5[72];
float32_t temprature;
float32_t pressure;
} __attribute__((packed)) navdata_gps_t;
//External functions
extern void init_at_com(void);
extern int at_com_recieve_navdata(unsigned char *buffer);
extern void at_com_send_config(char *key, char *value);
extern void at_com_send_ftrim(void);
extern void at_com_send_ref(int bits);
extern void at_com_send_pcmd(int mode, float thrust, float roll, float pitch, float yaw);
extern void at_com_send_calib(int device);
#endif /* BOARDS_ARDRONE_AT_COM_H */
@@ -26,7 +26,7 @@
* arch specific electrical status readings
*/
#include "electrical_raw.h"
#include "electrical.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -1,37 +0,0 @@
/*
*
* Copyright (C) 2009-2013 The Paparazzi Team
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
/**
* @file boards/ardrone/electrical_dummy.c
* dummy electrical status readings for ardrone-sdk version.
*
* Because ardrone2-sdk version does its battery updating in ahrs_adrone2.c.
*/
#include "subsystems/electrical.h"
struct Electrical electrical;
void electrical_init(void) { }
void electrical_periodic(void) { }
@@ -22,8 +22,6 @@
* ardrone GPIO driver
*/
#ifdef ARDRONE2_RAW
#include <fcntl.h> /* File control definitions */
#include <errno.h> /* Error number definitions */
#include <sys/ioctl.h>
@@ -133,5 +131,3 @@ uint16_t gpio_get(uint32_t port, uint16_t pin)
ioctl(gpiofp, GPIO_READ, &data);
return data.value;
}
#endif
@@ -1,12 +1,12 @@
#ifndef CONFIG_ARDRONE2_RAW
#define CONFIG_ARDRONE2_RAW
#ifndef CONFIG_ARDRONE2
#define CONFIG_ARDRONE2
#define BOARD_ARDRONE2_RAW
#define BOARD_ARDRONE2
#define UART1_DEV "/dev/ttyUSB0"
/* Default actuators driver */
#define DEFAULT_ACTUATORS "boards/ardrone/actuators_ardrone2_raw.h"
#define DEFAULT_ACTUATORS "boards/ardrone/actuators.h"
#define ActuatorDefaultSet(_x,_y) ActuatorArdroneSet(_x,_y)
#define ActuatorsDefaultInit() ActuatorsArdroneInit()
#define ActuatorsDefaultCommit() ActuatorsArdroneCommit()
@@ -17,4 +17,4 @@
#define USE_BARO_BOARD 1
#endif
#endif /* CONFIG_ARDRONE2_RAW */
#endif /* CONFIG_ARDRONE2 */
-22
View File
@@ -1,22 +0,0 @@
#ifndef CONFIG_ARDRONE2_SDK
#define CONFIG_ARDRONE2_SDK
#define BOARD_ARDRONE2_SDK
#define UART1_DEV "/dev/ttyUSB0"
/* Internal communication */
#define ARDRONE_NAVDATA_PORT 5554
#define ARDRONE_AT_PORT 5556
#define ARDRONE_NAVDATA_BUFFER_SIZE 4096
#define ARDRONE_IP "192.168.1.1"
/* Default actuators driver */
#define DEFAULT_ACTUATORS "boards/ardrone/actuators_at.h"
#define ActuatorDefaultSet(_x,_y) {}
#define ActuatorsDefaultInit() {}
#define ActuatorsDefaultCommit() {}
#define USE_BARO_BOARD 0
#endif /* CONFIG_ARDRONE2_SDK */
-207
View File
@@ -1,207 +0,0 @@
/*
* Copyright (C) 2012-2013 Freek van Tienen
*
* This file is part of Paparazzi.
*
* Paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* Paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* @file subsystems/ahrs/ahrs_ardrone2.c
* AHRS implementation for ardrone2-sdk based on AT-commands.
*
* Uses AT-Commands to communicate with ardrone api to retrieve AHRS data
* and also sets battery level.
*/
#ifdef ARDRONE2_DEBUG
# include <errno.h>
# include <stdio.h>
#endif
#include "subsystems/ahrs.h"
#include "ahrs_ardrone2.h"
#include "state.h"
#include "math/pprz_algebra_float.h"
#include "boards/ardrone/at_com.h"
#include "subsystems/electrical.h"
#ifdef USE_GPS_ARDRONE2
#include "subsystems/gps/gps_ardrone2.h"
#endif
struct AhrsARDrone ahrs_ardrone2;
unsigned char buffer[4096]; //Packet buffer
#if PERIODIC_TELEMETRY
#include "subsystems/datalink/telemetry.h"
static void send_ahrs_ad2(struct transport_tx *trans, struct link_device *dev)
{
pprz_msg_send_AHRS_ARDRONE2(trans, dev, AC_ID,
&ahrs_ardrone2.state,
&ahrs_ardrone2.control_state,
&ahrs_ardrone2.eulers.phi,
&ahrs_ardrone2.eulers.theta,
&ahrs_ardrone2.eulers.psi,
&ahrs_ardrone2.speed.x,
&ahrs_ardrone2.speed.y,
&ahrs_ardrone2.speed.z,
&ahrs_ardrone2.accel.x,
&ahrs_ardrone2.accel.y,
&ahrs_ardrone2.accel.z,
&ahrs_ardrone2.altitude,
&ahrs_ardrone2.battery);
}
#endif
void ahrs_ardrone2_register(void)
{
ahrs_ardrone2_init();
/// @todo: provide enable function
ahrs_register_impl(NULL);
}
void ahrs_ardrone2_init(void)
{
init_at_com();
//Set navdata_demo to FALSE and flat trim the ar drone
at_com_send_config("general:navdata_demo", "FALSE");
at_com_send_ftrim();
ahrs_ardrone2.is_aligned = TRUE;
#if PERIODIC_TELEMETRY
register_periodic_telemetry(DefaultPeriodic, "AHRS_ARDRONE2", send_ahrs_ad2);
#endif
}
#ifdef ARDRONE2_DEBUG
static void dump(const void *_b, size_t s)
{
const unsigned char *b = _b;
size_t n;
for (n = 0; n < s; ++n) {
printf("%02x ", b[n]);
if (n % 16 == 15) {
printf("\n");
}
}
if (n % 16 != 0) {
printf("\n");
}
}
#endif
void ahrs_ardrone2_propagate(void)
{
int l;
//Recieve the main packet
l = at_com_recieve_navdata(buffer);
navdata_t *main_packet = (navdata_t *) &buffer;
#ifdef ARDRONE2_DEBUG
if (l < 0) {
printf("errno = %d\n", errno);
}
#endif
//When this isn't a valid packet return
if (l < 0 || main_packet->header != NAVDATA_HEADER) {
return;
}
#ifdef ARDRONE2_DEBUG
printf("Read %d\n", l);
dump(buffer, l);
#endif
//Set the state
ahrs_ardrone2.state = main_packet->ardrone_state;
//Init the option
navdata_option_t *navdata_option = (navdata_option_t *) & (main_packet->options[0]);
bool_t full_read = FALSE;
//The possible packets
navdata_demo_t *navdata_demo;
navdata_gps_t *navdata_gps;
navdata_phys_measures_t *navdata_phys_measures;
//Read the navdata until packet is fully readed
while (!full_read && navdata_option->size > 0) {
#ifdef ARDRONE2_DEBUG
printf("tag = %d\n", navdata_option->tag);
#endif
//Check the tag for the right option
switch (navdata_option->tag) {
case 0: //NAVDATA_DEMO
navdata_demo = (navdata_demo_t *) navdata_option;
//Set the AHRS state
ahrs_ardrone2.control_state = navdata_demo->ctrl_state >> 16;
ahrs_ardrone2.eulers.phi = navdata_demo->phi;
ahrs_ardrone2.eulers.theta = navdata_demo->theta;
ahrs_ardrone2.eulers.psi = navdata_demo->psi;
ahrs_ardrone2.speed.x = navdata_demo->vx / 1000;
ahrs_ardrone2.speed.y = navdata_demo->vy / 1000;
ahrs_ardrone2.speed.z = navdata_demo->vz / 1000;
ahrs_ardrone2.altitude = navdata_demo->altitude / 10;
ahrs_ardrone2.battery = navdata_demo->vbat_flying_percentage;
//Set the ned to body eulers
struct FloatEulers angles;
angles.theta = navdata_demo->theta / 180000.*M_PI;
angles.psi = navdata_demo->psi / 180000.*M_PI;
angles.phi = navdata_demo->phi / 180000.*M_PI;
stateSetNedToBodyEulers_f(&angles);
//Update the electrical supply
electrical.vsupply = navdata_demo->vbat_flying_percentage;
break;
case 3: //NAVDATA_PHYS_MEASURES
navdata_phys_measures = (navdata_phys_measures_t *) navdata_option;
//Set the AHRS accel state
INT32_VECT3_SCALE_2(ahrs_ardrone2.accel, navdata_phys_measures->phys_accs, 9.81, 1000)
break;
#ifdef USE_GPS_ARDRONE2
case 27: //NAVDATA_GPS
# ifdef ARDRONE2_DEBUG
dump(navdata_option, navdata_option->size);
# endif
navdata_gps = (navdata_gps_t *) navdata_option;
// Send the data to the gps parser
gps_ardrone2_parse(navdata_gps);
break;
#endif
case 0xFFFF: //CHECKSUM
//TODO: Check the checksum
full_read = TRUE;
break;
default:
#ifdef ARDRONE2_DEBUG
printf("NAVDATA UNKNOWN TAG: %d %d\n", navdata_option->tag, navdata_option->size);
#endif
break;
}
navdata_option = (navdata_option_t *)((uint32_t)navdata_option + navdata_option->size);
}
}
@@ -1,58 +0,0 @@
/*
* Copyright (C) 2012-2013 Freek van Tienen
*
* This file is part of Paparazzi.
*
* Paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* Paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* @file subsystems/ahrs/ahrs_ardrone2.h
* AHRS implementation for ardrone2-sdk based on AT-commands.
*
* Uses AT-Commands to communicate with ardrone api to retrieve AHRS data
* and also sets battery level.
*/
#ifndef AHRS_ARDRONE2_H
#define AHRS_ARDRONE2_H
#include "std.h"
#include "math/pprz_algebra_int.h"
#include "math/pprz_geodetic_float.h"
struct AhrsARDrone {
uint32_t state; // ARDRONE_STATES
uint32_t control_state; // CTRL_STATES
struct FloatEulers eulers; // in radians
struct NedCoor_f speed; // in m/s
struct NedCoor_f accel; // in m/s^2
int32_t altitude; // in cm above ground
uint32_t battery; // in percentage
struct Int32Quat ltp_to_imu_quat;
bool_t is_aligned;
};
extern struct AhrsARDrone ahrs_ardrone2;
#ifndef PRIMARY_AHRS
#define PRIMARY_AHRS ahrs_ardrone2
#endif
extern void ahrs_ardrone2_register(void);
extern void ahrs_ardrone2_init(void);
extern void ahrs_ardrone2_propagate(void);
#endif /* AHRS_ARDRONE2_H */
-86
View File
@@ -1,86 +0,0 @@
/*
*
* Copyright (C) 2013 Freek van Tienen <freek.v.tienen@gmail.com>
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
/**
* @file subsystems/gps/gps_ardrone2.c
* ARdrone 2 gps trough navdata for the SDK version and only works in combination with the ahrs ardrone2.
*/
#ifdef ARDRONE2_DEBUG
# include <stdio.h>
#endif
#include "subsystems/gps.h"
#include "subsystems/abi.h"
#include "math/pprz_geodetic_double.h"
void gps_impl_init(void)
{
}
void gps_ardrone2_parse(navdata_gps_t *navdata_gps)
{
int i;
#ifdef ARDRONE2_DEBUG
printf("state = %d\n", navdata_gps->gps_state);
#endif
// Set the lla double struct from the navdata
struct LlaCoor_d gps_lla_d;
gps_lla_d.lat = RadOfDeg(navdata_gps->lat);
gps_lla_d.lon = RadOfDeg(navdata_gps->lon);
gps_lla_d.alt = navdata_gps->elevation;
// Convert it to ecef
struct EcefCoor_d gps_ecef_d;
ecef_of_lla_d(&gps_ecef_d, &gps_lla_d);
// Convert the lla and ecef to int and set them in gps
ECEF_BFP_OF_REAL(gps.ecef_pos, gps_ecef_d);
LLA_BFP_OF_REAL(gps.lla_pos, gps_lla_d);
// TODO: parse other stuff
gps.nb_channels = GPS_NB_CHANNELS;
for (i = 0; i < GPS_NB_CHANNELS; i++) {
gps.svinfos[i].svid = navdata_gps->channels[i].sat;
gps.svinfos[i].cno = navdata_gps->channels[i].cn0;
}
// Check if we have a fix TODO: check if 2D or 3D fix?
if (navdata_gps->gps_state == 1) {
gps.fix = GPS_FIX_3D;
} else {
gps.fix = GPS_FIX_NONE;
}
gps.last_msg_ticks = sys_time.nb_sec_rem;
gps.last_msg_time = sys_time.nb_sec;
if (gps.fix == GPS_FIX_3D) {
gps.last_3dfix_ticks = sys_time.nb_sec_rem;
gps.last_3dfix_time = sys_time.nb_sec;
}
uint32_t now_ts = get_sys_time_usec();
AbiSendMsgGPS(GPS_ARDRONE2_ID, now_ts, &gps);
}
-46
View File
@@ -1,46 +0,0 @@
/*
* Copyright (C) 2013 Freek van Tienen <freek.v.tienen@gmail.com>
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
/** @file subsystems/gps/gps_ardrone2.h
* ARdrone 2 gps trough navdata for the SDK version and only works in combination with the ahrs ardrone2.
*
*/
#ifndef GPS_ARDRONE_H
#define GPS_ARDRONE_H
#include "boards/ardrone/at_com.h"
#define GPS_NB_CHANNELS 12
/*
* The GPS event (dummy)
*/
#define GpsEvent() {}
void gps_ardrone2_parse(navdata_gps_t *navdata_gps);
/* Maybe needed?
#define gps_nmea_Reset(_val) { }
*/
#endif /* GPS_ARDRONE_H */
@@ -20,13 +20,13 @@
*/
/**
* @file subsystems/imu/imu_ardrone2_raw.c
* IMU implementation for ardrone2-raw.
* @file subsystems/imu/imu_ardrone2.c
* IMU implementation for ardrone2.
*/
#include "subsystems/imu.h"
#include "navdata.h"
#include "imu_ardrone2_raw.h"
#include "imu_ardrone2.h"
#include "mcu_periph/uart.h"
void imu_impl_init(void)
@@ -20,12 +20,12 @@
*/
/**
* @file subsystems/imu/imu_ardrone2_raw.h
* IMU implementation for ardrone2-raw.
* @file subsystems/imu/imu_ardrone2.h
* IMU implementation for ardrone2.
*/
#ifndef IMU_ARDRONE2_RAW_H_
#define IMU_ARDRONE2_RAW_H_
#ifndef IMU_ARDRONE2_H_
#define IMU_ARDRONE2_H_
#include "generated/airframe.h"
#include "navdata.h"
@@ -87,4 +87,4 @@
#define ImuEvent navdata_update
#endif /* IMU_ARDRONE2_RAW_H_ */
#endif /* IMU_ARDRONE2_H_ */
@@ -1,39 +0,0 @@
/*
* Copyright (C) 2013 Dino Hensen
*
* This file is part of Paparazzi.
*
* Paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* Paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* @file subsystems/imu/imu_ardrone2_sdk.c
* dummy IMU implementation for ardrone2-sdk.
*/
#include "subsystems/imu.h"
#include "imu_ardrone2_sdk.h"
void imu_impl_init(void)
{
}
void imu_periodic(void)
{
}
@@ -1,34 +0,0 @@
/*
* Copyright (C) 2013 Dino Hensen
*
* This file is part of Paparazzi.
*
* Paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* Paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* @file subsystems/imu/imu_ardrone2_sdk.h
* dummy IMU implementation for ardrone2-sdk.
*/
#ifndef IMU_ARDRONE2_SDK_H_
#define IMU_ARDRONE2_SDK_H_
#define ImuEvent() {}
#endif /* IMU_ARDRONE2_SDK_H_ */
-176
View File
@@ -1,176 +0,0 @@
/*
* Copyright (C) 2012-2013 Freek van Tienen
*
* This file is part of Paparazzi.
*
* Paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* Paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* @file subsystems/ins/ins_ardrone2.c
* INS implementation for ardrone2-sdk.
*/
#include "subsystems/ins/ins_ardrone2.h"
#include "subsystems/ahrs.h"
#include "subsystems/gps.h"
#include "generated/airframe.h"
#include "generated/flight_plan.h"
#include "math/pprz_geodetic_int.h"
#ifdef SITL
#include "nps_fdm.h"
#include <stdio.h>
#endif
#ifndef USE_INS_NAV_INIT
#define USE_INS_NAV_INIT TRUE
PRINT_CONFIG_MSG("USE_INS_NAV_INIT defaulting to TRUE")
#endif
struct InsArdrone2 ins_ardrone2;
void ins_ardrone2_init(void)
{
#if USE_INS_NAV_INIT
struct LlaCoor_i llh_nav0; /* Height above the ellipsoid */
llh_nav0.lat = NAV_LAT0;
llh_nav0.lon = NAV_LON0;
/* NAV_ALT0 = ground alt above msl, NAV_MSL0 = geoid-height (msl) over ellipsoid */
llh_nav0.alt = NAV_ALT0 + NAV_MSL0;
struct EcefCoor_i ecef_nav0;
ecef_of_lla_i(&ecef_nav0, &llh_nav0);
ltp_def_from_ecef_i(&ins_ardrone2.ltp_def, &ecef_nav0);
ins_ardrone2.ltp_def.hmsl = NAV_ALT0;
stateSetLocalOrigin_i(&ins_ardrone2.ltp_def);
ins_ardrone2.ltp_initialized = TRUE;
#else
ins_ardrone2.ltp_initialized = FALSE;
#endif
INT32_VECT3_ZERO(ins_ardrone2.ltp_pos);
INT32_VECT3_ZERO(ins_ardrone2.ltp_speed);
INT32_VECT3_ZERO(ins_ardrone2.ltp_accel);
}
void ins_reset_local_origin(void)
{
#if USE_GPS
if (gps.fix == GPS_FIX_3D) {
ltp_def_from_ecef_i(&ins_ardrone2.ltp_def, &gps.ecef_pos);
ins_ardrone2.ltp_def.lla.alt = gps.lla_pos.alt;
ins_ardrone2.ltp_def.hmsl = gps.hmsl;
ins_ardrone2.ltp_initialized = TRUE;
stateSetLocalOrigin_i(&ins_ardrone2.ltp_def);
}
else {
ins_ardrone2.ltp_initialized = FALSE;
}
#else
ins_ardrone2.ltp_initialized = FALSE;
#endif
}
void ins_reset_altitude_ref(void)
{
#if USE_GPS
struct LlaCoor_i lla = {
.lat = state.ned_origin_i.lla.lat,
.lon = state.ned_origin_i.lla.lon,
.alt = gps.lla_pos.alt
};
ltp_def_from_lla_i(&ins_ardrone2.ltp_def, &lla);
ins_ardrone2.ltp_def.hmsl = gps.hmsl;
stateSetLocalOrigin_i(&ins_ardrone2.ltp_def);
#endif
}
void ins_ardrone2_periodic(void)
{
/* untilt accels and speeds */
float_rmat_transp_vmult((struct FloatVect3 *)&ins_ardrone2.ltp_accel,
stateGetNedToBodyRMat_f(),
(struct FloatVect3 *)&ahrs_ardrone2.accel);
float_rmat_transp_vmult((struct FloatVect3 *)&ins_ardrone2.ltp_speed,
stateGetNedToBodyRMat_f(),
(struct FloatVect3 *)&ahrs_ardrone2.speed);
//Add g to the accelerations
ins_ardrone2.ltp_accel.z += 9.81;
//Save the accelerations and speeds
stateSetAccelNed_f(&ins_ardrone2.ltp_accel);
stateSetSpeedNed_f(&ins_ardrone2.ltp_speed);
//Don't set the height if we use the one from the gps
#if !USE_GPS_HEIGHT
//Set the height and save the position
ins_ardrone2.ltp_pos.z = -(ahrs_ardrone2.altitude * INT32_POS_OF_CM_NUM) / INT32_POS_OF_CM_DEN;
stateSetPositionNed_i(&ins_ardrone2.ltp_pos);
#endif
}
void ins_ardrone2_update_gps(void)
{
#if USE_GPS
//Check for GPS fix
if (gps.fix == GPS_FIX_3D) {
//Set the initial coordinates
if (!ins_ardrone2.ltp_initialized) {
ltp_def_from_ecef_i(&ins_ardrone2.ltp_def, &gps.ecef_pos);
ins_ardrone2.ltp_def.lla.alt = gps.lla_pos.alt;
ins_ardrone2.ltp_def.hmsl = gps.hmsl;
ins_ardrone2.ltp_initialized = TRUE;
stateSetLocalOrigin_i(&ins_ardrone2.ltp_def);
}
//Set the x and y and maybe z position in ltp and save
struct NedCoor_i ins_gps_pos_cm_ned;
ned_of_ecef_point_i(&ins_gps_pos_cm_ned, &ins_ardrone2.ltp_def, &gps.ecef_pos);
//When we don't want to use the height of the navdata we can use the gps height
#if USE_GPS_HEIGHT
INT32_VECT3_SCALE_2(ins_ardrone2.ltp_pos, ins_gps_pos_cm_ned, INT32_POS_OF_CM_NUM, INT32_POS_OF_CM_DEN);
#else
INT32_VECT2_SCALE_2(ins_ardrone2.ltp_pos, ins_gps_pos_cm_ned, INT32_POS_OF_CM_NUM, INT32_POS_OF_CM_DEN);
#endif
//Set the local origin
stateSetPositionNed_i(&ins_ardrone2.ltp_pos);
}
#endif /* USE_GPS */
}
#include "subsystems/abi.h"
static abi_event gps_ev;
static void gps_cb(uint8_t sender_id __attribute__((unused)),
uint32_t stamp __attribute__((unused)),
struct GpsState *gps_s)
{
ins_ardrone2_update_gps();
}
void ins_ardrone2_register(void)
{
ins_register_impl(ins_ardrone2_init);
AbiBindMsgGPS(ABI_BROADCAST, &gps_ev, gps_cb);
// FIXME: ins_ardrone2_periodic is currently called via InsPeriodic hack directly from main
}
-58
View File
@@ -1,58 +0,0 @@
/*
* Copyright (C) 2012-2013 Freek van Tienen
*
* This file is part of Paparazzi.
*
* Paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* Paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/**
* @file subsystems/ins/ins_ardrone2.h
* INS implementation for ardrone2-sdk.
*/
#ifndef INS_ARDRONE2_SDK_H
#define INS_ARDRONE2_SDK_H
#include "subsystems/ins.h"
#include "std.h"
#include "math/pprz_geodetic_int.h"
#include "math/pprz_algebra_float.h"
struct InsArdrone2 {
struct LtpDef_i ltp_def;
bool_t ltp_initialized;
float qfe; ///< not used, only dummy for INS_REF message
/* output LTP NED */
struct NedCoor_i ltp_pos;
struct NedCoor_f ltp_speed;
struct NedCoor_f ltp_accel;
};
extern struct InsArdrone2 ins_ardrone2;
#define DefaultInsImpl ins_ardrone2
#define InsPeriodic ins_ardrone2_periodic
extern void ins_ardrone2_init(void);
extern void ins_ardrone2_periodic(void);
extern void ins_ardrone2_update_gps(void);
extern void ins_ardrone2_register(void);
#endif /* INS_ARDRONE2_SDK_H */
-488
View File
@@ -1,488 +0,0 @@
#!/usr/bin/env python
from __future__ import print_function
import re
import argparse
import socket
import telnetlib
import os
from time import sleep
from ftplib import FTP
# Check if IP is valid
def is_ip(address):
try:
socket.inet_aton(address)
ip = True
except socket.error:
ip = False
return ip
# Execute a command
def execute_command(command):
tn.write(command + '\n')
return tn.read_until('# ')[len(command) + 2:-4]
# Helper function
def split_into_path_and_file(name):
if name.count('/') <= 0:
return ["./", name]
return name.rsplit('/', 1)
# Read from config.ini
def read_from_config(name, config=''):
if config == '':
config = execute_command('cat /data/config.ini')
search = re.search(name + '[^=]+=[\r\n\t ]([^\r\n\t ]+)', config)
if search is None:
return ''
else:
return search.group(1)
# Write to config
def write_to_config(name, value):
if read_from_config(name) == '':
execute_command('echo "' + name + ' = ' + value + '\" >> /data/config.ini')
else:
execute_command('sed -i "s/\(' + name + ' *= *\).*/\\1' + value + '/g" /data/config.ini')
# Check the version
def check_version():
return execute_command('cat /firmware/version.txt')
# Check what currently is running on the drone
def check_running():
ps_aux = execute_command('ps')
running = ""
if 'program.elf' in ps_aux:
running += ' Native (program.elf),'
if 'ap.elf' in ps_aux:
running += ' Paparazzi (ap.elf),'
if 'gst-launch' in ps_aux:
running += ' GStreamer (gst-launch)'
return running[1:]
# Check if vision framework is installed
def check_vision_installed():
du_opt = execute_command('du -d 2 /data/video/opt')
return '/data/video/opt/arm/gst' in du_opt or '/data/video/opt/arm/lib' in du_opt or '/data/video/opt/arm/tidsp-binaries-23.i3.8' in du_opt
# Check if the vision framework is running
def check_vision_running():
du_opt = execute_command('du -d 2 /opt')
return '/opt/arm/gst' in du_opt and '/opt/arm/lib' in du_opt and '/opt/arm/tidsp-binaries-23.i3.8' in du_opt
# Check if autoboot is installed
def check_autoboot():
check_update = execute_command('grep "START_PAPARAZZI" /bin/check_update.sh')
wifi_setup = execute_command('grep "BASE_ADRESS" /bin/wifi_setup.sh')
if "START_PAPARAZZI" in check_update and "BASE_ADRESS" in wifi_setup:
return True
else:
return False
# Check if custom wifi_setup script is installed
def check_wifi_setup():
check_wifi = execute_command('grep "static_ip_address_base" /bin/wifi_setup.sh')
if "static_ip_address_base" in check_wifi:
return True
else:
return False
# Check the filesystem
def check_filesystem():
return execute_command('df -h')
# Reboot the drone
def bebop_reboot():
execute_command('reboot')
# Install the vision framework
def bebop_install_vision():
print('Uploading GST')
ftp.storbinary("STOR arm_light.tgz", file("bin/arm_light.tgz", "rb"))
print(execute_command("cd /data/video && tar -xzf arm_light.tgz"))
print(execute_command("rm -rf /data/video/arm_light.tgz"))
print('Now Starting Vision')
bebop_start_vision()
# Remove the vision framework
def bebop_remove_vision():
execute_command("rm -rf /opt/arm")
execute_command("rm -rf /lib/dsp")
execute_command("rm -rf /data/video/opt")
# Start the vision framework
def bebop_start_vision():
# Mount the directories
execute_command("mkdir -p /opt/arm")
execute_command("mkdir -p /lib/dsp")
execute_command("mount --bind /data/video/opt/arm /opt/arm")
execute_command("mount --bind /data/video/opt/arm/lib/dsp /lib/dsp")
# Start The DSP programs
execute_command("kill -9 `pidof program.elf`")
execute_command("kill -9 `pidof gst-launch-0.10`")
execute_command("export PATH=/opt/arm/gst/bin:$PATH")
execute_command("export DSP_PATH=/opt/arm/tidsp-binaries-23.i3.8/")
execute_command("/bin/dspbridge/cexec.out -T /opt/arm/tidsp-binaries-23.i3.8/baseimage.dof -v")
execute_command("/bin/dspbridge/dynreg.out -r /opt/arm/tidsp-binaries-23.i3.8/m4venc_sn.dll64P -v")
# Show result
execute_command("ls -altr /opt/arm/gst/bin")
# Install autoboot script
def bebop_install_autoboot():
print('Uploading autoboot script')
ftp.storbinary("STOR check_update.sh", file("check_update.sh", "rb"))
print(execute_command("mv /data/video/check_update.sh /bin/check_update.sh"))
print(execute_command("chmod 777 /bin/check_update.sh"))
# Install network script
def bebop_install_network_script():
print('Uploading Wifi script')
ftp.storbinary("STOR wifi_setup.sh", file("wifi_setup.sh", "rb"))
print(execute_command("mv /data/video/wifi_setup.sh /bin/wifi_setup.sh"))
print(execute_command("chmod 777 /bin/wifi_setup.sh"))
# Set network SSID
def bebop_set_ssid(name):
write_to_config('ssid_single_player', name)
print('The network ID (SSID) of the Bebop is changed to ' + name)
# Set IP address
def bebop_set_ip_address(address):
splitted_ip = address.split(".")
write_to_config('static_ip_address_base', splitted_ip[0] + '.' + splitted_ip[1] + '.' + splitted_ip[2] + '.')
write_to_config('static_ip_address_probe', splitted_ip[3])
print('The IP Address of the Bebop is changed to ' + address)
# Set wifi mode (0: master, 1: ad-hoc, 2: managed, *: master)
def bebop_set_wifi_mode(mode):
modes = { 'master' : '0', 'ad-hoc' : '1', 'managed' : '2' }
try:
val = modes[mode]
except:
print('Unexpected wifi mode, setting to master (default)')
val = modes['master']
write_to_config('wifi_mode', val)
print('The Wifi mode of the Bebop is changed to ' + mode + ' (' + val + ')')
def bebop_status():
config_ini = execute_command('cat /data/config.ini')
print('======================== Bebop Status ========================')
print('Version:\t\t' + check_version())
print('Host:\t\t\t' + args.host + ' (' + read_from_config('static_ip_address_base', config_ini) +
read_from_config('static_ip_address_probe', config_ini) + ' after boot)')
print('Currently running:\t' + check_running())
print('Serial number:\t\t' + read_from_config('drone_serial', config_ini))
print('Network id:\t\t' + read_from_config('ssid_single_player', config_ini))
print('Motor software:\t\t' +
read_from_config('motor1_soft', config_ini) + '\t' + read_from_config('motor2_soft', config_ini) + '\t' +
read_from_config('motor3_soft', config_ini) + '\t' + read_from_config('motor4_soft', config_ini))
print('Motor hardware:\t\t' +
read_from_config('motor1_hard', config_ini) + '\t' + read_from_config('motor2_hard', config_ini) + '\t' +
read_from_config('motor3_hard', config_ini) + '\t' + read_from_config('motor4_hard', config_ini))
autorun = {'': 'Native', '0': 'Native', '1': 'Paparazzi RAW', '2': 'Paparazzi SDK'}
if check_autoboot():
print('Autorun at start:\tInstalled booting ' + autorun[read_from_config('start_paparazzi', config_ini)])
else:
print('Autorun at start:\tNot installed')
# Check if the vision framework is installed and running
vision_framework = ""
if check_vision_installed():
vision_framework += "Installed"
if check_vision_running():
vision_framework += " and running"
print('Vision framework:\t' + vision_framework)
# Request the filesystem status
print('\n======================== Filesystem Status ========================')
print(check_filesystem())
# Parse the arguments
parser = argparse.ArgumentParser(description='Bebop python helper. Use bebop.py -h for help')
parser.add_argument('--host', metavar='HOST', default='192.168.42.1',
help='the ip address of bebop')
subparsers = parser.add_subparsers(title='Command to execute', metavar='command', dest='command')
# All the subcommands and arguments
subparsers.add_parser('status', help='Request the status of the Bebop')
subparsers.add_parser('reboot', help='Reboot the Bebop')
subparsers.add_parser('installvision', help='Install the vision framework')
subparser_upload_gst = subparsers.add_parser('upload_gst_module',
help='Upload, configure and move a gstreamer0.10 module libXXX.so')
subparser_upload_gst.add_argument('file', help='Filename of *.so module')
subparser_upload_and_run = subparsers.add_parser('upload_file_and_run', help='Upload and run software (for instance the Paparazzi autopilot)')
subparser_upload_and_run.add_argument('file', help='Filename of an executable')
subparser_upload_and_run.add_argument('folder', help='Destination subfolder (raw or sdk for Paparazzi autopilot)')
subparser_upload = subparsers.add_parser('upload_file', help='Upload a file to the Bebop')
subparser_upload.add_argument('file', help='Filename')
subparser_upload.add_argument('folder', help='Destination subfolder (base destination folder is /data/video)')
subparser_download = subparsers.add_parser('download_file', help='Download a file from the Bebop')
subparser_download.add_argument('file', help='Filename (with the path on the local machine)')
subparser_download.add_argument('folder', help='Remote subfolder (base folder is /data/video)')
subparser_download_dir = subparsers.add_parser('download_dir', help='Download all files from a folder from the Bebop')
subparser_download_dir.add_argument('dest', help='destination folder (on the local machine)')
subparser_download_dir.add_argument('folder', help='Remote subfolder (base folder is /data/video)')
subparser_rm_dir = subparsers.add_parser('rm_dir', help='Remove a directory and all its files from the Bebop')
subparser_rm_dir.add_argument('folder', help='Remote subfolder (base folder is /data/video)')
subparser_insmod = subparsers.add_parser('insmod', help='Upload and insert kernel module')
subparser_insmod.add_argument('file', help='Filename of *.ko kernel module')
subparsers.add_parser('startvision', help='Start the vision framework')
subparser_start = subparsers.add_parser('start', help='Start a program on the Bebop')
subparser_start.add_argument('program', help='the program to start')
subparser_kill = subparsers.add_parser('kill', help='Kill a program on the Bebop')
subparser_kill.add_argument('program', help='the program to kill')
subparser_networkid = subparsers.add_parser('networkid', help='Set the network ID(SSID) of the Bebop')
subparser_networkid.add_argument('name', help='the new network ID(SSID)')
subparser_ipaddress = subparsers.add_parser('ipaddress', help='Set the IP address of the Bebop')
subparser_ipaddress.add_argument('address', help='the new IP address')
subparser_wifimode = subparsers.add_parser('wifimode', help='Set the Wifi mode the Bebop')
subparser_wifimode.add_argument('mode', help='the new Wifi mode', choices=['master', 'ad-hoc', 'managed'])
subparser_configure_network = subparsers.add_parser('configure_network', help='Configure the network on the Bebop')
subparser_configure_network.add_argument('name', help='the new network ID(SSID)')
subparser_configure_network.add_argument('address', help='the new IP address')
subparser_configure_network.add_argument('mode', help='the new Wifi mode', choices=['master', 'ad-hoc', 'managed'])
subparser_install_autostart = subparsers.add_parser('install_autostart', help='Install custom autostart script and set what to start on boot for the Bebop')
subparser_install_autostart.add_argument('type', choices=['native', 'paparazzi_raw', 'paparazzi_sdk'],
help='what to start on boot')
subparser_autostart = subparsers.add_parser('autostart', help='Set what to start on boot for the Bebop')
subparser_autostart.add_argument('type', choices=['native', 'paparazzi_raw', 'paparazzi_sdk'],
help='what to start on boot')
args = parser.parse_args()
# Connect with telnet and ftp
try:
tn = telnetlib.Telnet(args.host)
ftp = FTP(args.host)
ftp.login()
except:
print('Could not connect to Bebop (host: ' + args.host + ')')
exit(2)
# Read until after login
tn.read_until('# ')
# Check the Bebop status
if args.command == 'status':
bebop_status()
# Reboot the drone
elif args.command == 'reboot':
bebop_reboot()
print('The Bebop is rebooting...')
# Kill a program
elif args.command == 'kill':
execute_command('killall -9 ' + args.program)
print('Program "' + args.program + '" is now killed')
# Start a program
elif args.command == 'start':
execute_command(args.start + ' &')
print('Program "' + args.start + '" is now started')
# Change the network ID
elif args.command == 'networkid':
bebop_set_ssid(args.name)
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
bebop_reboot()
# Change the IP address
elif args.command == 'ipaddress':
bebop_set_ip_address(args.address)
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
bebop_reboot()
# Change the wifi mode
elif args.command == 'wifimode':
bebop_set_wifi_mode(args.mode)
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
bebop_reboot()
# Install and configure network
elif args.command == 'configure_network':
config_ini = execute_command('cat /data/config.ini')
print('=== Current network setup ===')
print('Network id:\t' + read_from_config('ssid_single_player', config_ini))
print('Host:\t\t' + args.host + ' (' + read_from_config('static_ip_address_base', config_ini) +
read_from_config('static_ip_address_probe', config_ini) + ' after boot)')
print('Mode:\t\t' + read_from_config('wifi_mode', config_ini))
print('=============================')
if check_wifi_setup():
print('Custom Wifi script already installed')
if raw_input("Shall I reinstall the Wifi script (y/N) ").lower() == 'y':
bebop_install_network_script()
else:
if raw_input("Shall I install custom Wifi script (recommanded) (y/N) ").lower() == 'y':
bebop_install_network_script()
bebop_set_ssid(args.name)
bebop_set_ip_address(args.address)
bebop_set_wifi_mode(args.mode)
config_ini = execute_command('cat /data/config.ini')
print('== New network setup after boot ==')
print('Network id:\t' + read_from_config('ssid_single_player', config_ini))
print('Host:\t\t' + read_from_config('static_ip_address_base', config_ini) +
read_from_config('static_ip_address_probe', config_ini))
print('Mode:\t\t' + read_from_config('wifi_mode', config_ini))
print('==================================')
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
bebop_reboot()
# Install and configure autostart
elif args.command == 'install_autostart':
if check_autoboot():
print('Custom autostart script already installed')
if raw_input("Shall I reinstall the autostart script (y/N) ").lower() == 'y':
bebop_install_autoboot()
else:
bebop_install_autoboot()
autorun = {'native': '0', 'paparazzi_raw': '1', 'paparazzi_sdk': '2'}
write_to_config('start_paparazzi', autorun[args.type])
print('The autostart on boot is changed to ' + args.type)
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
bebop_reboot()
# Change the autostart
elif args.command == 'autostart':
autorun = {'native': '0', 'paparazzi_raw': '1', 'paparazzi_sdk': '2'}
write_to_config('start_paparazzi', autorun[args.type])
print('The autostart on boot is changed to ' + args.type)
# Install Vision framework
elif args.command == 'installvision':
if check_vision_installed():
print('Vision framework already installed')
if raw_input("Shall I reinstall the vision framework? (y/N) ").lower() == 'y':
bebop_remove_vision()
bebop_install_vision()
bebop_install_vision()
print('Vision framework installed')
# Start Vision framework
elif args.command == 'startvision':
if check_vision_running():
print('Vision framework already started')
else:
if not check_vision_installed():
print('No vision framework installed')
if raw_input("Shall I install the vision framework? (y/N) ").lower() == 'y':
bebop_install_vision()
if check_vision_installed():
bebop_start_vision()
print('Vision framework started')
elif args.command == 'upload_gst_module':
print('Uploading ...' + args.file)
ftp.storbinary("STOR " + args.file, file(args.file, "rb"))
execute_command("chmod 777 /data/video/" + args.file)
execute_command("mv /data/video/" + args.file + " /data/video/opt/arm/gst/lib/gstreamer-0.10")
if check_vision_running():
print('Info: Vision framework already started')
else:
if not check_vision_installed():
print('Warning: No vision framework installed')
if raw_input("Warning: Shall I install the vision framework? (y/N) ").lower() == 'y':
bebop_install_vision()
if check_vision_installed():
bebop_start_vision()
print('#pragma message: Vision framework started')
print('#pragma message: Vision Plugin Uploaded and DSP Started.')
elif args.command == 'insmod':
modfile = split_into_path_and_file(args.file)
print('Uploading \'' + modfile[1])
ftp.storbinary("STOR " + modfile[1], file(args.file, "rb"))
print(execute_command("insmod /data/video/" + modfile[1]))
elif args.command == 'upload_file_and_run':
# Split filename and path
f = split_into_path_and_file(args.file)
print("Kill running " + f[1] + " and make folder " + args.folder)
execute_command("killall -9 " + f[1])
sleep(1)
execute_command("mkdir -p /data/ftp/" + args.folder)
print('Uploading \'' + f[1] + "\' from " + f[0] + " to " + args.folder)
ftp.storbinary("STOR " + args.folder + "/" + f[1], file(args.file, "rb"))
sleep(0.5)
execute_command("chmod 777 /data/ftp/" + args.folder + "/" + f[1])
execute_command("/data/ftp/" + args.folder + "/" + f[1] + " > /dev/null 2>&1 &")
print("#pragma message: Upload and Start of ap.elf to Bebop Succes!")
elif args.command == 'upload_file':
# Split filename and path
f = split_into_path_and_file(args.file)
execute_command("mkdir -p /data/video/" + args.folder)
print('Uploading \'' + f[1] + "\' from " + f[0] + " to /data/video/" + args.folder)
ftp.storbinary("STOR " + args.folder + "/" + f[1], file(args.file, "rb"))
print("#pragma message: Upload of " + f[1] + " to Bebop Succes!")
elif args.command == 'download_file':
# Split filename and path
f = split_into_path_and_file(args.file)
# Open file and download
try:
file = open(args.file, 'wb')
print('Downloading \'' + f[1] + "\' from " + args.folder + " to " + f[0])
ftp.retrbinary("RETR " + args.folder + "/" + f[1], file.write)
print("#pragma message: Download of " + f[1] + " from Bebop Succes!")
except IOError:
print("#pragma message: Fail to open file " + args.file)
except:
os.remove(args.file)
print("#pragma message: Download of " + f[1] + " from Bebop Failed!")
else:
file.close()
elif args.command == 'download_dir':
# Split filename and path
files = execute_command('find /data/video/' + args.folder + ' -name \'*.*\'')
# Create dest dir if needed
if not os.path.exists(args.dest):
os.mkdir(args.dest)
# Open file and download
for f in files.split():
file_name = split_into_path_and_file(f)
file_source = args.folder + '/' + file_name[1]
file_dest = args.dest + '/' + file_name[1]
try:
file = open(file_dest, 'wb')
print('Downloading \'' + f + "\' to " + file_dest)
ftp.retrbinary("RETR " + file_source, file.write)
except IOError:
print("#pragma message: Fail to open file " + file_dest)
except:
os.remove(file_dest)
print("#pragma message: Download of " + f + " from Bebop Failed!")
else:
file.close()
print("#pragma message: End download of folder " + args.folder + " from Bebop")
elif args.command == 'rm_dir':
# Split filename and path
print("Deleting folder /data/video/" + args.folder + " from Bebop")
print(execute_command('rm -r /data/video/' + args.folder))
# Close the telnet and python script
tn.close()
ftp.close()
exit(0)
+7 -7
View File
@@ -173,7 +173,7 @@ def ardrone2_status():
read_from_config('motor1_hard', config_ini) + '\t' + read_from_config('motor2_hard', config_ini) + '\t' +
read_from_config('motor3_hard', config_ini) + '\t' + read_from_config('motor4_hard', config_ini))
autorun = {'': 'Native', '0': 'Native', '1': 'Paparazzi RAW', '2': 'Paparazzi SDK'}
autorun = {'': 'Native', '0': 'Native', '1': 'Paparazzi'}
if check_autoboot():
print('Autorun at start:\tInstalled booting ' + autorun[read_from_config('start_paparazzi', config_ini)])
else:
@@ -207,7 +207,7 @@ subparser_upload_gst = subparsers.add_parser('upload_gst_module',
subparser_upload_gst.add_argument('file', help='Filename of *.so module')
subparser_upload_and_run = subparsers.add_parser('upload_file_and_run', help='Upload and run software (for instance the Paparazzi autopilot)')
subparser_upload_and_run.add_argument('file', help='Filename of an executable')
subparser_upload_and_run.add_argument('folder', help='Destination subfolder (raw or sdk for Paparazzi autopilot)')
subparser_upload_and_run.add_argument('folder', help='Destination subfolder (raw for Paparazzi autopilot)')
subparser_upload = subparsers.add_parser('upload_file', help='Upload a file to the ARDrone 2')
subparser_upload.add_argument('file', help='Filename')
subparser_upload.add_argument('folder', help='Destination subfolder (base destination folder is /data/video)')
@@ -238,10 +238,10 @@ subparser_configure_network.add_argument('address', help='the new IP address')
subparser_configure_network.add_argument('mode', help='the new Wifi mode', choices=['master', 'ad-hoc', 'managed', 'ad-hoc-olsr'])
subparser_configure_network.add_argument('--channel', help='the wifi channel (auto or 1 to 11)', default='auto')
subparser_install_autostart = subparsers.add_parser('install_autostart', help='Install custom autostart script and set what to start on boot for the ARDrone 2')
subparser_install_autostart.add_argument('type', choices=['native', 'paparazzi_raw', 'paparazzi_sdk'],
subparser_install_autostart.add_argument('type', choices=['native', 'paparazzi'],
help='what to start on boot')
subparser_autostart = subparsers.add_parser('autostart', help='Set what to start on boot for the ARDrone 2')
subparser_autostart.add_argument('type', choices=['native', 'paparazzi_raw', 'paparazzi_sdk'],
subparser_autostart.add_argument('type', choices=['native', 'paparazzi'],
help='what to start on boot')
args = parser.parse_args()
@@ -285,7 +285,7 @@ elif args.command == 'ipaddress':
# Change the wifi mode
elif args.command == 'wifimode':
ardrone2_set_wifi_mode(args.mode)
if raw_input("Shall I restart the ARDrone 2? (y/N) ").lower() == 'y':
parrot_utils.reboot(tn)
@@ -332,7 +332,7 @@ elif args.command == 'install_autostart':
ardrone2_install_autoboot()
else:
ardrone2_install_autoboot()
autorun = {'native': '0', 'paparazzi_raw': '1', 'paparazzi_sdk': '2'}
autorun = {'native': '0', 'paparazzi': '1'}
write_to_config('start_paparazzi', autorun[args.type])
print('The autostart on boot is changed to ' + args.type)
@@ -341,7 +341,7 @@ elif args.command == 'install_autostart':
# Change the autostart
elif args.command == 'autostart':
autorun = {'native': '0', 'paparazzi_raw': '1', 'paparazzi_sdk': '2'}
autorun = {'native': '0', 'paparazzi': '1'}
write_to_config('start_paparazzi', autorun[args.type])
print('The autostart on boot is changed to ' + args.type)

Some files were not shown because too many files have changed in this diff Show More