*** empty log message ***

This commit is contained in:
Antoine Drouin
2006-04-30 13:48:12 +00:00
parent a84147d97c
commit ea3de0e5be
17 changed files with 129 additions and 94 deletions
+3 -3
View File
@@ -116,9 +116,9 @@ include $(PAPARAZZI_SRC)/conf/autopilot/twin_mcu_avr.makefile
ap.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport
ap.srcs += pprz_transport.c downlink.c
# ap.CFLAGS += -DUSE_UART0 -DDOWNLINK_AP_DEVICE=Uart0
ap.CFLAGS += -DMODEM -DDOWNLINK_AP_DEVICE=Modem
ap.srcs += $(SRC_ARCH)/modem_hw.c
ap.CFLAGS += -DUSE_UART0 -DDOWNLINK_AP_DEVICE=Uart0
#ap.CFLAGS += -DMODEM -DDOWNLINK_AP_DEVICE=Modem
#ap.srcs += $(SRC_ARCH)/modem_hw.c
ap.CFLAGS += -DRADIO_CONTROL_CALIB
ap.srcs += if_calib.c
+51 -66
View File
@@ -33,88 +33,73 @@
<set servo="AILEVON_RIGHT" value="$elevator - $aileron"/>
</command_laws>
<!-- control section -->
<control>
<level name="attitude">
<loop name="roll" loop_type="P" pgain="100" saturation = "MAX_PPRZ"
data_type = "int16_t"
measure="estimator_phi" setpoint="control_roll_setpoint" output="control_commands[COMMAND_ROLL]"/>
<loop name="pitch" loop_type="P" pgain="100" saturation = "MAX_PPRZ"
data_type = "int16_t"
measure="estimator_theta" setpoint="control_pitch_setpoint" output="control_commands[COMMAND_PITCH]"/>
</level>
<section name="adc" prefix="ADC_CHANNEL_">
<define name="VSUPPLY" value="3"/>
<define name="IR1" value="1"/>
<define name="IR2" value="0"/>
<define name="IR_NB_SAMPLES" value="16"/>
</section>
<mode name="MANUAL">
<input input="rc_values[RADIO_THROTTLE]" output="control_commands[COMMAND_THROTTLE]" range="1"/>
<input input="rc_values[RADIO_ROLL]" output="control_commands[COMMAND_ROLL]" range="1"/>
<input input="rc_values[RADIO_PITCH]" output="control_commands[COMMAND_PITCH]" range="1"/>
</mode>
<section name="INFRARED" prefix="IR_">
<define name="ROLL_NEUTRAL_DEFAULT" value="-4.3" unit="deg"/>
<define name="PITCH_NEUTRAL_DEFAULT" value="3" unit="deg"/>
<define name="DEFAULT_CONTRAST" value="400"/>
<define name="RAD_OF_IR_CONTRAST" value="0.6"/>
<define name="RAD_OF_IR_MIN_VALUE" value="0.0008"/>
<define name="RAD_OF_IR_MAX_VALUE" value="0.008"/>
<linear name="RollOfIrs" arity="2" coeff1="-1" coeff2="-1"/>
<linear name="PitchOfIrs" arity="2" coeff1="-1" coeff2="1"/>
<define name="ADC_ROLL_NEUTRAL" value="-1042"/>
<define name="ADC_PITCH_NEUTRAL" value="10"/>
</section>
<mode name="AUTO1">
<input input="rc_values[RADIO_THROTTLE]" output="control_commands[COMMAND_THROTTLE]" range="1"/>
<input input="rc_values[RADIO_ROLL]" output="control_roll_setpoint" range="1"/>
<input input="rc_values[RADIO_PITCH]" output="control_pitch_setpoint" range="1"/>
<run name="attitude"/>
</mode>
</control>
<section name="added_for_nav">
<define name="COURSE_PGAIN" value="-0.4"/>
<define name="ALTITUDE_PGAIN" value="-0.025"/>
<define name="NAV_PITCH" value="0."/>
<define name="NOMINAL_AIRSPEED" value="12." unit="m/s"/>
<define name="CARROT" value="5." unit="s"/>
<define name="MAX_ROLL" value="0.35"/>
<define name="MAX_PITCH" value="0.35"/>
<define name="MIN_PITCH" value="-0.35"/>
</section>
<section name="added_for_nav2" prefix="CLIMB_">
<define name="PITCH_PGAIN" value="-0.1"/>
<define name="PITCH_IGAIN" value="0.025"/>
<define name="PGAIN" value="-0.03"/>
<define name="IGAIN" value="0.1"/>
<section name="ALT" prefix="CLIMB_">
<define name="PITCH_PGAIN" value="-0.1"/>
<define name="PITCH_IGAIN" value="1.0"/>
<define name="PGAIN" value="-0.025"/>
<define name="IGAIN" value="0.01"/>
<define name="MAX" value="1."/>
<define name="LEVEL_GAZ" value="0.45"/>
<define name="GAZ_OF_CLIMB" value="0.2" unit="%/(m/s)"/>
<define name="PITCH_OF_VZ_PGAIN" value="0.00"/>
</section>
<define name="LEVEL_GAZ" value="0.50"/>
<define name="GAZ_OF_CLIMB" value="0.15" unit="% / m/s"/>
<define name="PITCH_OF_VZ_PGAIN" value="0.1"/>
</section>
<section name="NAV">
<define name="COURSE_PGAIN" value="-0.3"/>
<define name="ALTITUDE_PGAIN" value="-0.05"/>
<define name="NAV_PITCH" value="0."/>
</section>
<section name="PID">
<define name="ROLL_PGAIN" value="6000."/>
<define name="PITCH_OF_ROLL" value="0.2"/>
<define name="PITCH_PGAIN" value="9000."/>
<define name="MAX_ROLL" value="0.4"/>
<define name="AUTO1_MAX_ROLL" value="0.8"/>
<define name="MAX_PITCH" value="0.25"/>
<define name="MIN_PITCH" value="-0.35"/>
<define name="AILERON_OF_GAZ" value="-0.13"/>
</section>
<section name="BAT" channel="3">
<define name="MILLIAMP_PER_PERCENT" value="0.0"/>
<define name="VoltageOfAdc(adc)" value="4.2"/>
<define name="LOW_BATTERY" value="9" unit="V"/>
</section>
<section name="DOWNLINK" prefix="DOWNLINK_">
<define name="FBW_DEVICE" value="uart0"/>
<section name="MISC">
<define name="NOMINAL_AIRSPEED" value="9."/>
<define name="CARROT" value="5." unit="s"/>
</section>
<makefile>
include $(PAPARAZZI_SRC)/conf/autopilot/robostix.makefile
ap.srcs += commands.c
ap.CFLAGS += -DACTUATORS=\"servos_direct_hw.h\"
ap.srcs += $(SRC_ARCH)/servos_direct_hw.c
ap.CFLAGS += -DRADIO_CONTROL
ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c
ap.CFLAGS += -DDOWNLINK -DUART0
ap.srcs += fbw_downlink.c $(SRC_ARCH)/uart_hw.c
#ap.CFLAGS += -DCONTROL -DAUTOPILOT
#ap.EXTRA_SRCS += $(ACINCLUDE)/ap/control.c
#ap.CFLAGS += -DADC
#ap.EXTRA_SRCS += $(SRC_ARCH)/adc_hw.c
#ap.CFLAGS += -DDATALINK
#ap.EXTRA_SRCS += datalink.c nav.c estimator.c
ap.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport
ap.srcs += pprz_transport.c downlink.c
ap.CFLAGS += -DUSE_UART0 -DDOWNLINK_AP_DEVICE=Uart0 -DDOWNLINK_FBW_DEVICE=Uart0
ap.srcs += $(SRC_ARCH)/uart_hw.c
+2 -3
View File
@@ -10,6 +10,5 @@ ap.LOW_FUSE = 0xbf
ap.HIGH_FUSE = 0xc9
ap.EXT_FUSE = ff
ap.LOCK_FUSE = ff
ap.CFLAGS += -DFBW -DCONFIG=\"robostix.h\" -DLED
ap.srcs = sys_time.c $(SRC_ARCH)/adc_hw.c main_fbw.c main.c
# ap.srcs += main_ap.c
ap.CFLAGS += -DFBW -DAP -DCONFIG=\"robostix.h\" -DLED -DGPS -DUBX -DINFRARED -DRADIO_CONTROL -DINTER_MCU -DRADIO_CONTROL -DACTUATORS=\"servos_direct_hw.h\" -DGPS_LINK=Uart1
ap.srcs = sys_time.c $(SRC_ARCH)/adc_hw.c inter_mcu.c gps_ubx.c gps.c infrared.c pid.c nav.c estimator.c main_fbw.c main_ap.c main.c commands.c radio_control.c $(SRC_ARCH)/ppm_hw.c $(SRC_ARCH)/servos_direct_hw.c
+1 -1
View File
@@ -1,4 +1,4 @@
ap.srcs += main_ap.c sys_time.c main.c inter_mcu.c link_mcu.c gps_ubx.c gps.c infrared.c pid.c nav.c estimator.c cam.c downlink.c spi.c
ap.srcs += main_ap.c sys_time.c main.c inter_mcu.c link_mcu.c gps_ubx.c gps.c infrared.c pid.c nav.c estimator.c cam.c spi.c
ap.CFLAGS += -DMCU_SPI_LINK -DGPS -DUBX -DINFRARED -DRADIO_CONTROL -DINTER_MCU
fbw.srcs += sys_time.c main_fbw.c main.c commands.c radio_control.c pprz_transport.c downlink.c inter_mcu.c spi.c link_mcu.c
+1 -1
View File
@@ -2,7 +2,7 @@ include $(PAPARAZZI_SRC)/conf/autopilot/twin_avr.makefile
include $(PAPARAZZI_SRC)/conf/autopilot/twin_mcu.makefile
ap.srcs += $(SRC_ARCH)/adc_hw.c $(SRC_ARCH)/uart_hw.c $(SRC_ARCH)/spi_hw.c
ap.CFLAGS += -DUSE_UART1 -DGPS_LINK=uart1
ap.CFLAGS += -DUSE_UART1 -DGPS_LINK=Uart1
fbw.CFLAGS += -DACTUATORS=\"servos_4017.h\" -DSERVOS_4017 -DADC
fbw.srcs += $(SRC_ARCH)/adc_hw.c $(SRC_ARCH)/servos_4017.c $(SRC_ARCH)/ppm_hw.c $(SRC_ARCH)/uart_hw.c $(SRC_ARCH)/spi_hw.c
+5 -1
View File
@@ -218,7 +218,11 @@
<field name="channels" type="int16[]"/>
</message>
<message name="DEBUG2" id="33">
<message name="DEBUG1" id="33">
<field name="foo" type="uint8[]"/>
</message>
<message name="DEBUG2" id="34">
<field name="foo" type="uint8[]"/>
</message>
+4
View File
@@ -117,7 +117,11 @@ extern uint8_t telemetry_mode_Ap;
#define SEND_NAVIGATION() Downlink({ int16_t pos_x = estimator_x; int16_t pos_y = estimator_y; int16_t d_course = DeciDegOfRad(desired_course); DOWNLINK_SEND_NAVIGATION(&nav_block, &nav_stage, &pos_x, &pos_y, &d_course, &dist2_to_wp, &dist2_to_home);})
#ifdef CAM
#define SEND_CAM() Downlink({ int16_t x = target_x; int16_t y = target_y; int8_t phi = DegOfRad(phi_c); int8_t theta = DegOfRad(theta_c); DOWNLINK_SEND_CAM(&phi, &theta, &x, &y);})
#else
#define SEND_CAM() {}
#endif
#define PERIODIC_SEND_DL_VALUE() PeriodicSendDlValue() /** from flight_plan.h*/
+7 -3
View File
@@ -49,7 +49,6 @@ volatile uint8_t spi_idx_buf;
spi_message_received = TRUE; \
SpiStop(); \
} \
spi_idx_buf++; \
}
@@ -113,6 +112,11 @@ void spi_init( void) {
/* SS1 idles high (don't select slave yet)*/
SpiUnselectSlave1();
/* Set SS2 output */
SetBit( SPI_SS2_DDR, SPI_SS2_PIN);
/* SS2 idles high (don't select slave yet)*/
SpiUnselectSlave2();
spi_cur_slave = SPI_NONE;
}
@@ -134,8 +138,8 @@ SIGNAL(SIG_SPI) {
}
#define SpiStop() { \
cbi(SPCR,SPIE); \
cbi(SPCR, SPE); \
ClearBit(SPCR,SPIE); \
ClearBit(SPCR, SPE); \
SpiUnselectSlave0(); \
}
+25 -5
View File
@@ -8,7 +8,9 @@ extern volatile uint8_t spi_idx_buf;
SPDR = spi_buffer_input[0]; \
spi_message_received = FALSE; \
}
#define SPI_IT1_PIN 6
#define SPI_IT1_PORT PORTE
#define SPI_IT1_DDR DDRE
#ifdef FBW
#define SPI_PORT PORTB
@@ -25,17 +27,25 @@ extern volatile uint8_t spi_idx_buf;
#define SPI_SS0_PIN 0
#define SPI_SS0_PORT PORTB
#define SPI_SS0_DDR DDRB
#define SPI_IT0_PIN 1
#define SPI_IT0_PORT PORTD
#define SPI_IT0_DDR DDRD
#define SPI_IT0_PIN 7
#define SPI_IT0_PORT PORTE
#define SPI_IT0_DDR DDRE
#define SPI_SS1_PIN 7
#define SPI_SS1_PIN 3
#define SPI_SS1_PORT PORTE
#define SPI_SS1_DDR DDRE
#define SPI_IT1_PIN 6
#define SPI_IT1_PORT PORTE
#define SPI_IT1_DDR DDRE
#define SPI_SS2_PIN 2
#define SPI_SS2_PORT PORTE
#define SPI_SS2_DDR DDRE
#define SPI_IT2_PIN 5
#define SPI_IT2_PORT PORTE
#define SPI_IT2_DDR DDRE
#define SPI_SCK_PIN 1
#define SPI_MOSI_PIN 2
#define SPI_MISO_PIN 3
@@ -72,6 +82,16 @@ extern volatile uint8_t spi_idx_buf;
SetBit( SPI_SS1_PORT, SPI_SS1_PIN );\
}
#define SpiSelectSlave2() { \
spi_cur_slave = SPI_SLAVE2; \
ClearBit( SPI_SS2_PORT, SPI_SS2_PIN );\
}
#define SpiUnselectSlave2() { \
spi_cur_slave = SPI_NONE; \
SetBit( SPI_SS2_PORT, SPI_SS2_PIN );\
}
#endif /* AP */
+2 -2
View File
@@ -74,8 +74,8 @@ extern void uart1_transmit(const uint8_t);
extern uint8_t uart1_char;
extern bool_t uart1_char_available;
#define uart1ChAvailable() (uart1_char_available)
static inline uint8_t uart1Getch( void ) {
#define Uart1ChAvailable() (uart1_char_available)
static inline uint8_t Uart1Getch( void ) {
uart1_char_available = FALSE;
return uart1_char;
}
+1 -1
View File
@@ -86,7 +86,7 @@ extern struct svinfo gps_svinfos[GPS_NB_CHANNELS];
#define GpsBuffer() GpsLink(ChAvailable())
#define ReadGpsBuffer() { while (GpsLink(ChAvailable())) parse_ubx(GpsLink(Getch())); }
#define GpsUartSend1(c) GpsLink(_transmit(c))
#define GpsUartSend1(c) GpsLink(Transmit(c))
#endif
+1 -1
View File
@@ -24,7 +24,7 @@
#include "inter_mcu.h"
#if defined FBW && defined AP
#if defined SINGLE_MCU
struct fbw_state _fbw_state;
struct ap_state _ap_state;
struct fbw_state* fbw_state = &_fbw_state;
-1
View File
@@ -117,7 +117,6 @@ static inline void inter_mcu_fill_fbw_state (void) {
static inline void inter_mcu_event_task( void) {
time_since_last_ap = 0;
ap_ok = TRUE;
inter_mcu_fill_fbw_state();
#if defined SINGLE_MCU
/**Directly set the flag indicating to AP that shared buffer is available*/
inter_mcu_received_fbw = TRUE;
+12 -3
View File
@@ -37,10 +37,11 @@ static uint16_t crc = 0;
#define LINK_MCU_FRAME_LENGTH sizeof(link_mcu_from_fbw_msg)
#define ComputeChecksum(_buf) { \
uint8_t i = 0; \
uint8_t i; \
crc = CRC_INIT; \
for(i = 0; i < PAYLOAD_LENGTH; i++) { \
crc = CrcUpdate(crc, ((uint8_t*)&_buf)[i]); \
uint8_t _byte = ((uint8_t*)&_buf)[i]; \
crc = CrcUpdate(crc, _byte); \
} \
}
@@ -82,12 +83,17 @@ void link_mcu_init(void) {
link_mcu_nb_err = 0;
}
#include "spi_hw.h"
void link_mcu_send(void) {
ClearBit( SPI_SS2_PORT, SPI_SS2_PIN );
if (!SpiCheckAvailable()) {
SpiOverRun();
return;
}
ComputeChecksum(link_mcu_from_ap_msg);
link_mcu_from_ap_msg.checksum = crc;
spi_buffer_input = (uint8_t*)&link_mcu_from_fbw_msg;
@@ -95,6 +101,9 @@ void link_mcu_send(void) {
spi_buffer_length = LINK_MCU_FRAME_LENGTH;
SpiSelectSlave0();
SpiStart();
SetBit( SPI_SS2_PORT, SPI_SS2_PIN );
}
void link_mcu_event_task( void ) {
+6 -1
View File
@@ -378,6 +378,7 @@ static void navigation_task( void ) {
* - do navigation with \a navigation_task
*
*/
inline void periodic_task_ap( void ) {
static uint8_t _20Hz = 0;
static uint8_t _10Hz = 0;
@@ -471,7 +472,11 @@ inline void periodic_task_ap( void ) {
ap_state->commands[COMMAND_PITCH] = desired_elevator;
#if defined MCU_SPI_LINK
// ClearBit( SPI_SS2_PORT, SPI_SS2_PIN );
link_mcu_send();
// SetBit( SPI_SS2_PORT, SPI_SS2_PIN );
#elif defined INTER_MCU && defined SINGLE_MCU
/**Directly set the flag indicating to FBW that shared buffer is available*/
inter_mcu_received_ap = TRUE;
@@ -632,10 +637,10 @@ void event_task_ap( void ) {
#ifdef MCU_SPI_LINK
if (spi_message_received) {
DOWNLINK_SEND_DEBUG2(sizeof(link_mcu_from_fbw_msg), ((uint8_t*)&link_mcu_from_fbw_msg));
/* Got a message on SPI. */
spi_message_received = FALSE;
link_mcu_event_task();
DOWNLINK_SEND_DEBUG2(sizeof(link_mcu_from_fbw_msg), ((uint8_t*)&link_mcu_from_fbw_msg));
}
#endif
+3 -2
View File
@@ -125,12 +125,12 @@ void event_task_fbw( void) {
/* Got a message on SPI. */
spi_message_received = FALSE;
link_mcu_event_task(); /** Sets inter_mcu_received_ap if checksum is ok */
DOWNLINK_SEND_DEBUG2(sizeof(link_mcu_from_ap_msg), ((uint8_t*)&link_mcu_from_ap_msg));
DOWNLINK_SEND_DEBUG1(sizeof(link_mcu_from_ap_msg), ((uint8_t*)&link_mcu_from_ap_msg));
}
#endif /* MCU_SPI_LINK */
if (inter_mcu_received_ap) {
inter_mcu_received_ap = FALSE;
inter_mcu_event_task(); /** Prepares the next message for AP */
inter_mcu_event_task();
if (fbw_mode == FBW_MODE_AUTO) {
SetCommands(ap_state->commands);
}
@@ -138,6 +138,7 @@ void event_task_fbw( void) {
#ifdef MCU_SPI_LINK
if (link_mcu_received) {
link_mcu_received = FALSE;
inter_mcu_fill_fbw_state(); /** Prepares the next message for AP */
link_mcu_restart(); /** Prepares the next SPI communication */
}
#endif /* MCU_SPI_LINK */
+5
View File
@@ -29,6 +29,8 @@
#ifndef SPI_H
#define SPI_H
#ifdef MCU_SPI_LINK
#include "std.h"
#include "spi_hw.h"
@@ -45,6 +47,7 @@ void spi_init(void);
#define SPI_NONE 0
#define SPI_SLAVE0 1
#define SPI_SLAVE1 2
#define SPI_SLAVE2 3
extern volatile uint8_t spi_cur_slave;
extern uint8_t spi_nb_ovrn;
@@ -54,6 +57,8 @@ extern uint8_t spi_nb_ovrn;
#endif /* AP */
#endif /* MCU_SPI_LINK */
#endif /* SPI_H */