Skip to content

Commit

Permalink
[actuators] first test with 2 drivers
Browse files Browse the repository at this point in the history
- actuators are now in signed int16 (need to check size again) (int32 ?)
- servo_switch module replaces booz_drop
- booz_pwm is now handled by actuators_direct
  • Loading branch information
gautierhattenberger committed Oct 15, 2012
1 parent 184b416 commit 38d3e71
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 277 deletions.
25 changes: 9 additions & 16 deletions conf/airframes/ENAC/quadrotor/booz2_g1.xml
@@ -1,11 +1,8 @@
<airframe name="BOOZ2_G1">

<modules main_freq="512">
<!--load name="booz_pwm.xml">
<define name="USE_PWM1"/>
</load>
<load name="booz_drop.xml"/>
<load name="booz_cam.xml"/-->
<load name="servo_switch.xml"/>
<!--load name="booz_cam.xml"/-->
<!--load name="sonar_maxbotix_booz.xml"/-->
<!--load name="adc_generic_booz.xml"/-->
<!--load name="sys_mon.xml"/-->
Expand Down Expand Up @@ -54,22 +51,24 @@
</servos>

<servos driver="Pwm">
<servo name="CAM" no="0" min="1000" neutral="1500" max="2000"/>
<servo name="DROP" no="5" min="1000" neutral="1500" max="2000"/>
<servo name="CAM" no="5" min="1000" neutral="1500" max="2000"/>
<servo name="SWITCH" no="0" min="2120" neutral="1500" max="1060"/>
</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"/>
<axis name="SWITCH" failsafe_value="0"/>
</commands>

<command_laws>
<set servo="PITCH" value="@PITCH"/>
<set servo="ROLL" value="@ROLL"/>
<set servo="YAW" value="@YAW"/>
<set servo="PITCH" value="@PITCH - TRIM_PITCH"/>
<set servo="ROLL" value="@ROLL - TRIM_ROLL"/>
<set servo="YAW" value="@YAW - TRIM_YAW"/>
<set servo="THRUST" value="@THRUST"/>
<set servo="SWITCH" value="@SWITCH"/>
</command_laws>

<section name="IMU" prefix="IMU_">
Expand Down Expand Up @@ -230,12 +229,6 @@
<define name="SetPwm(_v)" value="BoozSetPwm1Value(_v)"/>
</section>

<section name="DROP">
<define name="DROP_SERVO_CLOSED" value="2120"/>
<define name="DROP_SERVO_OPEN" value="1060"/>
<!--define name="BoozDropPwm(_v)" value="BoozSetPwm0Value(_v)"/-->
</section>

<section name="MISC">
<define name="BOOZ_ANALOG_BARO_THRESHOLD" value="800"/>
<define name="FACE_REINJ_1" value="1024"/>
Expand Down
2 changes: 1 addition & 1 deletion conf/messages.xml
Expand Up @@ -737,7 +737,7 @@
</message>

<message name="ACTUATORS" id="105">
<field name="values" type="uint16[]" unit="none"/>
<field name="values" type="int16[]" unit="none"/>
</message>

<message name="BETH" id="106">
Expand Down
24 changes: 0 additions & 24 deletions conf/modules/booz_drop.xml

This file was deleted.

22 changes: 0 additions & 22 deletions conf/modules/booz_pwm.xml

This file was deleted.

12 changes: 8 additions & 4 deletions conf/modules/servo_switch.xml
Expand Up @@ -5,7 +5,7 @@
<description>Servo switch</description>
<define name="SERVO_SWITCH_ON_VALUE" value="pwm" description="servo value in usec"/>
<define name="SERVO_SWITCH_OFF_VALUE" value="pwm" description="servo value in usec"/>
<define name="SERVO_SWITCH_SERVO" value="nb" description="Id of the servo to use"/>
<define name="SERVO_SWITCH_SERVO" value="nb" description="Id of the switch command (default: COMMAND_SWITCH)"/>
</doc>
<header>
<file name="servo_switch.h"/>
Expand All @@ -17,10 +17,14 @@
<!-- these parameters should be set for that module in the airframe file unless you want the defaults
Servo value in usec
<load name="servo_switch.xml">
<define name="SERVO_SWITCH_ON_VALUE" value="2000"/>
<define name="SERVO_SWITCH_OFF_VALUE" value="1000"/>
<define name="SERVO_SWITCH_SERVO" value="SERVO_SWITCH"/>
<define name="SERVO_SWITCH_ON_VALUE" value="MAX_PPRZ"/>
<define name="SERVO_SWITCH_OFF_VALUE" value="-MAX_PPRZ"/>
<define name="SERVO_SWITCH_SERVO" value="COMMAND_SWITCH"/>
</load>
The SWITCH servo, the SWITCH command and the command_law (usually <set servo="SWITCH" value="@SWITCH"/>
must be defined correctly
The min and max positions of the servo are defined in the servo section
-->

<file name="servo_switch.c"/>
Expand Down
60 changes: 0 additions & 60 deletions sw/airborne/arch/lpc21/modules/core/booz_pwm_arch.c

This file was deleted.

46 changes: 0 additions & 46 deletions sw/airborne/arch/lpc21/modules/core/booz_pwm_arch.h

This file was deleted.

6 changes: 6 additions & 0 deletions sw/airborne/firmwares/rotorcraft/telemetry.h
Expand Up @@ -136,6 +136,12 @@
#define PERIODIC_SEND_PPM(_trans, _dev) {}
#endif

#ifdef ACTUATORS
#define PERIODIC_SEND_ACTUATORS(_trans, _dev) DOWNLINK_SEND_ACTUATORS(_trans, _dev, ACTUATORS_NB, actuators)
#else
#define PERIODIC_SEND_ACTUATORS(_trans, _dev) {}
#endif

#define PERIODIC_SEND_IMU_GYRO_SCALED(_trans, _dev) { \
DOWNLINK_SEND_IMU_GYRO_SCALED(_trans, _dev, \
&imu.gyro.p, \
Expand Down
54 changes: 0 additions & 54 deletions sw/airborne/modules/drop/booz_drop.c

This file was deleted.

38 changes: 0 additions & 38 deletions sw/airborne/modules/drop/booz_drop.h

This file was deleted.

9 changes: 3 additions & 6 deletions sw/airborne/modules/servo_switch/servo_switch.c
@@ -1,6 +1,4 @@
/*
* $Id: $
*
* Copyright (C) 2010 Flixr
*
* This file is part of paparazzi.
Expand All @@ -23,10 +21,9 @@

#include "servo_switch/servo_switch.h"
#include "generated/airframe.h"
#include "actuators.h"
#include "firmwares/rotorcraft/commands.h"

bool_t servo_switch_on;
int16_t servo_switch_value;

void servo_switch_init(void) {
servo_switch_on = FALSE;
Expand All @@ -35,7 +32,7 @@ void servo_switch_init(void) {

void servo_switch_periodic(void) {
if (servo_switch_on == TRUE)
SetServo(SERVO_SWITCH_SERVO, SERVO_SWITCH_ON_VALUE)
commands[SERVO_SWITCH_SERVO] = SERVO_SWITCH_ON_VALUE;

This comment has been minimized.

Copy link
@flixr

flixr Oct 15, 2012

Member

Why change the servo_switch module to go via commands? It was meant to set a servo directly for ease of setup (without the need to define a command).
I don't see how going via commands is beneficial here, even if you change the command from somewhere else (e.g. radio_control), it would still be overwritten in the servo_switch_periodic.
Maybe make a separate command_switch module? Or does setting servos directly not work anymore now?

This comment has been minimized.

Copy link
@gautierhattenberger

gautierhattenberger Oct 16, 2012

Author Member

With the new organization, if you want to change directly, you have to know which driver is used, which makes this module not generic enough. By going through commands, it is the command_laws that takes care of using the correct servo (I'm still need to merge FW and Rotorcraft commands...).
If you prefer, I can directly set the actuator by using the actuator array, but in this case, the command_laws must not be used, and I need to set all actuators even if their is no command_law associated.

This comment has been minimized.

Copy link
@flixr

flixr Oct 16, 2012

Member

Ok. If we keep using the command, the module should probably be renamed to command_switch or something like that, since the behaviour is different to the old servo_switch....

This comment has been minimized.

Copy link
@gautierhattenberger

gautierhattenberger Oct 16, 2012

Author Member

Finally, I think I have a better solution that allow the servo_switch to directly set actuator a7f8881

else
SetServo(SERVO_SWITCH_SERVO, SERVO_SWITCH_OFF_VALUE)
commands[SERVO_SWITCH_SERVO] = SERVO_SWITCH_OFF_VALUE;
}

0 comments on commit 38d3e71

Please sign in to comment.