diff --git a/conf/airframes/esden/calib/aspirin_jtm.xml b/conf/airframes/esden/calib/aspirin_jtm.xml new file mode 100644 index 00000000000..abc370b7c64 --- /dev/null +++ b/conf/airframes/esden/calib/aspirin_jtm.xml @@ -0,0 +1,31 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/conf/airframes/esden/jt_lisam.xml b/conf/airframes/esden/jt_lisam.xml index d47df390606..f80c5197482 100644 --- a/conf/airframes/esden/jt_lisam.xml +++ b/conf/airframes/esden/jt_lisam.xml @@ -7,8 +7,8 @@ - - + + @@ -17,22 +17,12 @@ - - - +
@@ -41,8 +31,8 @@
- - + + @@ -54,7 +44,7 @@
- +
@@ -99,30 +89,30 @@ - + - - - + + + - + - + - - - + + + - - - + + + - + @@ -167,10 +157,6 @@
-
- -
-
@@ -190,6 +176,7 @@ + diff --git a/conf/airframes/esden/lisa_asctec.xml b/conf/airframes/esden/lisa_asctec.xml index a011e5177fe..b677e8e3ccd 100644 --- a/conf/airframes/esden/lisa_asctec.xml +++ b/conf/airframes/esden/lisa_asctec.xml @@ -180,11 +180,9 @@
- - + - diff --git a/conf/settings/settings_booz2_jtm.xml b/conf/settings/settings_booz2_jtm.xml new file mode 100644 index 00000000000..3441e55d555 --- /dev/null +++ b/conf/settings/settings_booz2_jtm.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sw/airborne/firmwares/rotorcraft/actuators/actuators_pwm_supervision.c b/sw/airborne/firmwares/rotorcraft/actuators/actuators_pwm_supervision.c index 9debad1cfc7..a44ffe41251 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/actuators_pwm_supervision.c +++ b/sw/airborne/firmwares/rotorcraft/actuators/actuators_pwm_supervision.c @@ -31,6 +31,10 @@ #include "generated/airframe.h" +#define actuators actuators_pwm_values +#define Actuator(_x) actuators_pwm_values[_x] +#define ActuatorsCommit() do { } while(0); + int32_t actuators_pwm_values[ACTUATORS_PWM_NB]; void actuators_init(void) @@ -43,18 +47,27 @@ void actuators_init(void) #define PWM_OFF 1000 void actuators_set(bool_t motors_on) { - booz2_commands[COMMAND_PITCH] = booz2_commands[COMMAND_PITCH] * PWM_GAIN_SCALE; - booz2_commands[COMMAND_ROLL] = booz2_commands[COMMAND_ROLL] * PWM_GAIN_SCALE; - booz2_commands[COMMAND_YAW] = booz2_commands[COMMAND_YAW] * PWM_GAIN_SCALE; - booz2_commands[COMMAND_THRUST] = (booz2_commands[COMMAND_THRUST] * ((SUPERVISION_MAX_MOTOR - SUPERVISION_MIN_MOTOR) / 200)) + SUPERVISION_MIN_MOTOR; + int32_t pwm_commands[COMMANDS_NB]; + int32_t pwm_commands_pprz[COMMANDS_NB]; + + pwm_commands[COMMAND_PITCH] = booz2_commands[COMMAND_PITCH] * PWM_GAIN_SCALE; + pwm_commands[COMMAND_ROLL] = booz2_commands[COMMAND_ROLL] * PWM_GAIN_SCALE; + pwm_commands[COMMAND_YAW] = booz2_commands[COMMAND_YAW] * PWM_GAIN_SCALE; + pwm_commands[COMMAND_THRUST] = (booz2_commands[COMMAND_THRUST] * ((SUPERVISION_MAX_MOTOR - SUPERVISION_MIN_MOTOR) / 200)) + SUPERVISION_MIN_MOTOR; + + pwm_commands_pprz[COMMAND_PITCH] = booz2_commands[COMMAND_PITCH] * (MAX_PPRZ / 100); + pwm_commands_pprz[COMMAND_ROLL] = booz2_commands[COMMAND_ROLL] * (MAX_PPRZ / 100); + pwm_commands_pprz[COMMAND_YAW] = booz2_commands[COMMAND_YAW] * (MAX_PPRZ / 100); - supervision_run(motors_on, FALSE, booz2_commands); + supervision_run(motors_on, FALSE, pwm_commands); + + SetActuatorsFromCommands(pwm_commands_pprz); if (motors_on) { for (int i = 0; i < SUPERVISION_NB_MOTOR; i++) actuators_pwm_values[i] = supervision.commands[i]; } else { - for (int i = 0; i < ACTUATORS_PWM_NB; i++) + for (int i = 0; i < SUPERVISION_NB_MOTOR; i++) actuators_pwm_values[i] = PWM_OFF; } actuators_pwm_commit(); diff --git a/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.c b/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.c index c31ef54232c..4cefcf51ae2 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.c +++ b/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.c @@ -95,6 +95,10 @@ void actuators_pwm_arch_init(void) { TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); + +#ifdef SERVO_HZ_SECONDARY + TIM_TimeBaseStructure.TIM_Period = (ONE_MHZ_CLK / SERVO_HZ_SECONDARY) - 1; +#endif TIM_TimeBaseInit(PWM_5AND6_TIMER, &TIM_TimeBaseStructure); #ifdef USE_SERVOS_7AND8 TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure); diff --git a/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.h b/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.h index 7dbcb8f6112..e47bad7512d 100644 --- a/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.h +++ b/sw/airborne/firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.h @@ -38,7 +38,7 @@ extern void actuators_pwm_arch_init(void); extern void actuators_pwm_commit(void); -#define ChopServo(x,a,b) Chop(x, a, b) +#define ChopServo(_x,_a,_b) Chop(_x, _a, _b) #define Actuator(_x) actuators_pwm_values[_x] #define SERVOS_TICS_OF_USEC(_v) (_v) diff --git a/sw/airborne/lisa/lisa_overo_link.h b/sw/airborne/lisa/lisa_overo_link.h index 3673c4c0ae5..69e334d0446 100644 --- a/sw/airborne/lisa/lisa_overo_link.h +++ b/sw/airborne/lisa/lisa_overo_link.h @@ -36,7 +36,9 @@ extern void overo_link_periodic(void); extern void overo_link_arch_init(void); extern void overo_link_arch_prepare_next_transfert(void); +#ifndef SITL #include "lisa_overo_link_arch.h" +#endif #if 0 /* that doesn't work yet */ #define OveroLinkPeriodic(_timeout_handler) { \ diff --git a/sw/airborne/modules/ins/ins_arduimu_basic.c b/sw/airborne/modules/ins/ins_arduimu_basic.c index 81ed5d466d4..6d7dd584aef 100644 --- a/sw/airborne/modules/ins/ins_arduimu_basic.c +++ b/sw/airborne/modules/ins/ins_arduimu_basic.c @@ -74,7 +74,7 @@ void ArduIMU_init( void ) { ins_roll_neutral = INS_ROLL_NEUTRAL_DEFAULT; ins_pitch_neutral = INS_PITCH_NEUTRAL_DEFAULT; - high_accel_done = FLASE; + high_accel_done = FALSE; high_accel_flag = FALSE; } diff --git a/sw/ground_segment/python/joystick/arduino_dangerboard.py b/sw/ground_segment/python/joystick/arduino_dangerboard.py index a65cbb4c877..fc9d8d373a3 100755 --- a/sw/ground_segment/python/joystick/arduino_dangerboard.py +++ b/sw/ground_segment/python/joystick/arduino_dangerboard.py @@ -21,8 +21,8 @@ class arduino_dangerboard(): - def __init__(self): - self.port = serial.Serial('/dev/ttyUSB0', 115200) + def __init__(self, port='/dev/ttyUSB0'): + self.port = serial.Serial(port, 115200) self.SLIDER_COUNT = 3 self.sliders = [0] * self.SLIDER_COUNT self.POT_MIN = 0.0 diff --git a/sw/ground_segment/python/joystick/ivydanger.py b/sw/ground_segment/python/joystick/ivydanger.py index 1aea59df17a..edc216f474a 100755 --- a/sw/ground_segment/python/joystick/ivydanger.py +++ b/sw/ground_segment/python/joystick/ivydanger.py @@ -20,9 +20,11 @@ # of sliders!) DEFAULT_SLIDERS = [ ] +DEFAULT_PORT = '/dev/ttyUSB0' + class IvyStick(arduino_dangerboard): - def __init__(self, ac_ids, settings_names): - arduino_dangerboard.__init__(self) + def __init__(self, ac_ids, settings_names, port): + arduino_dangerboard.__init__(self, port) if (len(settings_names) > self.SLIDER_COUNT): raise Exception("Number of settings greater than number of sliders") if (len(ac_ids) < 1): @@ -59,6 +61,7 @@ def Usage(scmd): \t-h | --help print this message \t-a AC_ID | --ac_id=AC_ID where AC_ID is an aircraft ID to use for settings (multiple IDs may be passed) \t-s S1:S2:S3 | --sliders=S1:S2:S3 where S1, S2, S3 are the names of the slider settings to send +\t-p PORT | --port=PORT where PORT is the name of the serial port for the slider box ''' print fmt % lpathitem[-1] @@ -66,9 +69,9 @@ def GetOptions(): # Map dangerboard sliders to these settings from aircraft settings # file, in that order (dimension of this list needs to match number # of sliders!) - options = {'ac_id':DEFAULT_AC_IDS, 'sliders':DEFAULT_SLIDERS} + options = {'ac_id':DEFAULT_AC_IDS, 'sliders':DEFAULT_SLIDERS, 'port':DEFAULT_PORT} try: - optlist, left_args = getopt.getopt(sys.argv[1:],'h:a:s:', ['help', 'ac_id=', 'sliders=']) + optlist, left_args = getopt.getopt(sys.argv[1:],'h:a:s:p:', ['help', 'ac_id=', 'sliders=', 'port=']) except getopt.GetoptError: # print help information and exit: Usage(sys.argv[0]) @@ -81,6 +84,8 @@ def GetOptions(): options['ac_id'] = [ int(a) ] elif o in ("-s", "--sliders"): options['sliders'] = a.split(':') + elif o in ("-p", "--port"): + options['port'] = a return options @@ -91,7 +96,7 @@ def main(): signal.signal(signal.SIGINT, signal_handler) options = GetOptions() - ivyStick = IvyStick(options['ac_id'], options['sliders']) + ivyStick = IvyStick(options['ac_id'], options['sliders'], options['port']) ivyStick.poll() if __name__ == '__main__': diff --git a/sw/lib/python/settings_xml_parse.py b/sw/lib/python/settings_xml_parse.py index 7acf57f58a9..db8d0642782 100755 --- a/sw/lib/python/settings_xml_parse.py +++ b/sw/lib/python/settings_xml_parse.py @@ -33,19 +33,35 @@ def __init__(self, ac_id): tree = etree.parse(settings_xml_path) index = 0 # keep track of index/id of setting starting at 0 - for the_tab in tree.xpath("//dl_settings[@NAME]"): - setting_group = PaparazziSettingsGroup(the_tab.attrib['NAME']) - - for the_setting in the_tab.xpath('dl_setting[@VAR]'): + for the_tab in tree.xpath("//dl_settings"): + if the_tab.attrib.has_key('NAME'): + setting_group = PaparazziSettingsGroup(the_tab.attrib['NAME']) + elif the_tab.attrib.has_key('NAME'): + setting_group = PaparazziSettingsGroup(the_tab.attrib['name']) + else: + continue + + for the_setting in the_tab.xpath('dl_setting'): if the_setting.attrib.has_key('shortname'): name = the_setting.attrib['shortname'] - else: + elif the_setting.attrib.has_key('VAR'): name = the_setting.attrib['VAR'] + else: + name = the_setting.attrib['var'] settings = PaparazziSetting(name) settings.index = index - settings.min_value = float(the_setting.attrib['MIN']) - settings.max_value = float(the_setting.attrib['MAX']) - settings.step = float(the_setting.attrib['STEP']) + if the_setting.attrib.has_key('MIN'): + settings.min_value = float(the_setting.attrib['MIN']) + else: + settings.min_value = float(the_setting.attrib['min']) + if the_setting.attrib.has_key('MAX'): + settings.max_value = float(the_setting.attrib['MAX']) + else: + settings.max_value = float(the_setting.attrib['max']) + if the_setting.attrib.has_key('STEP'): + settings.step = float(the_setting.attrib['STEP']) + else: + settings.step = float(the_setting.attrib['step']) if (the_setting.attrib.has_key('values')): settings.values = the_setting.attrib['values'].split('|') count = int((settings.max_value - settings.min_value + settings.step) / settings.step) @@ -86,7 +102,7 @@ def __init__(self, shortname): def test(): - ac_id = 11 + ac_id = 164 ac_settings = PaparazziACSettings(ac_id) for setting_group in ac_settings.groups: print setting_group.name