forked from paparazzi/paparazzi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[boards] preliminary support for CJMCU micro board
- Loading branch information
Showing
6 changed files
with
677 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,233 @@ | ||
<!-- this is a CJMCU quadrotor, it comes with four brushed motors in an X configuration. --> | ||
|
||
<!-- | ||
The motor and rotor configuration is the following: | ||
Front | ||
^ | ||
| | ||
Motor0(NW) Motor1(NE) | ||
CW CCW | ||
\ / | ||
,___, | ||
| | | ||
| | | ||
|___| | ||
/ \ | ||
CCW CW | ||
Motor3(SW) Motor2(SE) | ||
--> | ||
|
||
<!-- | ||
Applicable configuration: | ||
airframe="airframes/examples/cjmcu.xml" | ||
radio="radios/mc24q.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" | ||
--> | ||
|
||
<airframe name="cjmcu"> | ||
|
||
<firmware name="rotorcraft"> | ||
<define name="PPRZ_TRIG_INT_COMPR_FLASH"/> | ||
<define name="PPRZ_TRIG_INT_COMPR_HIGHEST"/> | ||
<target name="ap" board="cjmcu"> | ||
<subsystem name="radio_control" type="ppm"/> | ||
<configure name="AHRS_PROPAGATE_FREQUENCY" value="500"/> | ||
</target> | ||
|
||
<target name="nps" board="pc"> | ||
<subsystem name="fdm" type="jsbsim"/> | ||
<subsystem name="radio_control" type="ppm"/> | ||
</target> | ||
|
||
<subsystem name="motor_mixing"/> | ||
<subsystem name="actuators" type="pwm"> | ||
<!-- This airframe is using the servo PWM outputs directly to drive mosfets, which in turn directly drive brushed motors. | ||
With the following settings we will be driving the motors with a 36KHz signal that should be well above anyone's hearing range. | ||
If we went with the 500Hz that woul be the default we would be hearing a very annoying high pitched sound coming from the motors. | ||
--> | ||
<!-- Setting the PWM timer base frequency to 36MHz --> | ||
<define name="PWM_BASE_FREQ" value="36000000"/> | ||
<!-- Setting the PWM interval to 36KHz --> | ||
<define name="SERVO_HZ" value="36000"/> | ||
<!--define name="USE_SERVOS_1AND2"/--> | ||
</subsystem> | ||
|
||
<subsystem name="telemetry" type="transparent"/> | ||
<subsystem name="imu" type="mpu60x0_i2c"> | ||
<configure name="IMU_MPU60X0_I2C_DEV" value="i2c1"/> | ||
<configure name="USE_MAGNETOMETER" value="FALSE"/> | ||
</subsystem> | ||
<subsystem name="gps" type="ublox"/> | ||
<subsystem name="stabilization" type="int_quat"/> | ||
<subsystem name="ahrs" type="int_cmpl_quat"/> | ||
<subsystem name="ins"/> | ||
</firmware> | ||
|
||
<modules main_freq="512"> | ||
<load name="gps_ubx_ucenter.xml"/> | ||
<load name="send_imu_mag_current.xml"/> | ||
</modules> | ||
|
||
<servos driver="Pwm"> | ||
<servo name="NW" no="0" min="0" neutral="50" max="1000"/> | ||
<servo name="NE" no="1" min="0" neutral="50" max="1000"/> | ||
<servo name="SE" no="2" min="0" neutral="50" max="1000"/> | ||
<servo name="SW" no="3" min="0" neutral="50" max="1000"/> | ||
</servos> | ||
|
||
<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> | ||
|
||
<command_laws> | ||
<call fun="motor_mixing_run(autopilot_motors_on,FALSE,values)"/> | ||
<set servo="NW" value="motor_mixing.commands[MOTOR_FRONT_LEFT]"/> | ||
<set servo="NE" value="motor_mixing.commands[MOTOR_FRONT_RIGHT]"/> | ||
<set servo="SE" value="motor_mixing.commands[MOTOR_BACK_RIGHT]"/> | ||
<set servo="SW" value="motor_mixing.commands[MOTOR_BACK_LEFT]"/> | ||
</command_laws> | ||
|
||
<section name="MIXING" prefix="MOTOR_MIXING_"> | ||
<!-- front left (CW), front right (CCW), back right (CW), back left (CCW) --> | ||
<define name="TYPE" value="QUAD_X"/> | ||
</section> | ||
|
||
<section name="IMU" prefix="IMU_"> | ||
<define name="BODY_TO_IMU_PHI" value="180." unit="deg"/> | ||
<define name="BODY_TO_IMU_THETA" value="0." unit="deg"/> | ||
<define name="BODY_TO_IMU_PSI" value="0." unit="deg"/> | ||
|
||
<define name="ACCEL_X_NEUTRAL" value="0"/> | ||
<define name="ACCEL_Y_NEUTRAL" value="0"/> | ||
<define name="ACCEL_Z_NEUTRAL" value="0"/> | ||
|
||
<!-- MAGNETO CALIBRATION DELFT --> | ||
<define name="MAG_X_NEUTRAL" value="286"/> | ||
<define name="MAG_Y_NEUTRAL" value="-72"/> | ||
<define name="MAG_Z_NEUTRAL" value="97"/> | ||
<define name="MAG_X_SENS" value="3.94431833863" integer="16"/> | ||
<define name="MAG_Y_SENS" value="4.14629702271" integer="16"/> | ||
<define name="MAG_Z_SENS" value="4.54518768636" integer="16"/> | ||
|
||
<!-- MAGNETO CURRENT CALIBRATION --> | ||
<define name="MAG_X_CURRENT_COEF" value="0.0103422023767"/> | ||
<define name="MAG_Y_CURRENT_COEF" value="0.0084568317783"/> | ||
<define name="MAG_Z_CURRENT_COEF" value="-0.01935617335"/> | ||
</section> | ||
|
||
<section name="AUTOPILOT"> | ||
<define name="MODE_STARTUP" value="AP_MODE_NAV"/> | ||
<define name="MODE_MANUAL" value="AP_MODE_ATTITUDE_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="MILLIAMP_AT_FULL_THROTTLE" value="14000"/> | ||
<define name="CATASTROPHIC_BAT_LEVEL" value="3.0" unit="V"/> | ||
<define name="CRITIC_BAT_LEVEL" value="3.3" unit="V"/> | ||
<define name="LOW_BAT_LEVEL" value="3.5" unit="V"/> | ||
<define name="MAX_BAT_LEVEL" value="4.1" unit="V"/> | ||
</section> | ||
|
||
<section name="STABILIZATION_RATE" prefix="STABILIZATION_RATE_"> | ||
<define name="SP_MAX_P" value="15000"/> | ||
<define name="SP_MAX_Q" value="15000"/> | ||
<define name="SP_MAX_R" value="15000"/> | ||
|
||
<define name="GAIN_P" value="400"/> | ||
<define name="GAIN_Q" value="400"/> | ||
<define name="GAIN_R" value="418"/> | ||
|
||
<define name="IGAIN_P" value="301"/> | ||
<define name="IGAIN_Q" value="302"/> | ||
<define name="IGAIN_R" value="303"/> | ||
</section> | ||
|
||
<section name="STABILIZATION_ATTITUDE" prefix="STABILIZATION_ATTITUDE_"> | ||
|
||
<!-- setpoints --> | ||
<define name="SP_MAX_PHI" value="45." unit="deg"/> | ||
<define name="SP_MAX_THETA" value="45." unit="deg"/> | ||
<define name="SP_MAX_PSI" value="45." unit="deg"/> | ||
<define name="SP_MAX_R" value="90." unit="deg/s"/> | ||
<define name="SP_MAX_P" value="90." unit="deg/s"/> | ||
<define name="DEADBAND_R" value="250"/> | ||
<define name="DEADBAND_A" value="250"/> | ||
|
||
<!-- reference --> | ||
<define name="REF_OMEGA_P" value="800" unit="deg/s"/> | ||
<define name="REF_ZETA_P" value="0.85"/> | ||
<define name="REF_MAX_P" value="400." unit="deg/s"/> | ||
<define name="REF_MAX_PDOT" value="RadOfDeg(8000.)"/> | ||
|
||
<define name="REF_OMEGA_Q" value="800" unit="deg/s"/> | ||
<define name="REF_ZETA_Q" value="0.85"/> | ||
<define name="REF_MAX_Q" value="400." unit="deg/s"/> | ||
<define name="REF_MAX_QDOT" value="RadOfDeg(8000.)"/> | ||
|
||
<define name="REF_OMEGA_R" value="500" unit="deg/s"/> | ||
<define name="REF_ZETA_R" value="0.85"/> | ||
<define name="REF_MAX_R" value="90." unit="deg/s"/> | ||
<define name="REF_MAX_RDOT" value="RadOfDeg(900.)"/> | ||
|
||
<!-- feedback --> | ||
<define name="PHI_PGAIN" value="400"/> | ||
<define name="PHI_DGAIN" value="200"/> | ||
<define name="PHI_IGAIN" value="100"/> | ||
|
||
<define name="THETA_PGAIN" value="400"/> | ||
<define name="THETA_DGAIN" value="200"/> | ||
<define name="THETA_IGAIN" value="100"/> | ||
|
||
<define name="PSI_PGAIN" value="500"/> | ||
<define name="PSI_DGAIN" value="300"/> | ||
<define name="PSI_IGAIN" value="10"/> | ||
|
||
<!-- feedforward --> | ||
<define name="PHI_DDGAIN" value="0"/> | ||
<define name="THETA_DDGAIN" value="0"/> | ||
<define name="PSI_DDGAIN" value=" 300"/> | ||
|
||
<define name="PHI_AGAIN" value="0"/> | ||
<define name="THETA_AGAIN" value="0"/> | ||
<define name="PSI_AGAIN" value="0"/> | ||
</section> | ||
|
||
<section name="INS" prefix="INS_"> | ||
</section> | ||
|
||
<section name="GUIDANCE_V" prefix="GUIDANCE_V_"> | ||
<define name="HOVER_KP" value="276"/> | ||
<define name="HOVER_KD" value="455"/> | ||
<define name="HOVER_KI" value="100"/> | ||
<define name="GUIDANCE_V_NOMINAL_HOVER_THROTTLE" value="0.5"/> | ||
</section> | ||
|
||
<section name="AHRS" prefix="AHRS_"> | ||
<define name="H_X" value=" 0.47577"/> | ||
<define name="H_Y" value=" 0.11811"/> | ||
<define name="H_Z" value=" 0.87161"/> | ||
</section> | ||
|
||
<section name="GUIDANCE_H" prefix="GUIDANCE_H_"> | ||
<define name="PGAIN" value="39"/> | ||
<define name="DGAIN" value="50"/> | ||
<define name="IGAIN" value="19"/> | ||
</section> | ||
|
||
<section name="SIMULATOR" prefix="NPS_"> | ||
<define name="ACTUATOR_NAMES" value="nw_motor, ne_motor, se_motor, sw_motor" type="string[]"/> | ||
<define name="JSBSIM_MODEL" value="simple_x_quad_ccw" type="string"/> | ||
<define name="SENSORS_PARAMS" value="nps_sensors_params_default.h" type="string"/> | ||
</section> | ||
|
||
</airframe> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Hey Emacs, this is a -*- makefile -*- | ||
# | ||
# cjmcu.makefile | ||
# | ||
# https://github.com/cleanflight/cleanflight/issues/22 | ||
# http://blog.oscarliang.net/build-fpv-micro-quadcopter-smallest-quad | ||
# hw rev2 ? | ||
# | ||
|
||
BOARD=cjmcu | ||
BOARD_CFG=\"boards/$(BOARD).h\" | ||
|
||
ARCH=stm32 | ||
$(TARGET).ARCHDIR = $(ARCH) | ||
# not needed? | ||
$(TARGET).OOCD_INTERFACE=flossjtag | ||
$(TARGET).LDSCRIPT=$(SRC_ARCH)/cjmcu.ld | ||
|
||
# ----------------------------------------------------------------------- | ||
|
||
# default flash mode is via SWD | ||
# other possibilities: DFU-UTIL, JTAG, SWD, STLINK, SERIAL | ||
FLASH_MODE ?= SWD | ||
|
||
HAS_LUFTBOOT ?= 0 | ||
ifeq (,$(findstring $(HAS_LUFTBOOT),0 FALSE)) | ||
$(TARGET).CFLAGS+=-DLUFTBOOT | ||
$(TARGET).LDFLAGS+=-Wl,-Ttext=0x8002000 | ||
endif | ||
|
||
# | ||
# | ||
# some default values shared between different firmwares | ||
# | ||
# | ||
|
||
|
||
# | ||
# default LED configuration | ||
# | ||
RADIO_CONTROL_LED ?= none | ||
BARO_LED ?= none | ||
AHRS_ALIGNER_LED ?= 1 | ||
GPS_LED ?= 2 | ||
SYS_TIME_LED ?= 3 | ||
|
||
|
||
# | ||
# default uart configuration | ||
# | ||
RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT ?= UART3 | ||
RADIO_CONTROL_SPEKTRUM_SECONDARY_PORT ?= UART1 | ||
|
||
MODEM_PORT ?= UART1 | ||
MODEM_BAUD ?= B57600 | ||
|
||
GPS_PORT ?= UART3 | ||
GPS_BAUD ?= B38400 | ||
|
||
|
||
# | ||
# default actuator configuration | ||
# | ||
# you can use different actuators by adding a configure option to your firmware section | ||
# e.g. <configure name="ACTUATORS" value="actuators_ppm/> | ||
# and by setting the correct "driver" attribute in servo section | ||
# e.g. <servo driver="Ppm"> | ||
# | ||
ACTUATORS ?= actuators_pwm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Hey Emacs, this is a -*- makefile -*- | ||
* | ||
* Copyright (C) 2015 Martin Mueller <[email protected]> | ||
* | ||
* 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. | ||
*/ | ||
|
||
/* Linker script for CJMCU Quad (STM32F103CBT6, 128K flash, 20K RAM). */ | ||
|
||
/* Define memory regions. */ | ||
MEMORY | ||
{ | ||
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K | ||
/* Use entire memory, no flash for stored settings */ | ||
rom (rx) : ORIGIN = 0x08000000, LENGTH = 128K | ||
} | ||
|
||
/* Include the common ld script. */ | ||
INCLUDE libopencm3_stm32f1.ld |
Oops, something went wrong.