Skip to content

Commit

Permalink
[motor_mixing] old supervision
Browse files Browse the repository at this point in the history
- rename supervision to motor_mixing
- split into a separated subsystem
- pwm_supervision is now pwm direct + motor mixing
  • Loading branch information
gautierhattenberger committed Oct 18, 2012
1 parent bb15ef1 commit cdbdf91
Show file tree
Hide file tree
Showing 19 changed files with 242 additions and 287 deletions.
19 changes: 10 additions & 9 deletions conf/airframes/ENAC/quadrotor/blender.xml
Expand Up @@ -29,6 +29,7 @@
<subsystem name="actuators" type="skiron">
<define name="SKIRON_I2C_SCL_TIME" value="25"/>
</subsystem>
<subsystem name="motor_mixing"/>
<subsystem name="actuators" type="direct">
<define name="USE_PWM0"/>
</subsystem>
Expand All @@ -41,10 +42,10 @@
<subsystem name="ins" type="hff"/>
</firmware>

<section name="SUPERVISION" prefix="SUPERVISION_">
<define name="TRIM_A" value="-50"/>
<define name="TRIM_E" value="-150"/>
<define name="TRIM_R" value="-100"/>
<section name="MIXING" prefix="MOTOR_MIXING_">
<define name="TRIM_ROLL" value="-50"/>
<define name="TRIM_PITCH" value="-150"/>
<define name="TRIM_YAW" value="-100"/>
<define name="NB_MOTOR" value="4"/>
<define name="SCALE" value="256"/>
<define name="ROLL_COEF" value="{ 0, -256, 0, 256}"/>
Expand Down Expand Up @@ -72,11 +73,11 @@
</commands>

<command_laws>
<call fun="supervision_run(autopilot_motors_on,FALSE,values)"/>
<set servo="FRONT" value="supervision.commands[SERVO_FRONT]"/>
<set servo="BACK" value="supervision.commands[SERVO_BACK]"/>
<set servo="RIGHT" value="supervision.commands[SERVO_RIGHT]"/>
<set servo="LEFT" value="supervision.commands[SERVO_LEFT]"/>
<call fun="motor_mixing_run(autopilot_motors_on,FALSE,values)"/>
<set servo="FRONT" value="motor_mixing.commands[SERVO_FRONT]"/>
<set servo="BACK" value="motor_mixing.commands[SERVO_BACK]"/>
<set servo="RIGHT" value="motor_mixing.commands[SERVO_RIGHT]"/>
<set servo="LEFT" value="motor_mixing.commands[SERVO_LEFT]"/>
</command_laws>

<section name="IMU" prefix="IMU_">
Expand Down
16 changes: 3 additions & 13 deletions conf/firmwares/subsystems/shared/actuators_asctec_v2.makefile
@@ -1,21 +1,12 @@
# asctec controllers v2
#
# <section name="SUPERVISION" prefix="SUPERVISION_">
# <define name="TRIM_A" value="2"/>
# <define name="TRIM_E" value="-1"/>
# <define name="TRIM_R" value="3"/>
# <define name="NB_MOTOR" value="4"/>
# <define name="SCALE" value="256"/>
# <define name="ROLL_COEF" value="{ 0, 0, -256, 256}"/>
# <define name="PITCH_COEF" value="{ 256, -256, 0, 0}"/>
# <define name="YAW_COEF" value="{-256, -256, 256, 256}"/>
# <define name="THRUST_COEF" value="{ 256, 256, 256, 256}"/>
# </section>
# required xml configuration:
#
# servo section with driver="Asctec"
# command_laws section to map motor_mixing commands to servos
#

$(TARGET).CFLAGS += -DACTUATORS
ap.srcs += subsystems/actuators/supervision.c
ap.CFLAGS += -DACTUATORS_ASCTEC_V2_PROTOCOL
ap.srcs += subsystems/actuators/actuators_asctec.c

Expand All @@ -30,6 +21,5 @@ ap.CFLAGS += -DUSE_I2C1
endif

# Simulator
nps.srcs += subsystems/actuators/supervision.c
nps.srcs += subsystems/actuators/actuators_asctec.c
nps.CFLAGS += -DUSE_I2C0 -DACTUATORS_ASCTEC_DEVICE=i2c0
16 changes: 2 additions & 14 deletions conf/firmwares/subsystems/shared/actuators_mkk.makefile
Expand Up @@ -17,22 +17,11 @@
# <define name="ADDR" value="{ 0x52, 0x54, 0x56, 0x58 }"/>
# </section>
#
# <section name="SUPERVISION" prefix="SUPERVISION_">
# <define name="TRIM_A" value="2"/>
# <define name="TRIM_E" value="-1"/>
# <define name="TRIM_R" value="3"/>
# <define name="NB_MOTOR" value="4"/>
# <define name="SCALE" value="256"/>
# <define name="ROLL_COEF" value="{ 0, 0, -256, 256}"/>
# <define name="PITCH_COEF" value="{ 256, -256, 0, 0}"/>
# <define name="YAW_COEF" value="{ -256, -256, 256, 256}"/>
# <define name="THRUST_COEF" value="{ 256, 256, 256, 256}"/>
# </section>
#
# servo section with driver="Mkk"
# command_laws section to map motor_mixing commands to servos
#

$(TARGET).CFLAGS += -DACTUATORS
ap.srcs += subsystems/actuators/supervision.c
ap.srcs += subsystems/actuators/actuators_mkk.c

ifeq ($(ARCH), lpc21)
Expand All @@ -51,6 +40,5 @@ ap.CFLAGS += -DUSE_I2C1
endif

# Simulator
nps.srcs += subsystems/actuators/supervision.c
nps.srcs += subsystems/actuators/actuators_mkk.c
nps.CFLAGS += -DUSE_I2C0 -DACTUATORS_MKK_DEVICE=i2c0

This file was deleted.

16 changes: 1 addition & 15 deletions conf/firmwares/subsystems/shared/actuators_skiron.makefile
Expand Up @@ -13,20 +13,8 @@
#
# required xml configuration:
#
# <section name="SUPERVISION" prefix="SUPERVISION_">
# <define name="TRIM_A" value="0"/>
# <define name="TRIM_E" value="0"/>
# <define name="TRIM_R" value="0"/>
# <define name="NB_MOTOR" value="4"/>
# <define name="SCALE" value="256"/>
# <define name="ROLL_COEF" value="{ 0, 0, -256, 256}"/>
# <define name="PITCH_COEF" value="{ 256, -256, 0, 0}"/>
# <define name="YAW_COEF" value="{ -256, -256, 256, 256}"/>
# <define name="THRUST_COEF" value="{ 256, 256, 256, 256}"/>
# </section>
#
# servo section with driver="Skiron"
# command_laws section to map supervision commands to servos
# command_laws section to map motor_mixing commands to servos
#

# set default i2c timing if not already configured
Expand All @@ -35,7 +23,6 @@ SKIRON_I2C_SCL_TIME=150
endif

$(TARGET).CFLAGS += -DACTUATORS
ap.srcs += subsystems/actuators/supervision.c
ap.srcs += subsystems/actuators/actuators_skiron.c

ifeq ($(ARCH), lpc21)
Expand All @@ -44,7 +31,6 @@ ap.CFLAGS += -DUSE_I2C0 -DI2C0_SCLL=$(SKIRON_I2C_SCL_TIME) -DI2C0_SCLH=$(SKIRON_
endif

# Simulator
nps.srcs += subsystems/actuators/supervision.c
nps.srcs += subsystems/actuators/actuators_skiron.c
nps.CFLAGS += -DUSE_I2C0 -DI2C0_SCLL=$(SKIRON_I2C_SCL_TIME) -DI2C0_SCLH=$(SKIRON_I2C_SCL_TIME) -DI2C0_VIC_SLOT=10 -DACTUATORS_SKIRON_DEVICE=i2c0

19 changes: 19 additions & 0 deletions conf/firmwares/subsystems/shared/motor_mixing.makefile
@@ -0,0 +1,19 @@
# Motor Mixing
#
# <section name="MIXING" prefix="MOTOR_MIXING_">
# <define name="TRIM_ROLL" value="2"/>
# <define name="TRIM_PITCH" value="-1"/>
# <define name="TRIM_YAW" value="3"/>
# <define name="NB_MOTOR" value="4"/>
# <define name="SCALE" value="256"/>
# <define name="ROLL_COEF" value="{ 0, 0, -256, 256}"/>
# <define name="PITCH_COEF" value="{ 256, -256, 0, 0}"/>
# <define name="YAW_COEF" value="{-256, -256, 256, 256}"/>
# <define name="THRUST_COEF" value="{ 256, 256, 256, 256}"/>
# </section>
#
#

$(TARGET).CFLAGS += -DUSE_MOTOR_MIXING
$(TARGET).srcs += subsystems/actuators/motor_mixing.c

11 changes: 0 additions & 11 deletions sw/airborne/firmwares/rotorcraft/guidance/guidance_v.h
Expand Up @@ -32,17 +32,6 @@
#include "generated/airframe.h"
#include "firmwares/rotorcraft/guidance/guidance_v_ref.h"

/** Supervision default bounds
* In case Asctec controllers are used without supervision
* Used in control and adaptation filter
* */
#ifndef SUPERVISION_MIN_MOTOR
#define SUPERVISION_MIN_MOTOR 1
#endif
#ifndef SUPERVISION_MAX_MOTOR
#define SUPERVISION_MAX_MOTOR 200
#endif

#include "firmwares/rotorcraft/guidance/guidance_v_adpt.h"

#define GUIDANCE_V_MODE_KILL 0
Expand Down
7 changes: 7 additions & 0 deletions sw/airborne/firmwares/rotorcraft/main.c
Expand Up @@ -37,6 +37,9 @@

#include "firmwares/rotorcraft/commands.h"
#include "subsystems/actuators.h"
#if USE_MOTOR_MIXING
#include "subsystems/actuators/motor_mixing.h"
#endif

#include "subsystems/imu.h"
#include "subsystems/gps.h"
Expand Down Expand Up @@ -100,6 +103,10 @@ STATIC_INLINE void main_init( void ) {
stateInit();

actuators_init();
#if USE_MOTOR_MIXING
motor_mixing_init();
#endif

radio_control_init();

#if DATALINK == XBEE
Expand Down
4 changes: 0 additions & 4 deletions sw/airborne/subsystems/actuators/actuators_asctec.c
Expand Up @@ -62,10 +62,6 @@ void actuators_asctec_init(void) {
actuators_delay_time = 0;
#endif

#ifdef ACTUATORS_ASCTEC_V2_PROTOCOL
supervision_init();
#endif

}

#ifndef ACTUATORS_ASCTEC_V2_PROTOCOL
Expand Down
3 changes: 0 additions & 3 deletions sw/airborne/subsystems/actuators/actuators_asctec.h
Expand Up @@ -29,9 +29,6 @@
#include "mcu_periph/i2c.h"

#include "generated/airframe.h"
#ifdef ACTUATORS_ASCTEC_V2_PROTOCOL
#include "subsystems/actuators/supervision.h"
#endif

enum actuators_asctec_cmd { NONE,
TEST,
Expand Down
1 change: 0 additions & 1 deletion sw/airborne/subsystems/actuators/actuators_mkk.c
Expand Up @@ -38,7 +38,6 @@ bool_t actuators_delay_done;

void actuators_mkk_init(void) {

supervision_init();
const uint8_t actuators_addr[ACTUATORS_MKK_NB] = ACTUATORS_MKK_ADDR;
for (uint8_t i=0; i<ACTUATORS_MKK_NB; i++) {
actuators_mkk.trans[i].type = I2CTransTx;
Expand Down
1 change: 0 additions & 1 deletion sw/airborne/subsystems/actuators/actuators_mkk.h
Expand Up @@ -30,7 +30,6 @@
#include "mcu_periph/i2c.h"

#include "generated/airframe.h"
#include "subsystems/actuators/supervision.h"


struct ActuatorsMkk {
Expand Down
3 changes: 0 additions & 3 deletions sw/airborne/subsystems/actuators/actuators_pwm.c
Expand Up @@ -23,9 +23,6 @@

void actuators_pwm_init(void)
{
#if USE_SUPERVISION
supervision_init();
#endif
// implemented in arch files
actuators_pwm_arch_init();
}
Expand Down
4 changes: 0 additions & 4 deletions sw/airborne/subsystems/actuators/actuators_pwm.h
Expand Up @@ -28,10 +28,6 @@
#include BOARD_CONFIG
#include "subsystems/actuators/actuators_pwm_arch.h"

#if USE_SUPERVISION
#include "subsystems/actuators/supervision.h"
#endif

extern void actuators_pwm_init(void);

#define ActuatorsPwmInit() actuators_pwm_init()
Expand Down
1 change: 0 additions & 1 deletion sw/airborne/subsystems/actuators/actuators_skiron.c
Expand Up @@ -37,7 +37,6 @@ bool_t actuators_delay_done;

void actuators_skiron_init(void) {

supervision_init();
actuators_skiron.trans.type = I2CTransTx;
actuators_skiron.trans.len_w = SERVOS_SKIRON_NB;
actuators_skiron.trans.slave_addr = ACTUATORS_SKIRON_I2C_ADDR;
Expand Down
2 changes: 0 additions & 2 deletions sw/airborne/subsystems/actuators/actuators_skiron.h
Expand Up @@ -30,8 +30,6 @@
#include "mcu_periph/i2c.h"

#include "generated/airframe.h"
#include "subsystems/actuators/supervision.h"


// Use I2C broadcast adderss
#define ACTUATORS_SKIRON_I2C_ADDR 0x00
Expand Down

0 comments on commit cdbdf91

Please sign in to comment.