mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 13:55:40 +08:00
Merge branch 'master' into dev
* merged the baro board stuff for navgo * still needs to be fixed for the new spi transactions
This commit is contained in:
@@ -1,98 +0,0 @@
|
|||||||
# Copyright (C) 2003-2011 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.
|
|
||||||
|
|
||||||
|
|
||||||
Intro
|
|
||||||
-----
|
|
||||||
|
|
||||||
Paparazzi is an attempt to develop a free software Unmanned (Air) Vehicle System.
|
|
||||||
As of today the system is being used successfuly by a number of hobyists, universities and companies all over the world, on vehicle of various size ( 100g to 25Kg ) and of various nature ( fixed wing, rotorcrafts, boats and surface vehicles).
|
|
||||||
|
|
||||||
Up to date information is available from the wiki website
|
|
||||||
|
|
||||||
http://paparazzi.enac.fr
|
|
||||||
|
|
||||||
and from the mailing list (http://savannah.nongnu.org/mail/?group=paparazzi)
|
|
||||||
and the IRC channel (freenode, #paparazzi).
|
|
||||||
|
|
||||||
Directories quick and dirty description:
|
|
||||||
---------------------------------------
|
|
||||||
|
|
||||||
conf: the configuration directory (airframe, radio, ... descriptions).
|
|
||||||
|
|
||||||
data: where to put read-only data (e.g. maps, terrain elevation files, icons)
|
|
||||||
|
|
||||||
sw: software (onboard, ground station, simulation, ...)
|
|
||||||
|
|
||||||
var: products of compilation, cache for the map tiles, ...
|
|
||||||
|
|
||||||
debian: Debian packaging control files
|
|
||||||
|
|
||||||
|
|
||||||
Required Software
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
Installation is described in the wiki (paparazzi.enac.fr/wiki/Installation).
|
|
||||||
Main requirements include
|
|
||||||
- OCaml (ocaml.org), xml-light library (http://tech.motion-twin.com/xmllight)
|
|
||||||
- gcc, GTK2, Glib2, libgnomecanvas, libxml2
|
|
||||||
- ARM7 micro-controller development environnment (gcc, loader, libc, binutils)
|
|
||||||
- ...
|
|
||||||
|
|
||||||
For Debian or Ubuntu users, required packages are available at
|
|
||||||
|
|
||||||
http://paparazzi.enac.fr/debian
|
|
||||||
|
|
||||||
|
|
||||||
- "paparazzi-dev" will provide everything needed to compile and run the ground segment and the simulator. If something is missing, please report it.
|
|
||||||
- "paparazzi-arm-multilib" is required to compile the code for LPC21 and STM32 based boards
|
|
||||||
- "paparazzi-omap" is needed for building code for the optional Gumstix Overo module available on lisa/L
|
|
||||||
|
|
||||||
- "paparazzi-jsbsim" is needed for using jsbsim as flight dynamic model for the simulator.
|
|
||||||
|
|
||||||
Compilation and demo simulation
|
|
||||||
-------------------------------
|
|
||||||
|
|
||||||
1) type "make" in the top directory to compile all the libraries and tools.
|
|
||||||
|
|
||||||
2) "./paparazzi" to run the Paparazzi Center
|
|
||||||
|
|
||||||
3) Select the "Microjet" aircraft in the upper-left A/C
|
|
||||||
combo box. Select "sim" from upper-middle "target" combo box. Click
|
|
||||||
"Build". When the compilation is finished, select "Simulation" from
|
|
||||||
the upper-right session combo box and click "Execute".
|
|
||||||
|
|
||||||
4) In the GCS, wait about 10s for the aircraft to be in the "Holding
|
|
||||||
point" navigation block. Switch to the "Takeoff" block (lower-left
|
|
||||||
blue airway button in the strip). Takeoff with the green launch button.
|
|
||||||
|
|
||||||
Uploading of the embedded software
|
|
||||||
----------------------------------
|
|
||||||
|
|
||||||
1) Power the flight controller board while it is connected to the PC with
|
|
||||||
the USB cable.
|
|
||||||
|
|
||||||
2) From the Paparazzi center, select the "ap" target, and click "Upload".
|
|
||||||
|
|
||||||
|
|
||||||
Flight
|
|
||||||
-------------------------------------
|
|
||||||
|
|
||||||
1) From the Paparazzi Center, select the flight session and ... do
|
|
||||||
the same than in simulation !
|
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
Paparazzi UAS
|
||||||
|
=============
|
||||||
|
|
||||||
|
Paparazzi is an attempt to develop a free software Unmanned (Air) Vehicle System.
|
||||||
|
As of today the system is being used successfuly by a number of hobyists, universities and companies all over the world, on vehicle of various size ( 100g to 25Kg ) and of various nature ( fixed wing, rotorcrafts, boats and surface vehicles).
|
||||||
|
|
||||||
|
Up to date information is available in the wiki http://paparazzi.enac.fr
|
||||||
|
|
||||||
|
and from the mailing list [paparazzi-devel@nongnu.org] (http://savannah.nongnu.org/mail/?group=paparazzi)
|
||||||
|
and the IRC channel (freenode, #paparazzi).
|
||||||
|
|
||||||
|
|
||||||
|
Required Software
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Installation is described in the wiki (http://paparazzi.enac.fr/wiki/Installation).
|
||||||
|
|
||||||
|
For Ubuntu users, required packages are available in the [paparazzi-uav PPA] (https://launchpad.net/~paparazzi-uav/+archive/ppa),
|
||||||
|
Debian users can use http://paparazzi.enac.fr/debian
|
||||||
|
|
||||||
|
|
||||||
|
- **paparazzi-dev** is the meta-package that depends on everything needed to compile and run the ground segment and the simulator.
|
||||||
|
- **paparazzi-arm-multilib** ARM cross-compiling toolchain for LPC21 and STM32 based boards.
|
||||||
|
- **paparazzi-omap** toolchain for the optional Gumstix Overo module available on lisa/L.
|
||||||
|
- **paparazzi-jsbsim** is needed for using JSBSim as flight dynamic model for the simulator.
|
||||||
|
|
||||||
|
|
||||||
|
Directories quick and dirty description:
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
_conf_: the configuration directory (airframe, radio, ... descriptions).
|
||||||
|
|
||||||
|
_data_: where to put read-only data (e.g. maps, terrain elevation files, icons)
|
||||||
|
|
||||||
|
_doc_: documentation (diagrams, manual source files, ...)
|
||||||
|
|
||||||
|
_sw_: software (onboard, ground station, simulation, ...)
|
||||||
|
|
||||||
|
_var_: products of compilation, cache for the map tiles, ...
|
||||||
|
|
||||||
|
|
||||||
|
Compilation and demo simulation
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
|
1. type "make" in the top directory to compile all the libraries and tools.
|
||||||
|
|
||||||
|
2. "./paparazzi" to run the Paparazzi Center
|
||||||
|
|
||||||
|
3. Select the "Microjet" aircraft in the upper-left A/C combo box.
|
||||||
|
Select "sim" from upper-middle "target" combo box. Click "Build".
|
||||||
|
When the compilation is finished, select "Simulation" from
|
||||||
|
the upper-right session combo box and click "Execute".
|
||||||
|
|
||||||
|
4. In the GCS, wait about 10s for the aircraft to be in the "Holding point" navigation block.
|
||||||
|
Switch to the "Takeoff" block (lower-left blue airway button in the strip).
|
||||||
|
Takeoff with the green launch button.
|
||||||
|
|
||||||
|
Uploading of the embedded software
|
||||||
|
----------------------------------
|
||||||
|
|
||||||
|
1. Power the flight controller board while it is connected to the PC with the USB cable.
|
||||||
|
|
||||||
|
2. From the Paparazzi center, select the "ap" target, and click "Upload".
|
||||||
|
|
||||||
|
|
||||||
|
Flight
|
||||||
|
------
|
||||||
|
|
||||||
|
1. From the Paparazzi Center, select the flight session and ... do the same than in simulation !
|
||||||
@@ -14,10 +14,10 @@
|
|||||||
<!--load name="infrared_i2c.xml"/-->
|
<!--load name="infrared_i2c.xml"/-->
|
||||||
<!--load name="max3100.xml"/>
|
<!--load name="max3100.xml"/>
|
||||||
<load name="gsm.xml"/-->
|
<load name="gsm.xml"/-->
|
||||||
<load name="demo_module.xml">
|
<!--load name="demo_module.xml">
|
||||||
<define name="TEST" value="1"/>
|
<define name="TEST" value="1"/>
|
||||||
<define name="TEST_FLAG"/>
|
<define name="TEST_FLAG"/>
|
||||||
</load>
|
</load-->
|
||||||
<!--load name="enose.xml"/-->
|
<!--load name="enose.xml"/-->
|
||||||
<load name="light.xml"/>
|
<load name="light.xml"/>
|
||||||
<load name="infrared_adc.xml"/>
|
<load name="infrared_adc.xml"/>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
<subsystem name="radio_control" type="ppm"/>
|
<subsystem name="radio_control" type="ppm"/>
|
||||||
<subsystem name="telemetry" type="xbee_api"/>
|
<subsystem name="telemetry" type="xbee_api"/>
|
||||||
<subsystem name="control" type="new"/>
|
<subsystem name="control" type="adaptive"/>
|
||||||
<subsystem name="ahrs" type="infrared"/>
|
<subsystem name="ahrs" type="infrared"/>
|
||||||
<subsystem name="gps" type="ublox"/>
|
<subsystem name="gps" type="ublox"/>
|
||||||
<subsystem name="navigation"/>
|
<subsystem name="navigation"/>
|
||||||
@@ -217,103 +217,4 @@
|
|||||||
<define name="YAW_RESPONSE_FACTOR" value="1."/>
|
<define name="YAW_RESPONSE_FACTOR" value="1."/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!--
|
|
||||||
<makefile>
|
|
||||||
CONFIG = \"tiny_2_1_1.h\"
|
|
||||||
|
|
||||||
include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile
|
|
||||||
|
|
||||||
FLASH_MODE=IAP
|
|
||||||
|
|
||||||
ap.CFLAGS += -DFBW -DAP -DBOARD_CONFIG=$(CONFIG) -DUSE_LED -DSYS_TIME_LED=1
|
|
||||||
ap.srcs = mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c main_fbw.c main_ap.c main.c
|
|
||||||
|
|
||||||
ap.CFLAGS += -DINTER_MCU
|
|
||||||
ap.srcs += inter_mcu.c
|
|
||||||
|
|
||||||
ap.srcs += commands.c
|
|
||||||
|
|
||||||
########## RC actuators + radio
|
|
||||||
ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017
|
|
||||||
ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c
|
|
||||||
|
|
||||||
ap.CFLAGS += -DRADIO_CONTROL
|
|
||||||
ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c
|
|
||||||
|
|
||||||
########## Modems
|
|
||||||
ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600
|
|
||||||
ap.srcs += subsystems/datalink/downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c subsystems/datalink/xbee.c
|
|
||||||
|
|
||||||
#TRANSPARENT
|
|
||||||
#ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1 -DPPRZ_UART=Uart1 -DDATALINK=PPRZ -DUART1_BAUD=B9600
|
|
||||||
#ap.srcs += subsystems/datalink/downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c subsystems/datalink/pprz_transport.c
|
|
||||||
|
|
||||||
########## ADC
|
|
||||||
ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3
|
|
||||||
ap.srcs += $(SRC_ARCH)/adc_hw.c
|
|
||||||
|
|
||||||
########## GPS
|
|
||||||
ap.CFLAGS += -DUSE_GPS -DUBX -DUSE_UART0 -DGPS_LINK=Uart0 -DUART0_BAUD=B38400 -DGPS_USE_LATLONG
|
|
||||||
# -DGPS_LED=2
|
|
||||||
ap.srcs += gps_ubx.c gps.c latlong.c
|
|
||||||
|
|
||||||
########## IR sensors
|
|
||||||
ap.CFLAGS += -DUSE_INFRARED -DALT_KALMAN
|
|
||||||
ap.srcs += infrared.c estimator.c
|
|
||||||
|
|
||||||
########## Gyro
|
|
||||||
#ap.CFLAGS += -DUSE_GYRO -DADXRS150
|
|
||||||
#ap.srcs += gyro.c
|
|
||||||
|
|
||||||
########## Nav
|
|
||||||
ap.CFLAGS += -DNAV -DAGR_CLIMB -DPITCH_TRIM
|
|
||||||
ap.srcs += subsystems/nav.c fw_h_ctl_a.c fw_v_ctl_n.c
|
|
||||||
ap.srcs += subsystems/navigation/nav_survey_rectangle.c
|
|
||||||
ap.srcs += subsystems/navigation/nav_line.c
|
|
||||||
|
|
||||||
########## SPI Master use slave0
|
|
||||||
ap.CFLAGS += -DUSE_SPI -DSPI_MASTER -DUSE_SPI_SLAVE0
|
|
||||||
ap.srcs += spi.c $(SRC_ARCH)/spi_hw.c
|
|
||||||
|
|
||||||
########## Barometer (SPI)
|
|
||||||
#ap.CFLAGS += -DUSE_BARO_MS5534A
|
|
||||||
#ap.srcs += $(SRC_ARCH)/baro_MS5534A.c
|
|
||||||
|
|
||||||
########## I2C0
|
|
||||||
ap.CFLAGS += -DUSE_I2C0
|
|
||||||
ap.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
|
|
||||||
|
|
||||||
########## Lights
|
|
||||||
ap.CFLAGS += -DUSE_LIGHT
|
|
||||||
ap.srcs += light.c
|
|
||||||
|
|
||||||
########## Max3100
|
|
||||||
ap.CFLAGS += -DMAX3100_BAUD_RATE=MAX3100_B9600
|
|
||||||
|
|
||||||
ap.CFLAGS += -DGCS_NUMBER=\"+33640286530\"
|
|
||||||
|
|
||||||
ap.CFLAGS += -DUSE_MODULES
|
|
||||||
|
|
||||||
# Config for SITL simulation
|
|
||||||
#include $(PAPARAZZI_SRC)/conf/autopilot/sitl.makefile
|
|
||||||
|
|
||||||
sim.ARCHDIR = $(ARCHI)
|
|
||||||
sim.CFLAGS += -DSITL -DAP -DFBW -DRADIO_CONTROL -DINTER_MCU -DDOWNLINK -DDOWNLINK_TRANSPORT=IvyTransport -DUSE_INFRARED -DNAV -DUSE_LED -DWIND_INFO
|
|
||||||
sim.srcs = latlong.c radio_control.c subsystems/datalink/downlink.c commands.c gps.c inter_mcu.c infrared.c fw_h_ctl_a.c fw_v_ctl_n.c subsystems/nav.c estimator.c mcu_periph/sys_time.c main_fbw.c main_ap.c datalink.c $(SRC_ARCH)/ppm_hw.c $(SRC_ARCH)/sim_gps.c $(SRC_ARCH)/sim_ir.c $(SRC_ARCH)/sim_ap.c $(SRC_ARCH)/ivy_transport.c $(SRC_ARCH)/sim_adc_generic.c $(SRC_ARCH)/led_hw.c
|
|
||||||
|
|
||||||
sim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DAGR_CLIMB -DPITCH_TRIM -DALT_KALMAN
|
|
||||||
|
|
||||||
sim.srcs += subsystems/navigation/nav_line.c subsystems/navigation/nav_survey_rectangle.c
|
|
||||||
|
|
||||||
sim.CFLAGS += -DUSE_LIGHT
|
|
||||||
sim.srcs += light.c
|
|
||||||
|
|
||||||
sim.CFLAGS += -DUSE_I2C0
|
|
||||||
sim.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
|
|
||||||
|
|
||||||
sim.CFLAGS += -DUSE_MODULES
|
|
||||||
|
|
||||||
</makefile>
|
|
||||||
-->
|
|
||||||
|
|
||||||
</airframe>
|
</airframe>
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<airframe name="Blender">
|
<airframe name="Blender">
|
||||||
|
|
||||||
<modules main_freq="512">
|
<modules main_freq="512">
|
||||||
<load name="booz_pwm.xml">
|
<!--load name="booz_pwm.xml">
|
||||||
<define name="USE_PWM1"/>
|
<define name="USE_PWM1"/>
|
||||||
</load>
|
</load>
|
||||||
<load name="booz_drop.xml"/>
|
<load name="booz_drop.xml"/>
|
||||||
<load name="booz_cam.xml"/>
|
<load name="booz_cam.xml"/-->
|
||||||
<!--load name="sonar_maxbotix_booz.xml"/-->
|
<!--load name="sonar_maxbotix_booz.xml"/-->
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
@@ -21,13 +21,13 @@
|
|||||||
</target>
|
</target>
|
||||||
<target name="sim" board="pc">
|
<target name="sim" board="pc">
|
||||||
<subsystem name="fdm" type="nps"/>
|
<subsystem name="fdm" type="nps"/>
|
||||||
<!--define name="NPS_NO_SUPERVISION"/-->
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<subsystem name="radio_control" type="ppm"/>
|
<subsystem name="radio_control" type="ppm"/>
|
||||||
<subsystem name="telemetry" type="transparent"/>
|
<subsystem name="telemetry" type="transparent"/>
|
||||||
<subsystem name="actuators" type="asctec"/>
|
<subsystem name="actuators" type="skiron">
|
||||||
<!--subsystem name="actuators" type="mkk"/-->
|
<define name="SKIRON_I2C_SCL_TIME" value="25"/>
|
||||||
|
</subsystem>
|
||||||
<subsystem name="imu" type="b2_v1.1"/>
|
<subsystem name="imu" type="b2_v1.1"/>
|
||||||
<subsystem name="gps" type="ublox">
|
<subsystem name="gps" type="ublox">
|
||||||
<configure name="GPS_BAUD" value="B57600"/>
|
<configure name="GPS_BAUD" value="B57600"/>
|
||||||
@@ -47,17 +47,11 @@
|
|||||||
</firmware>
|
</firmware>
|
||||||
|
|
||||||
<servos min="0" neutral="0" max="0xff">
|
<servos min="0" neutral="0" max="0xff">
|
||||||
<servo name="PITCH" no="0" min="0" neutral="0" max="255"/>
|
|
||||||
<servo name="ROLL" no="1" min="0" neutral="0" max="255"/>
|
|
||||||
<servo name="YAW" no="2" min="0" neutral="0" max="255"/>
|
|
||||||
<servo name="THRUST" no="3" min="0" neutral="0" max="255"/>
|
|
||||||
</servos>
|
|
||||||
<!--servos min="0" neutral="0" max="0xff">
|
|
||||||
<servo name="FRONT" no="0" min="0" neutral="0" max="255"/>
|
<servo name="FRONT" no="0" min="0" neutral="0" max="255"/>
|
||||||
<servo name="BACK" no="1" min="0" neutral="0" max="255"/>
|
<servo name="BACK" no="2" min="0" neutral="0" max="255"/>
|
||||||
<servo name="RIGHT" no="2" min="0" neutral="0" max="255"/>
|
<servo name="RIGHT" no="1" min="0" neutral="0" max="255"/>
|
||||||
<servo name="LEFT" no="3" min="0" neutral="0" max="255"/>
|
<servo name="LEFT" no="3" min="0" neutral="0" max="255"/>
|
||||||
</servos-->
|
</servos>
|
||||||
|
|
||||||
<commands>
|
<commands>
|
||||||
<axis name="PITCH" failsafe_value="0"/>
|
<axis name="PITCH" failsafe_value="0"/>
|
||||||
@@ -66,20 +60,15 @@
|
|||||||
<axis name="THRUST" failsafe_value="0"/>
|
<axis name="THRUST" failsafe_value="0"/>
|
||||||
</commands>
|
</commands>
|
||||||
|
|
||||||
<!--section name="ACTUATORS_MKK" prefix="ACTUATORS_MKK_">
|
<section name="ACTUATORS_SKIRON" prefix="ACTUATORS_SKIRON_">
|
||||||
<define name="NB" value="4"/>
|
<define name="NB" value="4"/>
|
||||||
<define name="ADDR" value="{ 0x52, 0x56, 0x54, 0x58 }"/>
|
<define name="IDX" value="{ SERVO_FRONT, SERVO_BACK, SERVO_RIGHT, SERVO_LEFT }"/>
|
||||||
</section-->
|
</section>
|
||||||
|
|
||||||
<section name="SUPERVISION" prefix="SUPERVISION_">
|
<section name="SUPERVISION" prefix="SUPERVISION_">
|
||||||
<define name="TRIM_A" value="0"/>
|
<define name="MIN_MOTOR" value="20"/>
|
||||||
<define name="TRIM_E" value="0"/>
|
<define name="MAX_MOTOR" value="255"/>
|
||||||
<define name="TRIM_R" value="0"/>
|
<define name="TRIM_A" value="6"/>
|
||||||
</section>
|
|
||||||
<!--section name="SUPERVISION" prefix="SUPERVISION_">
|
|
||||||
<define name="MIN_MOTOR" value="25"/>
|
|
||||||
<define name="MAX_MOTOR" value="243"/>
|
|
||||||
<define name="TRIM_A" value="0"/>
|
|
||||||
<define name="TRIM_E" value="0"/>
|
<define name="TRIM_E" value="0"/>
|
||||||
<define name="TRIM_R" value="0"/>
|
<define name="TRIM_R" value="0"/>
|
||||||
<define name="NB_MOTOR" value="4"/>
|
<define name="NB_MOTOR" value="4"/>
|
||||||
@@ -88,8 +77,7 @@
|
|||||||
<define name="PITCH_COEF" value="{ 256, -256, 0, 0}"/>
|
<define name="PITCH_COEF" value="{ 256, -256, 0, 0}"/>
|
||||||
<define name="YAW_COEF" value="{ -256, -256, 256, 256}"/>
|
<define name="YAW_COEF" value="{ -256, -256, 256, 256}"/>
|
||||||
<define name="THRUST_COEF" value="{ 256, 256, 256, 256}"/>
|
<define name="THRUST_COEF" value="{ 256, 256, 256, 256}"/>
|
||||||
</section-->
|
</section>
|
||||||
|
|
||||||
|
|
||||||
<section name="IMU" prefix="IMU_">
|
<section name="IMU" prefix="IMU_">
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
</target>
|
</target>
|
||||||
<target name="sim" board="pc">
|
<target name="sim" board="pc">
|
||||||
<subsystem name="fdm" type="nps"/>
|
<subsystem name="fdm" type="nps"/>
|
||||||
<!--define name="NPS_NO_SUPERVISION"/-->
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<subsystem name="radio_control" type="ppm"/>
|
<subsystem name="radio_control" type="ppm"/>
|
||||||
@@ -29,11 +28,11 @@
|
|||||||
<define name="SKIRON_I2C_SCL_TIME" value="25"/>
|
<define name="SKIRON_I2C_SCL_TIME" value="25"/>
|
||||||
</subsystem>
|
</subsystem>
|
||||||
<subsystem name="imu" type="navgo"/>
|
<subsystem name="imu" type="navgo"/>
|
||||||
<subsystem name="gps" type="ublox"/>
|
<subsystem name="gps" type="ublox">
|
||||||
<subsystem name="stabilization" type="euler"/>
|
<configure name="GPS_BAUD" value="B57600"/>
|
||||||
<subsystem name="ahrs" type="int_cmpl_euler">
|
|
||||||
<define name="LOW_NOISE_THRESHOLD" value="50000"/>
|
|
||||||
</subsystem>
|
</subsystem>
|
||||||
|
<subsystem name="stabilization" type="euler"/>
|
||||||
|
<subsystem name="ahrs" type="int_cmpl_euler"/>
|
||||||
<subsystem name="ins" type="hff"/>
|
<subsystem name="ins" type="hff"/>
|
||||||
</firmware>
|
</firmware>
|
||||||
|
|
||||||
@@ -72,31 +71,39 @@
|
|||||||
|
|
||||||
<section name="IMU" prefix="IMU_">
|
<section name="IMU" prefix="IMU_">
|
||||||
|
|
||||||
<define name="GYRO_P_NEUTRAL" value="-126"/>
|
<define name="GYRO_P_NEUTRAL" value="10"/>
|
||||||
<define name="GYRO_Q_NEUTRAL" value="-29"/>
|
<define name="GYRO_Q_NEUTRAL" value="-32"/>
|
||||||
<define name="GYRO_R_NEUTRAL" value="-32"/>
|
<define name="GYRO_R_NEUTRAL" value="11"/>
|
||||||
|
|
||||||
<!-- SENS ITG3200 1/14.375 (deg/s)/LSB, rate frac 12bit => 1/14.375 * pi / 180 * 2^12 -->
|
<!-- SENS ITG3200 1/14.375 (deg/s)/LSB, rate frac 12bit => 1/14.375 * pi / 180 * 2^12 -->
|
||||||
<define name="GYRO_P_SENS" value="4.97312" integer="16"/>
|
<define name="GYRO_P_SENS" value="4.97312" integer="16"/>
|
||||||
<define name="GYRO_Q_SENS" value="4.97312" integer="16"/>
|
<define name="GYRO_Q_SENS" value="4.97312" integer="16"/>
|
||||||
<define name="GYRO_R_SENS" value="4.97312" integer="16"/>
|
<define name="GYRO_R_SENS" value="4.97312" integer="16"/>
|
||||||
|
|
||||||
<define name="ACCEL_X_NEUTRAL" value="4"/>
|
<define name="ACCEL_X_NEUTRAL" value="9"/>
|
||||||
<define name="ACCEL_Y_NEUTRAL" value="-17"/>
|
<define name="ACCEL_Y_NEUTRAL" value="14"/>
|
||||||
<define name="ACCEL_Z_NEUTRAL" value="-22"/>
|
<define name="ACCEL_Z_NEUTRAL" value="-16"/>
|
||||||
|
|
||||||
<!-- SENS ADXL345 16G 31.2 mg/LSB, accel frac 10bit => 31.2 * 2^10 / 1000 = 31.9488-->
|
<!-- SENS ADXL345 16G 31.2 mg/LSB, accel frac 10bit => 31.2 * 2^10 / 1000 = 31.9488-->
|
||||||
<define name="ACCEL_X_SENS" value="38.2816633245" integer="16"/>
|
<define name="ACCEL_X_SENS" value="38.5866088465" integer="16"/>
|
||||||
<define name="ACCEL_Y_SENS" value="38.7857058923" integer="16"/>
|
<define name="ACCEL_Y_SENS" value="38.7212932023" integer="16"/>
|
||||||
<define name="ACCEL_Z_SENS" value="39.7459254023" integer="16"/>
|
<define name="ACCEL_Z_SENS" value="39.403098907" integer="16"/>
|
||||||
|
|
||||||
<define name="MAG_X_NEUTRAL" value="85"/>
|
<define name="MAG_X_NEUTRAL" value="80"/>
|
||||||
<define name="MAG_Y_NEUTRAL" value="97"/>
|
<define name="MAG_Y_NEUTRAL" value="-271"/>
|
||||||
<define name="MAG_Z_NEUTRAL" value="-43"/>
|
<define name="MAG_Z_NEUTRAL" value="112"/>
|
||||||
|
|
||||||
|
<define name="MAG_X_SENS" value="4.44131219218" integer="16"/>
|
||||||
|
<define name="MAG_Y_SENS" value="4.56234629213" integer="16"/>
|
||||||
|
<define name="MAG_Z_SENS" value="5.298653926" integer="16"/>
|
||||||
|
|
||||||
|
<!--define name="MAG_X_NEUTRAL" value="0"/>
|
||||||
|
<define name="MAG_Y_NEUTRAL" value="0"/>
|
||||||
|
<define name="MAG_Z_NEUTRAL" value="0"/>
|
||||||
|
|
||||||
<define name="MAG_X_SENS" value="5.43371021972" integer="16"/>
|
<define name="MAG_X_SENS" value="5.43371021972" integer="16"/>
|
||||||
<define name="MAG_Y_SENS" value="4.8961742578" integer="16"/>
|
<define name="MAG_Y_SENS" value="4.8961742578" integer="16"/>
|
||||||
<define name="MAG_Z_SENS" value="5.31527656902" integer="16"/>
|
<define name="MAG_Z_SENS" value="5.31527656902" integer="16"/-->
|
||||||
|
|
||||||
<define name="BODY_TO_IMU_PHI" value="0." unit="deg"/> <!-- -10 -->
|
<define name="BODY_TO_IMU_PHI" value="0." unit="deg"/> <!-- -10 -->
|
||||||
<define name="BODY_TO_IMU_THETA" value="0." unit="deg"/> <!-- -10 -->
|
<define name="BODY_TO_IMU_THETA" value="0." unit="deg"/> <!-- -10 -->
|
||||||
@@ -124,6 +131,8 @@
|
|||||||
<define name="ACCEL_Y_SENS" value="38.7108" integer="16"/>
|
<define name="ACCEL_Y_SENS" value="38.7108" integer="16"/>
|
||||||
<define name="ACCEL_Z_SENS" value="39.6583" integer="16"/>
|
<define name="ACCEL_Z_SENS" value="39.6583" integer="16"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<define name="MAG_X_NEUTRAL" value="55"/>
|
<define name="MAG_X_NEUTRAL" value="55"/>
|
||||||
<define name="MAG_Y_NEUTRAL" value="54"/>
|
<define name="MAG_Y_NEUTRAL" value="54"/>
|
||||||
<define name="MAG_Z_NEUTRAL" value="92"/>
|
<define name="MAG_Z_NEUTRAL" value="92"/>
|
||||||
@@ -148,7 +157,8 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section name="INS" prefix="INS_">
|
<section name="INS" prefix="INS_">
|
||||||
<define name="BARO_SENS" value="14" integer="16"/>
|
<!-- 1.4 mm/LSB : 0.0014*2^8 = 0.3584 -->
|
||||||
|
<define name="BARO_SENS" value="1.156" integer="16"/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -145,9 +145,11 @@ ap.CFLAGS += -DUSE_I2C2
|
|||||||
else ifeq ($(BOARD), lisa_m)
|
else ifeq ($(BOARD), lisa_m)
|
||||||
ap.CFLAGS += -DUSE_I2C2
|
ap.CFLAGS += -DUSE_I2C2
|
||||||
else ifeq ($(BOARD), navgo)
|
else ifeq ($(BOARD), navgo)
|
||||||
ap.CFLAGS += -DUSE_I2C1
|
include $(CFG_ROTORCRAFT)/spi.makefile
|
||||||
ap.CFLAGS += -DADS1114_I2C_DEVICE=i2c1
|
ap.CFLAGS += -DUSE_SPI_SLAVE0
|
||||||
ap.srcs += peripherals/ads1114.c
|
ap.CFLAGS += -DSPI_NO_UNSELECT_SLAVE
|
||||||
|
ap.CFLAGS += -DSPI_MASTER
|
||||||
|
ap.srcs += peripherals/mcp355x.c
|
||||||
endif
|
endif
|
||||||
ifneq ($(BARO_LED),none)
|
ifneq ($(BARO_LED),none)
|
||||||
ap.CFLAGS += -DROTORCRAFT_BARO_LED=$(BARO_LED)
|
ap.CFLAGS += -DROTORCRAFT_BARO_LED=$(BARO_LED)
|
||||||
|
|||||||
@@ -12,10 +12,12 @@ IMU_NAVGO_CFLAGS += -DUSE_I2C1 -DI2C1_SCLL=25 -DI2C1_SCLH=25
|
|||||||
IMU_NAVGO_CFLAGS += -DITG3200_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
|
IMU_NAVGO_CFLAGS += -DITG3200_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
|
||||||
IMU_NAVGO_CFLAGS += -DITG3200_I2C_ADDR=ITG3200_ADDR_ALT
|
IMU_NAVGO_CFLAGS += -DITG3200_I2C_ADDR=ITG3200_ADDR_ALT
|
||||||
IMU_NAVGO_CFLAGS += -DITG3200_SMPLRT_DIV=1
|
IMU_NAVGO_CFLAGS += -DITG3200_SMPLRT_DIV=1
|
||||||
|
IMU_NAVGO_CFLAGS += -DITG3200_DLFP_CFG=5
|
||||||
IMU_NAVGO_SRCS += peripherals/itg3200.c
|
IMU_NAVGO_SRCS += peripherals/itg3200.c
|
||||||
|
|
||||||
IMU_NAVGO_CFLAGS += -DADXL345_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
|
IMU_NAVGO_CFLAGS += -DADXL345_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
|
||||||
IMU_NAVGO_CFLAGS += -DADXL345_I2C_ADDR=ADXL345_ADDR_ALT
|
IMU_NAVGO_CFLAGS += -DADXL345_I2C_ADDR=ADXL345_ADDR_ALT
|
||||||
|
IMU_NAVGO_CFLAGS += -DADXL345_BW_RATE=0x8
|
||||||
IMU_NAVGO_SRCS += peripherals/adxl345.i2c.c
|
IMU_NAVGO_SRCS += peripherals/adxl345.i2c.c
|
||||||
|
|
||||||
IMU_NAVGO_CFLAGS += -DHMC58XX_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
|
IMU_NAVGO_CFLAGS += -DHMC58XX_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
|
||||||
|
|||||||
@@ -193,7 +193,9 @@ void SPI1_ISR(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (bit_is_set(SSPMIS, RTMIS)) { /* Rx fifo is not empty and no receive took place in the last 32 bits period */
|
if (bit_is_set(SSPMIS, RTMIS)) { /* Rx fifo is not empty and no receive took place in the last 32 bits period */
|
||||||
|
#if !SPI_NO_UNSELECT_SLAVE
|
||||||
SpiUnselectCurrentSlave();
|
SpiUnselectCurrentSlave();
|
||||||
|
#endif
|
||||||
SpiReceive();
|
SpiReceive();
|
||||||
SpiDisableRti();
|
SpiDisableRti();
|
||||||
SpiClearRti(); /* clear interrupt */
|
SpiClearRti(); /* clear interrupt */
|
||||||
|
|||||||
@@ -27,57 +27,43 @@
|
|||||||
|
|
||||||
#include "subsystems/sensors/baro.h"
|
#include "subsystems/sensors/baro.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
|
#include "mcu_periph/spi.h"
|
||||||
|
|
||||||
/* Common Baro struct */
|
/* Common Baro struct */
|
||||||
struct Baro baro;
|
struct Baro baro;
|
||||||
|
|
||||||
/* Number of values to compute an offset at startup */
|
/* Counter to init mcp355x at startup */
|
||||||
#define OFFSET_NBSAMPLES_AVRG 300
|
#define STARTUP_COUNTER 200
|
||||||
uint16_t offset_cnt;
|
uint16_t startup_cnt;
|
||||||
|
|
||||||
#if USE_BARO_AS_ALTIMETER
|
|
||||||
/* Weight for offset IIR filter */
|
|
||||||
#define OFFSET_FILTER 7
|
|
||||||
|
|
||||||
float baro_alt;
|
|
||||||
float baro_alt_offset;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void baro_init( void ) {
|
void baro_init( void ) {
|
||||||
ads1114_init();
|
mcp355x_init();
|
||||||
|
SpiSelectSlave0(); // never unselect this slave (continious conversion mode)
|
||||||
baro.status = BS_UNINITIALIZED;
|
baro.status = BS_UNINITIALIZED;
|
||||||
baro.absolute = 0;
|
baro.absolute = 0;
|
||||||
baro.differential = 0; /* not handled on this board */
|
baro.differential = 0; /* not handled on this board */
|
||||||
#ifdef ROTORCRAFT_BARO_LED
|
#ifdef ROTORCRAFT_BARO_LED
|
||||||
LED_OFF(ROTORCRAFT_BARO_LED);
|
LED_OFF(ROTORCRAFT_BARO_LED);
|
||||||
#endif
|
#endif
|
||||||
offset_cnt = OFFSET_NBSAMPLES_AVRG;
|
startup_cnt = STARTUP_COUNTER;
|
||||||
#if USE_BARO_AS_ALTIMETER
|
|
||||||
baro_alt = 0.;
|
|
||||||
baro_alt_offset = 0.;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void baro_periodic( void ) {
|
void baro_periodic( void ) {
|
||||||
|
|
||||||
if (baro.status == BS_UNINITIALIZED) {
|
if (baro.status == BS_UNINITIALIZED) {
|
||||||
#if USE_BARO_AS_ALTIMETER
|
// Run some loops to get correct readings from the adc
|
||||||
// IIR filter to compute an initial offset
|
--startup_cnt;
|
||||||
baro_alt_offset = (OFFSET_FILTER * baro_alt_offset + (float)baro.absolute) / (OFFSET_FILTER + 1);
|
|
||||||
#endif
|
|
||||||
// decrease init counter
|
|
||||||
--offset_cnt;
|
|
||||||
#ifdef ROTORCRAFT_BARO_LED
|
#ifdef ROTORCRAFT_BARO_LED
|
||||||
LED_TOGGLE(ROTORCRAFT_BARO_LED);
|
LED_TOGGLE(ROTORCRAFT_BARO_LED);
|
||||||
#endif
|
#endif
|
||||||
if (offset_cnt == 0) {
|
if (startup_cnt == 0) {
|
||||||
baro.status = BS_RUNNING;
|
baro.status = BS_RUNNING;
|
||||||
#ifdef ROTORCRAFT_BARO_LED
|
#ifdef ROTORCRAFT_BARO_LED
|
||||||
LED_ON(ROTORCRAFT_BARO_LED);
|
LED_ON(ROTORCRAFT_BARO_LED);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Read the ADC
|
// Read the ADC (at 50/4 Hz, conversion time is 68 ms)
|
||||||
ads1114_read();
|
RunOnceEvery(4,mcp355x_read());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,22 +31,16 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "std.h"
|
#include "std.h"
|
||||||
#include "peripherals/ads1114.h"
|
#include "peripherals/mcp355x.h"
|
||||||
|
|
||||||
#if USE_BARO_AS_ALTIMETER
|
|
||||||
extern float baro_alt;
|
|
||||||
extern float baro_alt_offset;
|
|
||||||
#define BaroAltHandler() { baro_alt = BARO_SENS*(baro_alt_offset - (float)baro.absolute); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define BARO_FILTER_GAIN 5
|
#define BARO_FILTER_GAIN 5
|
||||||
|
|
||||||
#define BaroEvent(_b_abs_handler, _b_diff_handler) { \
|
#define BaroEvent(_b_abs_handler, _b_diff_handler) { \
|
||||||
Ads1114Event(); \
|
mcp355x_event(); \
|
||||||
if (ads1114_data_available) { \
|
if (mcp355x_data_available) { \
|
||||||
baro.absolute = (baro.absolute + BARO_FILTER_GAIN*Ads1114GetValue()) / (BARO_FILTER_GAIN+1); \
|
baro.absolute = (baro.absolute + BARO_FILTER_GAIN*mcp355x_data) / (BARO_FILTER_GAIN+1); \
|
||||||
_b_abs_handler(); \
|
_b_abs_handler(); \
|
||||||
ads1114_data_available = FALSE; \
|
mcp355x_data_available = FALSE; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ void imu_navgo_event( void )
|
|||||||
// If the itg3200 I2C transaction has succeeded: convert the data
|
// If the itg3200 I2C transaction has succeeded: convert the data
|
||||||
itg3200_event();
|
itg3200_event();
|
||||||
if (itg3200_data_available) {
|
if (itg3200_data_available) {
|
||||||
RATES_COPY(imu.gyro_unscaled, itg3200_data);
|
RATES_ASSIGN(imu.gyro_unscaled, -itg3200_data.q, itg3200_data.p, itg3200_data.r);
|
||||||
itg3200_data_available = FALSE;
|
itg3200_data_available = FALSE;
|
||||||
gyr_valid = TRUE;
|
gyr_valid = TRUE;
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ void imu_navgo_event( void )
|
|||||||
// HMC58XX event task
|
// HMC58XX event task
|
||||||
hmc58xx_event();
|
hmc58xx_event();
|
||||||
if (hmc58xx_data_available) {
|
if (hmc58xx_data_available) {
|
||||||
VECT3_ASSIGN(imu.mag_unscaled, -hmc58xx_data.x, -hmc58xx_data.y, hmc58xx_data.z);
|
VECT3_ASSIGN(imu.mag_unscaled, hmc58xx_data.x, hmc58xx_data.y, hmc58xx_data.z);
|
||||||
hmc58xx_data_available = FALSE;
|
hmc58xx_data_available = FALSE;
|
||||||
mag_valid = TRUE;
|
mag_valid = TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,17 +18,17 @@
|
|||||||
#define PCLK (CCLK / PBSD_VAL)
|
#define PCLK (CCLK / PBSD_VAL)
|
||||||
|
|
||||||
/* Onboard LEDs */
|
/* Onboard LEDs */
|
||||||
#define LED_1_BANK 1
|
#define LED_1_BANK 0
|
||||||
#define LED_1_PIN 25
|
#define LED_1_PIN 22
|
||||||
|
|
||||||
#define LED_2_BANK 1
|
#define LED_2_BANK 1
|
||||||
#define LED_2_PIN 24
|
#define LED_2_PIN 28
|
||||||
|
|
||||||
#define LED_3_BANK 1
|
#define LED_3_BANK 1
|
||||||
#define LED_3_PIN 23
|
#define LED_3_PIN 29
|
||||||
|
|
||||||
#define LED_4_BANK 1
|
#define LED_4_BANK 1
|
||||||
#define LED_4_PIN 31
|
#define LED_4_PIN 30
|
||||||
|
|
||||||
/* PPM : rc rx on P0.28 ( CAP0.2 ) */
|
/* PPM : rc rx on P0.28 ( CAP0.2 ) */
|
||||||
#define PPM_PINSEL PINSEL1
|
#define PPM_PINSEL PINSEL1
|
||||||
@@ -45,19 +45,22 @@
|
|||||||
/* battery */
|
/* battery */
|
||||||
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
|
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
|
||||||
#ifndef ADC_CHANNEL_VSUPPLY
|
#ifndef ADC_CHANNEL_VSUPPLY
|
||||||
#define ADC_CHANNEL_VSUPPLY AdcBank1(3)
|
#define ADC_CHANNEL_VSUPPLY AdcBank0(2)
|
||||||
#ifndef USE_AD1
|
#ifndef USE_AD0
|
||||||
#define USE_AD1
|
#define USE_AD0
|
||||||
#endif
|
#endif
|
||||||
#define USE_AD1_3
|
#define USE_AD0_2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DefaultVoltageOfAdc(adc) (0.01837*adc)
|
#define DefaultVoltageOfAdc(adc) (0.017889*adc)
|
||||||
|
|
||||||
/* SPI (SSP) */
|
/* SPI (SSP) */
|
||||||
#define SPI_SELECT_SLAVE0_PORT 0
|
#define SPI_SELECT_SLAVE0_PORT 0
|
||||||
#define SPI_SELECT_SLAVE0_PIN 20
|
#define SPI_SELECT_SLAVE0_PIN 20
|
||||||
|
|
||||||
|
//#define SPI_SELECT_SLAVE1_PORT 1
|
||||||
|
//#define SPI_SELECT_SLAVE1_PIN 19
|
||||||
|
|
||||||
#define SPI1_DRDY_PINSEL PINSEL1
|
#define SPI1_DRDY_PINSEL PINSEL1
|
||||||
#define SPI1_DRDY_PINSEL_BIT 0
|
#define SPI1_DRDY_PINSEL_BIT 0
|
||||||
#define SPI1_DRDY_PINSEL_VAL 1
|
#define SPI1_DRDY_PINSEL_VAL 1
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# Build shared pprz math library
|
||||||
|
#
|
||||||
|
|
||||||
|
CC= gcc
|
||||||
|
CFLAGS= -fpic
|
||||||
|
INCLUDES= -I $(PAPARAZZI_SRC)/sw/include -I $(PAPARAZZI_SRC)/sw/airborne
|
||||||
|
|
||||||
|
# build in ../../../var/build/math
|
||||||
|
ifndef BUILDDIR
|
||||||
|
BUILDDIR=../../../var/build/math
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef PREFIX
|
||||||
|
PREFIX=/usr
|
||||||
|
endif
|
||||||
|
LIB_INSTALLDIR=${PREFIX}/lib
|
||||||
|
INCLUDE_INSTALLDIR=${PREFIX}/include/pprz
|
||||||
|
PKGCONFIG_INSTALLDIR=${PREFIX}/lib/pkgconfig
|
||||||
|
PKGCONFIG_FILE=pprzmath.pc
|
||||||
|
|
||||||
|
SRC= $(wildcard *.c)
|
||||||
|
OBJ= $(addprefix $(BUILDDIR)/,$(SRC:.c=.o))
|
||||||
|
|
||||||
|
LIBNAME=libpprzmath
|
||||||
|
|
||||||
|
all:
|
||||||
|
@cat README
|
||||||
|
|
||||||
|
shared_lib: $(OBJ)
|
||||||
|
$(CC) -shared -o $(BUILDDIR)/$(LIBNAME).so $(OBJ)
|
||||||
|
|
||||||
|
install_shared_lib: shared_lib
|
||||||
|
test -d $(LIB_INSTALLDIR) || mkdir -p $(LIB_INSTALLDIR)
|
||||||
|
cp $(BUILDDIR)/$(LIBNAME).so $(LIB_INSTALLDIR)
|
||||||
|
test -d $(INCLUDE_INSTALLDIR)/math || mkdir -p $(INCLUDE_INSTALLDIR)/math
|
||||||
|
cp *.h $(INCLUDE_INSTALLDIR)/math
|
||||||
|
cp ../../include/std.h $(INCLUDE_INSTALLDIR)
|
||||||
|
test -d $(PKGCONFIG_INSTALLDIR) || mkdir -p $(PKGCONFIG_INSTALLDIR)
|
||||||
|
sed -e 's#PREFIX#$(PREFIX)#g' $(PKGCONFIG_FILE).in > $(PKGCONFIG_INSTALLDIR)/$(PKGCONFIG_FILE)
|
||||||
|
|
||||||
|
$(BUILDDIR)/%.o: %.c
|
||||||
|
test -d $(BUILDDIR) || mkdir -p $(BUILDDIR)
|
||||||
|
$(CC) -c $< $(CFLAGS) $(INCLUDES) -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(BUILDDIR)/*.o $(BUILDDIR)/$(LIBNAME).so
|
||||||
|
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
Math lib used in all airborne code of paparazzi
|
||||||
|
|
||||||
|
HOWTO install a shared library to use in other projects
|
||||||
|
|
||||||
|
1. Build library: in this folder, type
|
||||||
|
make shared_lib
|
||||||
|
|
||||||
|
the default build directory is var/build/math
|
||||||
|
to change it: BUILDDIR=<your_build_dir> make shared_lib
|
||||||
|
|
||||||
|
2. Install library: in this folder, type
|
||||||
|
make install_shared_lib
|
||||||
|
|
||||||
|
the default install dir is /usr
|
||||||
|
and will install files in
|
||||||
|
/usr/lib
|
||||||
|
/usr/lib/pkgconfig
|
||||||
|
/usr/include/pprz
|
||||||
|
|
||||||
|
to change the install dir: PREFIX=<your_install_dir> make install_shared_lib
|
||||||
|
|
||||||
|
note that the default install dir needs root privilege
|
||||||
|
|
||||||
|
HOWTO use the shared library
|
||||||
|
|
||||||
|
1. with pkg-config --cflags --libs
|
||||||
|
|
||||||
|
2. by hand:
|
||||||
|
LIBS: -L<prefix>/lib -lpprzmath
|
||||||
|
CFLAGS: -I<prefix>/include/pprz
|
||||||
|
|
||||||
|
|
||||||
|
"make clean" will only clean the build directory
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
prefix=PREFIX
|
||||||
|
exec_prefix=${prefix}
|
||||||
|
libdir=${exec_prefix}/lib
|
||||||
|
includedir=${exec_prefix}/include
|
||||||
|
Name: pprzmath
|
||||||
|
Description: math library used in Paparazzi project (http://paparazzi.enac.fr)
|
||||||
|
Version:0.1
|
||||||
|
Libs: -L${libdir} -lpprzmath
|
||||||
|
Cflags: -I${includedir}/pprz
|
||||||
@@ -41,32 +41,20 @@ void mcp355x_init(void) {
|
|||||||
void mcp355x_read(void) {
|
void mcp355x_read(void) {
|
||||||
spi_buffer_length = 4;
|
spi_buffer_length = 4;
|
||||||
spi_buffer_input = mcp355x_spi_buf;
|
spi_buffer_input = mcp355x_spi_buf;
|
||||||
SpiSelectSlave0();
|
//SpiSelectSlave0();
|
||||||
SpiStart();
|
SpiStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DOWNLINK_DEVICE
|
|
||||||
#define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "mcu_periph/uart.h"
|
|
||||||
#include "messages.h"
|
|
||||||
#include "subsystems/datalink/downlink.h"
|
|
||||||
|
|
||||||
void mcp355x_event(void) {
|
void mcp355x_event(void) {
|
||||||
static uint32_t filtered = 0;
|
|
||||||
if (spi_message_received) {
|
if (spi_message_received) {
|
||||||
spi_message_received = FALSE;
|
spi_message_received = FALSE;
|
||||||
if ((mcp355x_spi_buf[0]>>4) == 0) {
|
if ((mcp355x_spi_buf[0]>>4) == 0) {
|
||||||
//mcp355x_data = (int32_t)(((uint32_t)mcp355x_spi_buf[0]<<16) | ((uint32_t)mcp355x_spi_buf[1]<<8) | (mcp355x_spi_buf[2]));
|
|
||||||
mcp355x_data = (int32_t)(
|
mcp355x_data = (int32_t)(
|
||||||
((uint32_t)mcp355x_spi_buf[0]<<17) |
|
((uint32_t)mcp355x_spi_buf[0]<<17) |
|
||||||
((uint32_t)mcp355x_spi_buf[1]<<9) |
|
((uint32_t)mcp355x_spi_buf[1]<<9) |
|
||||||
((uint32_t)mcp355x_spi_buf[2]<<1) |
|
((uint32_t)mcp355x_spi_buf[2]<<1) |
|
||||||
(mcp355x_spi_buf[3]>>7));
|
(mcp355x_spi_buf[3]>>7));
|
||||||
filtered = (5*filtered + mcp355x_data) / (6);
|
mcp355x_data_available = TRUE;
|
||||||
DOWNLINK_SEND_DEBUG(DefaultChannel, DefaultDevice,4,mcp355x_spi_buf);
|
|
||||||
DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice,&mcp355x_data,&filtered);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,13 +75,14 @@ class track = fun ?(name="Noname") ?(size = 500) ?(color="red") (geomap:MapCanva
|
|||||||
(** rectangle representing the field covered by the cam *)
|
(** rectangle representing the field covered by the cam *)
|
||||||
let _ac_cam_targeted =
|
let _ac_cam_targeted =
|
||||||
ignore ( GnoCanvas.ellipse ~x1: (-. 2.5) ~y1: (-. 2.5 ) ~x2: 2.5 ~y2: 2.5 ~fill_color:color ~props:[`WIDTH_UNITS 1.; `OUTLINE_COLOR color; `FILL_STIPPLE (Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\002\001")] cam) in
|
ignore ( GnoCanvas.ellipse ~x1: (-. 2.5) ~y1: (-. 2.5 ) ~x2: 2.5 ~y2: 2.5 ~fill_color:color ~props:[`WIDTH_UNITS 1.; `OUTLINE_COLOR color; `FILL_STIPPLE (Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\002\001")] cam) in
|
||||||
|
let _ = cam#hide () in
|
||||||
|
|
||||||
let mission_target = GnoCanvas.group group in
|
let mission_target = GnoCanvas.group group in
|
||||||
|
|
||||||
(** red circle : target of the mission *)
|
(** red circle : target of the mission *)
|
||||||
let ac_mission_target =
|
let _ac_mission_target =
|
||||||
GnoCanvas.ellipse ~x1: (-5.) ~y1: (-5.) ~x2: 5. ~y2: 5. ~fill_color:"red" ~props:[`WIDTH_UNITS 1.; `OUTLINE_COLOR "red"; `FILL_STIPPLE (Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\002\001")] mission_target in
|
ignore ( GnoCanvas.ellipse ~x1: (-5.) ~y1: (-5.) ~x2: 5. ~y2: 5. ~fill_color:"red" ~props:[`WIDTH_UNITS 1.; `OUTLINE_COLOR "red"; `FILL_STIPPLE (Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\002\001")] mission_target) in
|
||||||
let _ = ac_mission_target#hide () in
|
let _ = mission_target#hide () in
|
||||||
|
|
||||||
(** data at map scale *)
|
(** data at map scale *)
|
||||||
let max_cam_half_height_scaled = 10000.0 in
|
let max_cam_half_height_scaled = 10000.0 in
|
||||||
@@ -92,6 +93,8 @@ class track = fun ?(name="Noname") ?(size = 500) ?(color="red") (geomap:MapCanva
|
|||||||
let _desired_circle = GnoCanvas.ellipse group
|
let _desired_circle = GnoCanvas.ellipse group
|
||||||
and _desired_segment = GnoCanvas.line group in
|
and _desired_segment = GnoCanvas.line group in
|
||||||
|
|
||||||
|
let _ = aircraft#raise_to_top () in
|
||||||
|
|
||||||
object (self)
|
object (self)
|
||||||
val mutable top = 0
|
val mutable top = 0
|
||||||
val mutable color = color
|
val mutable color = color
|
||||||
|
|||||||
+37
-27
@@ -80,6 +80,7 @@ type status =
|
|||||||
|
|
||||||
class plot = fun ~size ~width ~height ~packing () ->
|
class plot = fun ~size ~width ~height ~packing () ->
|
||||||
let curves = Hashtbl.create 3 in
|
let curves = Hashtbl.create 3 in
|
||||||
|
let bindings = Hashtbl.create 3 in
|
||||||
object (self)
|
object (self)
|
||||||
inherit Gtk_tools.pixmap_in_drawin_area ~width ~height ~packing () as pm
|
inherit Gtk_tools.pixmap_in_drawin_area ~width ~height ~packing () as pm
|
||||||
|
|
||||||
@@ -142,15 +143,21 @@ class plot = fun ~size ~width ~height ~packing () ->
|
|||||||
size <- new_size
|
size <- new_size
|
||||||
end
|
end
|
||||||
|
|
||||||
method create_curve = fun (name:string) ->
|
method create_curve = fun (name:string) binding ->
|
||||||
let color = colors.(color_index) in
|
let color = colors.(color_index) in
|
||||||
let values = create_values size color in
|
let values = create_values size color in
|
||||||
color_index <- (color_index+1) mod Array.length colors;
|
color_index <- (color_index+1) mod Array.length colors;
|
||||||
Hashtbl.add curves name values;
|
Hashtbl.add curves name values;
|
||||||
|
Hashtbl.add bindings name binding;
|
||||||
values
|
values
|
||||||
|
|
||||||
method delete_curve = fun name ->
|
method delete_curve = fun name ->
|
||||||
Hashtbl.remove curves name
|
Hashtbl.remove curves name;
|
||||||
|
try (* this try should not be needed *)
|
||||||
|
let binding = Hashtbl.find bindings name in
|
||||||
|
Ivy.unbind binding;
|
||||||
|
Hashtbl.remove bindings name
|
||||||
|
with _ -> ()
|
||||||
|
|
||||||
method add_value = fun name v ->
|
method add_value = fun name v ->
|
||||||
if status <> Stop then
|
if status <> Stop then
|
||||||
@@ -244,8 +251,7 @@ class plot = fun ~size ~width ~height ~packing () ->
|
|||||||
|
|
||||||
let margin = 3 in
|
let margin = 3 in
|
||||||
let title_y = ref margin in
|
let title_y = ref margin in
|
||||||
Hashtbl.iter
|
Hashtbl.iter (fun title a ->
|
||||||
(fun title a ->
|
|
||||||
(* Draw and compute average and stdev*)
|
(* Draw and compute average and stdev*)
|
||||||
let curve = ref []
|
let curve = ref []
|
||||||
and sum = ref 0. and sum_squares = ref 0.
|
and sum = ref 0. and sum_squares = ref 0.
|
||||||
@@ -339,26 +345,32 @@ let rec plot_window = fun window ->
|
|||||||
|
|
||||||
(* Register the window *)
|
(* Register the window *)
|
||||||
let oid = plotter#get_oid in
|
let oid = plotter#get_oid in
|
||||||
Hashtbl.add windows oid ();
|
Hashtbl.add windows oid [];
|
||||||
|
|
||||||
ignore (plotter#parse_geometry window.geometry);
|
ignore (plotter#parse_geometry window.geometry);
|
||||||
plotter#set_icon (Some (GdkPixbuf.from_file Env.icon_file));
|
plotter#set_icon (Some (GdkPixbuf.from_file Env.icon_file));
|
||||||
let vbox = GPack.vbox ~packing:plotter#add () in
|
let vbox = GPack.vbox ~packing:plotter#add () in
|
||||||
let quit = fun () -> GMain.Main.quit (); exit 0 in
|
|
||||||
|
|
||||||
let close = fun () ->
|
|
||||||
plotter#destroy ();
|
|
||||||
Hashtbl.remove windows oid;
|
|
||||||
if Hashtbl.length windows = 0 then
|
|
||||||
quit () in
|
|
||||||
|
|
||||||
let tooltips = GData.tooltips () in
|
|
||||||
|
|
||||||
let menubar = GMenu.menu_bar ~packing:vbox#pack () in
|
let menubar = GMenu.menu_bar ~packing:vbox#pack () in
|
||||||
let factory = new GMenu.factory menubar in
|
let factory = new GMenu.factory menubar in
|
||||||
let accel_group = factory#accel_group in
|
let accel_group = factory#accel_group in
|
||||||
let file_menu = factory#add_submenu "Plot" in
|
let file_menu = factory#add_submenu "Plot" in
|
||||||
let file_menu_fact = new GMenu.factory file_menu ~accel_group in
|
let file_menu_fact = new GMenu.factory file_menu ~accel_group in
|
||||||
|
let h = GPack.hbox ~packing:vbox#pack () in
|
||||||
|
let curves_menu = factory#add_submenu "Curves" in
|
||||||
|
let curves_menu_fact = new GMenu.factory curves_menu in
|
||||||
|
let tooltips = GData.tooltips () in
|
||||||
|
|
||||||
|
let width = 900 and height = 200 in
|
||||||
|
let plot = new plot ~size: !size ~width ~height ~packing:(vbox#pack ~expand:true) () in
|
||||||
|
|
||||||
|
let quit = fun () -> GMain.Main.quit (); exit 0 in
|
||||||
|
|
||||||
|
let close = fun () ->
|
||||||
|
List.iter (fun c -> plot#delete_curve c) (Hashtbl.find windows oid);
|
||||||
|
plotter#destroy ();
|
||||||
|
Hashtbl.remove windows oid;
|
||||||
|
if Hashtbl.length windows = 0 then
|
||||||
|
quit () in
|
||||||
|
|
||||||
ignore (file_menu_fact#add_item "New" ~key:GdkKeysyms._N ~callback:(fun () -> plot_window {window with curves=[]}));
|
ignore (file_menu_fact#add_item "New" ~key:GdkKeysyms._N ~callback:(fun () -> plot_window {window with curves=[]}));
|
||||||
|
|
||||||
@@ -369,18 +381,12 @@ let rec plot_window = fun window ->
|
|||||||
ignore (file_menu_fact#add_separator ());
|
ignore (file_menu_fact#add_separator ());
|
||||||
ignore (file_menu_fact#add_item "Close" ~key:GdkKeysyms._W ~callback:close);
|
ignore (file_menu_fact#add_item "Close" ~key:GdkKeysyms._W ~callback:close);
|
||||||
ignore (file_menu_fact#add_item "Quit" ~key:GdkKeysyms._Q ~callback:quit);
|
ignore (file_menu_fact#add_item "Quit" ~key:GdkKeysyms._Q ~callback:quit);
|
||||||
let curves_menu = factory#add_submenu "Curves" in
|
|
||||||
let curves_menu_fact = new GMenu.factory curves_menu in
|
|
||||||
tooltips#set_tip reset_item#coerce ~text:"Reset the current display and the current data";
|
tooltips#set_tip reset_item#coerce ~text:"Reset the current display and the current data";
|
||||||
tooltips#set_tip curves_menu#coerce ~text:"Delete the curve";
|
tooltips#set_tip curves_menu#coerce ~text:"Delete the curve";
|
||||||
tooltips#set_tip suspend_item#coerce ~text:"Freeze the display while the data are still updated";
|
tooltips#set_tip suspend_item#coerce ~text:"Freeze the display while the data are still updated";
|
||||||
tooltips#set_tip stop_item#coerce ~text:"Freeze the data update while the display is active (e.g. resizable)";
|
tooltips#set_tip stop_item#coerce ~text:"Freeze the data update while the display is active (e.g. resizable)";
|
||||||
tooltips#set_tip start_item#coerce ~text:"UnFreeze";
|
tooltips#set_tip start_item#coerce ~text:"UnFreeze";
|
||||||
|
|
||||||
let h = GPack.hbox ~packing:vbox#pack () in
|
|
||||||
|
|
||||||
let width = 900 and height = 200 in
|
|
||||||
let plot = new plot ~size: !size ~width ~height ~packing:(vbox#pack ~expand:true) () in
|
|
||||||
tooltips#set_tip plot#drawing_area#coerce ~text:"Drop a messages field here to draw it";
|
tooltips#set_tip plot#drawing_area#coerce ~text:"Drop a messages field here to draw it";
|
||||||
ignore (plotter#connect#destroy ~callback:close);
|
ignore (plotter#connect#destroy ~callback:close);
|
||||||
|
|
||||||
@@ -449,7 +455,6 @@ let rec plot_window = fun window ->
|
|||||||
let delete_item = submenu_fact#add_item "Delete" in
|
let delete_item = submenu_fact#add_item "Delete" in
|
||||||
let delete = fun () ->
|
let delete = fun () ->
|
||||||
plot#delete_curve name;
|
plot#delete_curve name;
|
||||||
Ivy.unbind binding;
|
|
||||||
curves_menu#remove (curve_item :> GMenu.menu_item) in
|
curves_menu#remove (curve_item :> GMenu.menu_item) in
|
||||||
ignore (delete_item#connect#activate ~callback:delete);
|
ignore (delete_item#connect#activate ~callback:delete);
|
||||||
|
|
||||||
@@ -471,7 +476,8 @@ let rec plot_window = fun window ->
|
|||||||
let _item = submenu_fact#add_image_item ~image:stdev_value#coerce ~label:"Stdev" () in
|
let _item = submenu_fact#add_image_item ~image:stdev_value#coerce ~label:"Stdev" () in
|
||||||
let update_stdev_value = fun () ->
|
let update_stdev_value = fun () ->
|
||||||
stdev_value#set_text (sprintf "%.6f" curve.stdev#value) in
|
stdev_value#set_text (sprintf "%.6f" curve.stdev#value) in
|
||||||
ignore (curve.stdev#connect#value_changed update_stdev_value) in
|
ignore (curve.stdev#connect#value_changed update_stdev_value)
|
||||||
|
in
|
||||||
|
|
||||||
let add_curve = fun ?(factor=(1.,0.)) name ->
|
let add_curve = fun ?(factor=(1.,0.)) name ->
|
||||||
let (a, b) = factor in
|
let (a, b) = factor in
|
||||||
@@ -483,8 +489,7 @@ let rec plot_window = fun window ->
|
|||||||
let (field_name, index) = base_and_index field_descr in
|
let (field_name, index) = base_and_index field_descr in
|
||||||
let value =
|
let value =
|
||||||
match Pprz.assoc field_name values with
|
match Pprz.assoc field_name values with
|
||||||
Pprz.Array array ->
|
Pprz.Array array -> array.(index)
|
||||||
array.(index)
|
|
||||||
| scalar -> scalar in
|
| scalar -> scalar in
|
||||||
let float = pprz_float value in
|
let float = pprz_float value in
|
||||||
let v = float *. a +. b in
|
let v = float *. a +. b in
|
||||||
@@ -497,8 +502,13 @@ let rec plot_window = fun window ->
|
|||||||
else
|
else
|
||||||
P.message_bind ~sender msg_name cb in
|
P.message_bind ~sender msg_name cb in
|
||||||
|
|
||||||
let curve = plot#create_curve name in
|
let curve = plot#create_curve name binding in
|
||||||
insert_in_menu curve name binding in
|
insert_in_menu curve name binding;
|
||||||
|
|
||||||
|
(* store name of the curves associated to a window correct closing *)
|
||||||
|
let curves_name = Hashtbl.find windows oid in
|
||||||
|
Hashtbl.replace windows oid (curves_name @ [name])
|
||||||
|
in
|
||||||
|
|
||||||
(* Drag and drop handler *)
|
(* Drag and drop handler *)
|
||||||
let data_received = fun context ~x ~y data ~info ~time ->
|
let data_received = fun context ~x ~y data ~info ~time ->
|
||||||
|
|||||||
Reference in New Issue
Block a user