mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-01 04:46:51 +08:00
[actuators] some bug fix
- actuators test programms are disabled for now, needs more work
This commit is contained in:
@@ -102,6 +102,14 @@
|
|||||||
<define name="THRUST_COEF" value="{ 256, 256, 256, 256 }"/>
|
<define name="THRUST_COEF" value="{ 256, 256, 256, 256 }"/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<command_laws>
|
||||||
|
<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_">
|
<section name="IMU" prefix="IMU_">
|
||||||
<define name="GYRO_P_NEUTRAL" value="32581"/>
|
<define name="GYRO_P_NEUTRAL" value="32581"/>
|
||||||
<define name="GYRO_Q_NEUTRAL" value="32008"/>
|
<define name="GYRO_Q_NEUTRAL" value="32008"/>
|
||||||
|
|||||||
@@ -90,7 +90,6 @@
|
|||||||
<axis name="THRUST" failsafe_value="0"/>
|
<axis name="THRUST" failsafe_value="0"/>
|
||||||
</commands>
|
</commands>
|
||||||
|
|
||||||
|
|
||||||
<section name="MIXING" prefix="MOTOR_MIXING_">
|
<section name="MIXING" prefix="MOTOR_MIXING_">
|
||||||
<define name="TRIM_ROLL" value="0"/>
|
<define name="TRIM_ROLL" value="0"/>
|
||||||
<define name="TRIM_PITCH" value="0"/>
|
<define name="TRIM_PITCH" value="0"/>
|
||||||
@@ -103,6 +102,14 @@
|
|||||||
<define name="THRUST_COEF" value="{ 256, 256, 256, 256 }"/>
|
<define name="THRUST_COEF" value="{ 256, 256, 256, 256 }"/>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<command_laws>
|
||||||
|
<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_">
|
<section name="IMU" prefix="IMU_">
|
||||||
<define name="GYRO_P_NEUTRAL" value="32581"/>
|
<define name="GYRO_P_NEUTRAL" value="32581"/>
|
||||||
<define name="GYRO_Q_NEUTRAL" value="32008"/>
|
<define name="GYRO_Q_NEUTRAL" value="32008"/>
|
||||||
|
|||||||
@@ -211,8 +211,8 @@
|
|||||||
<target name="test_adxl345" board="lisa_l_1.0"/>
|
<target name="test_adxl345" board="lisa_l_1.0"/>
|
||||||
<target name="test_esc_mkk_simple" board="lisa_l_1.0"/>
|
<target name="test_esc_mkk_simple" board="lisa_l_1.0"/>
|
||||||
<target name="test_esc_asctecv1_simple" board="lisa_l_1.0"/>
|
<target name="test_esc_asctecv1_simple" board="lisa_l_1.0"/>
|
||||||
<target name="test_actuators_mkk" board="lisa_l_1.0"/>
|
<!--target name="test_actuators_mkk" board="lisa_l_1.0"/>
|
||||||
<target name="test_actuators_asctecv1" board="lisa_l_1.0"/>
|
<target name="test_actuators_asctecv1" board="lisa_l_1.0"/-->
|
||||||
</firmware>
|
</firmware>
|
||||||
|
|
||||||
</airframe>
|
</airframe>
|
||||||
|
|||||||
@@ -228,8 +228,8 @@
|
|||||||
<target name="test_adxl345" board="lisa_l_1.1"/>
|
<target name="test_adxl345" board="lisa_l_1.1"/>
|
||||||
<target name="test_esc_mkk_simple" board="lisa_l_1.1"/>
|
<target name="test_esc_mkk_simple" board="lisa_l_1.1"/>
|
||||||
<target name="test_esc_asctecv1_simple" board="lisa_l_1.1"/>
|
<target name="test_esc_asctecv1_simple" board="lisa_l_1.1"/>
|
||||||
<target name="test_actuators_mkk" board="lisa_l_1.1"/>
|
<!--target name="test_actuators_mkk" board="lisa_l_1.1"/>
|
||||||
<target name="test_actuators_asctecv1" board="lisa_l_1.1"/>
|
<target name="test_actuators_asctecv1" board="lisa_l_1.1"/-->
|
||||||
</firmware>
|
</firmware>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<firmware name="setup">
|
<firmware name="setup">
|
||||||
<target name="tunnel" board="lisa_m_2.0"/>
|
<target name="tunnel" board="lisa_m_2.0"/>
|
||||||
<target name="setup_actuators" board="lisa_m_2.0"/>
|
<!--target name="setup_actuators" board="lisa_m_2.0"/-->
|
||||||
</firmware>
|
</firmware>
|
||||||
|
|
||||||
<firmware name="lisa_test_progs">
|
<firmware name="lisa_test_progs">
|
||||||
|
|||||||
@@ -4,8 +4,7 @@
|
|||||||
#include "mcu.h"
|
#include "mcu.h"
|
||||||
#include "mcu_periph/sys_time.h"
|
#include "mcu_periph/sys_time.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
#include "firmwares/fixedwing/actuators.h"
|
#include "subsystems/actuators.h"
|
||||||
//#include "actuators.h"
|
|
||||||
|
|
||||||
#include "firmwares/fixedwing/main_fbw.h"
|
#include "firmwares/fixedwing/main_fbw.h"
|
||||||
|
|
||||||
@@ -31,7 +30,7 @@ void dl_parse_msg( void ) {
|
|||||||
uint16_t servo_value = DL_SET_ACTUATOR_value(dl_buffer);
|
uint16_t servo_value = DL_SET_ACTUATOR_value(dl_buffer);
|
||||||
LED_TOGGLE(2);
|
LED_TOGGLE(2);
|
||||||
if (servo_no < ACTUATORS_NB)
|
if (servo_no < ACTUATORS_NB)
|
||||||
SetServo(servo_no, servo_value);
|
//SetServo(servo_no, servo_value);
|
||||||
}
|
}
|
||||||
#ifdef DlSetting
|
#ifdef DlSetting
|
||||||
else if (msg_id == DL_SETTING && DL_SETTING_ac_id(dl_buffer) == AC_ID) {
|
else if (msg_id == DL_SETTING && DL_SETTING_ac_id(dl_buffer) == AC_ID) {
|
||||||
@@ -40,7 +39,7 @@ void dl_parse_msg( void ) {
|
|||||||
DlSetting(i, val);
|
DlSetting(i, val);
|
||||||
LED_TOGGLE(2);
|
LED_TOGGLE(2);
|
||||||
for (int j=0 ; j<8 ; j++) {
|
for (int j=0 ; j<8 ; j++) {
|
||||||
SetServo(j,actuators[j]);
|
//SetServo(j,actuators[j]);
|
||||||
}
|
}
|
||||||
DOWNLINK_SEND_DL_VALUE(DefaultChannel, DefaultDevice, &i, &val);
|
DOWNLINK_SEND_DL_VALUE(DefaultChannel, DefaultDevice, &i, &val);
|
||||||
} else if (msg_id == DL_GET_SETTING && DL_GET_SETTING_ac_id(dl_buffer) == AC_ID) {
|
} else if (msg_id == DL_GET_SETTING && DL_GET_SETTING_ac_id(dl_buffer) == AC_ID) {
|
||||||
@@ -59,7 +58,7 @@ void init_fbw( void ) {
|
|||||||
|
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
for(i = 0; i < ACTUATORS_NB; i++) {
|
for(i = 0; i < ACTUATORS_NB; i++) {
|
||||||
SetServo(i, 1500);
|
//SetServo(i, 1500);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetServo(SERVO_GAZ, SERVO_GAZ_MIN);
|
// SetServo(SERVO_GAZ, SERVO_GAZ_MIN);
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
#include "mcu_periph/sys_time.h"
|
#include "mcu_periph/sys_time.h"
|
||||||
#include "subsystems/datalink/downlink.h"
|
#include "subsystems/datalink/downlink.h"
|
||||||
#include "firmwares/rotorcraft/commands.h"
|
#include "firmwares/rotorcraft/commands.h"
|
||||||
#include "actuators.h"
|
#include "subsystems/actuators.h"
|
||||||
#include "actuators/actuators_pwm.h"
|
#include "subsystems/actuators/actuators_pwm.h"
|
||||||
#include "subsystems/imu.h"
|
#include "subsystems/imu.h"
|
||||||
#include "subsystems/radio_control.h"
|
#include "subsystems/radio_control.h"
|
||||||
#include "autopilot.h"
|
#include "autopilot.h"
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#include "mcu.h"
|
#include "mcu.h"
|
||||||
#include "mcu_periph/sys_time.h"
|
#include "mcu_periph/sys_time.h"
|
||||||
#include "firmwares/rotorcraft/commands.h"
|
#include "firmwares/rotorcraft/commands.h"
|
||||||
#include "actuators.h"
|
#include "subsystems/actuators.h"
|
||||||
#include "subsystems/datalink/downlink.h"
|
#include "subsystems/datalink/downlink.h"
|
||||||
#include "led.h"
|
#include "led.h"
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ static inline void main_periodic_task( void ) {
|
|||||||
commands[COMMAND_YAW] = 20;
|
commands[COMMAND_YAW] = 20;
|
||||||
commands[COMMAND_THRUST] = 0;
|
commands[COMMAND_THRUST] = 0;
|
||||||
// actuators_set(TRUE);
|
// actuators_set(TRUE);
|
||||||
actuators_set(FALSE);
|
//actuators_set(FALSE);
|
||||||
}
|
}
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ extern struct ActuatorsMkk actuators_mkk;
|
|||||||
extern void actuators_mkk_init(void);
|
extern void actuators_mkk_init(void);
|
||||||
extern void actuators_mkk_set(void);
|
extern void actuators_mkk_set(void);
|
||||||
|
|
||||||
#define ActuatorMkkSet(_i, _v) { actuators_mkk.trans[i].buf[0] = _v; }
|
#define ActuatorMkkSet(_i, _v) { actuators_mkk.trans[_i].buf[0] = _v; }
|
||||||
#define ActuatorsMkkInit() actuators_mkk_init()
|
#define ActuatorsMkkInit() actuators_mkk_init()
|
||||||
#define ActuatorsMkkCommit() actuators_mkk_set()
|
#define ActuatorsMkkCommit() actuators_mkk_set()
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "mcu_periph/i2c.h"
|
#include "mcu_periph/i2c.h"
|
||||||
#include "firmwares/rotorcraft/commands.h"
|
#include "firmwares/rotorcraft/commands.h"
|
||||||
#include "firmwares/rotorcraft/actuators.h"
|
#include "subsystems/actuators.h"
|
||||||
|
|
||||||
static inline void main_init( void );
|
static inline void main_init( void );
|
||||||
static inline void main_periodic_task( void );
|
static inline void main_periodic_task( void );
|
||||||
@@ -61,7 +61,7 @@ static inline void main_periodic_task( void ) {
|
|||||||
commands[COMMAND_YAW]=0;
|
commands[COMMAND_YAW]=0;
|
||||||
commands[COMMAND_THRUST]=1;
|
commands[COMMAND_THRUST]=1;
|
||||||
|
|
||||||
actuators_set(TRUE);
|
//actuators_set(TRUE);
|
||||||
|
|
||||||
LED_PERIODIC();
|
LED_PERIODIC();
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
#include "mcu_periph/sys_time.h"
|
#include "mcu_periph/sys_time.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
|
|
||||||
#include "actuators/supervision.h"
|
#include "actuators/motor_mixing.h"
|
||||||
|
|
||||||
|
|
||||||
struct NpsAutopilot autopilot;
|
struct NpsAutopilot autopilot;
|
||||||
@@ -100,8 +100,8 @@ void nps_autopilot_run_step(double time __attribute__ ((unused))) {
|
|||||||
|
|
||||||
/* scale final motor commands to 0-1 for feeding the fdm */
|
/* scale final motor commands to 0-1 for feeding the fdm */
|
||||||
/* FIXME: autopilot.commands is of length NB_COMMANDS instead of number of motors */
|
/* FIXME: autopilot.commands is of length NB_COMMANDS instead of number of motors */
|
||||||
for (uint8_t i=0; i<SUPERVISION_NB_MOTOR; i++)
|
for (uint8_t i=0; i<MOTOR_MIXING_NB_MOTOR; i++)
|
||||||
autopilot.commands[i] = (double)(supervision.commands[i] - SUPERVISION_MIN_MOTOR) / SUPERVISION_MAX_MOTOR;
|
autopilot.commands[i] = (double)(motor_mixing.commands[i]/MAX_PPRZ);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user