1105 Commits

Author SHA1 Message Date
David Sidrane
01f520dfd2 Kinetis SPI is zero based 2017-09-29 10:13:51 -04:00
David Sidrane
0e55a9e868 micro hal:Kinetis I2C busses are numbered from 0 2017-09-29 10:13:51 -04:00
David Sidrane
1dbe8b8605 Adding Kinetis board common identity to micro hal 2017-09-29 10:13:51 -04:00
David Sidrane
b2b6509ee0 Use micro hal fir px4_savepanic
To keep board_crashdump.c as common code we create a
  wrapper around the arch depandant call to
  stm32_bbsram_savepanic.
2017-09-29 10:13:51 -04:00
David Sidrane
e93a5002a1 Updated Micro HAL for kinetis
Added px4_ abstraction macros
 Removed stm32.h reference
2017-09-29 10:13:51 -04:00
Daniel Agar
af9690cf08 add simple posix tests to SITL 2017-09-28 16:50:47 +01:00
Daniel Agar
0da2dca8c1 drivers remove device _debug_enabled 2017-09-25 10:30:22 -04:00
ChristophTobler
58e09faf9b df trone wrapper: update for new orientation convention
add possibility to specify distance sensor orientation
2017-09-25 08:52:21 +02:00
ChristophTobler
de0c196b2b Bebop rangefinder: update for new orientation convention 2017-09-25 08:52:21 +02:00
Daniel Agar
26f00609ac multirotor_motor_limits only publish for MC 2017-09-19 02:25:30 +01:00
Daniel Agar
681f019ac3 platforms remove extra semicolons 2017-09-16 21:29:52 +01:00
Daniel Agar
e6f2ba9864 bebop_fix fix sign compare 2017-09-07 10:27:36 +02:00
Daniel Agar
8e3efc5135 gpssim fix sign-compare 2017-09-07 10:27:36 +02:00
Daniel Agar
57cffa82f1 posix main fix sign-compare 2017-09-07 10:27:36 +02:00
Daniel Agar
07619cf723 Make NuttX drivers cross platform (VDev -> CDev) 2017-08-31 09:27:36 +02:00
Daniel Agar
b70b8288b9 px4_includes cleanup incomplete list 2017-08-20 20:42:42 +02:00
José Roberto de Souza
925efe990d Initialize all outgoing vehicle_command_ack_s and vehicle_command_s
This will initialize those structs with zero in all fields not set
and all fields set will only be change once to the final value not
wasting CPU time zeroing it.

This will guarantee that no non-unitialized structs will have
a trash value on from_external causing it to be sent to the
MAVLink channel without need it.
2017-08-08 21:46:30 +02:00
David Sidrane
9644f855e3 common:Define default BOARD_NUMBER_I2C_BUSES and BOARD_I2C_BUS_CLOCK_INIT
Define the default I2C buss frequncies that are backward compatible
   with the existing code. While allowing it the defaults to be overridden
   by a board config.

   Based on the legacy STM32 code, the I2C buss numbering starts at 1.
   The bus frequency is stored in a 0 based array. If px4_i2cbus_initialize
   returns a valid device, then the _bus-1 will act as the index to the
   busses frequency.

   A board may define BOARD_NUMBER_I2C_BUSES - the number of I2C busses
   it supports* and BOARD_I2C_BUS_CLOCK_INIT to initalize the bus
   clocks for a given busses.

   BOARD_NUMBER_I2C_BUSES - the number of busses including the *highest
                            number bus. If the board has 2 I2C
                            busses I2C1 and I2C3 BOARD_NUMBER_I2C_BUSES
                            would be set to 3

   BOARD_I2C_BUS_CLOCK_INIT - Initalization for the bus frequencies
                              by bus. A call init, with a frequency
                              less then the value used for the
                              Initalization will result in the device
                              not starting becuase the buss runs too
                              fast for it.
2017-08-08 21:45:01 +02:00
David Sidrane
9a21969189 px4_micro_hal:Define PX4_NUMBER_I2C_BUSES based on the arch/chip
PX4_NUMBER_I2C_BUSES number of busses that the HW can support
  not all of them my be usesd. I.E. The STM32F427 has 3 I2C
  busses but only I2C1 and I2C3 are used.
2017-08-08 21:45:01 +02:00
Peter Duerr
453937a89a Fix va_arg calls (always call va_end)
From the manpage: "Each invocation of va_start() must be matched by a
corresponding invocation of va_end() in the same function."
2017-08-07 22:05:54 +02:00
Peter Duerr
5be23060e7 Fix resource leaks identified by cppcheck
* Where possible rearrange error checks to avoid branching
* Otherwise add missing `fclose`, `close`, `px4_close` calls before return
2017-08-07 22:05:17 +02:00
Beat Küng
1942641ff6 semaphore: add px4_sem_trywait
directly mapped to the posix method sem_trywait
2017-08-04 18:08:51 +02:00
Lorenz Meier
b07dde78e3 Move scheduling priorities into px4_tasks to simplify header usage 2017-08-02 21:18:35 +02:00
Lorenz Meier
9d49690f17 GPS simulation: Manage delays correctly
The GPS simulation now mimicks the real driver more closely and should provide even GPS delays. The delays themselves are set by the simulator, and default to 120 ms for Gazebo
2017-08-02 13:06:59 +02:00
Lorenz Meier
d69c53827f HRT sim: Remove outputs that smash simulator stack 2017-08-01 20:25:38 +02:00
Lorenz Meier
1c0dd8ba49 Simulator: Add scaling API to adjust for slow simulators
The simulation engine had the ability to pause already and properly handled load spikes, however, it was not hardened against constant drift. This addition enables it to run at a constant slower-than-realtime rate successfully.
2017-08-01 19:50:35 +02:00
Lorenz Meier
cf7d4fc1a7 GPS sim: Adjust delay closer to what real u-blox devices do 2017-08-01 19:50:35 +02:00
Beat Küng
b1215a6ddd px4_shutdown_request: make sure we release the lock in every case
board_shutdown should not return, but just in case
2017-07-29 23:10:47 +02:00
Beat Küng
c5a1d1928d px4_shutdown_unlock: check that counter is > 0 2017-07-29 23:10:47 +02:00
Beat Küng
dcb5f80180 shutdown: increase the max timeout to 5s
To make sure slow param writes will finish before we hit the timeout. I've
seen param write durations of around 2s.
2017-07-29 23:10:47 +02:00
Beat Küng
898a8dcd57 shutdown: add px4_shutdown_{lock,unlock} API methods
Prevents the system from shutting down.
2017-07-29 23:10:47 +02:00
Beat Küng
2815c62acf fix power button shutdown: use an orb topic instead of a work queue call
px4_shutdown_request() was called from the power button IRQ callback, which
invoked a work queue callback. But on NuttX, the work queue uses a
semaphore, and thus it cannot be called from IRQ context.
This patch switches to publishing an uORB msg instead, which is handled in
the commander main thread.

To increase failure resistance, we could subscribe to the same topic in
another module for redundancy, in case commander runs wild.
2017-07-29 23:10:47 +02:00
Lorenz Meier
61b0a81bf9 HITL startup: Further simplification of boot logic in commander 2017-07-29 23:06:50 +02:00
Beat Küng
0109154c43 logger: avoid logging the UUID if the system does not provide it
The linux targets don't have it and setting a fixed constant causes
wrong vehicle associationss in Flight Review.
2017-07-24 09:01:02 +02:00
Beat Küng
42f7e6bca3 px4_defines: make sure that PX4_ROOTFSDIR is a string 2017-07-21 19:59:45 +02:00
David Sidrane
8e8510f398 Added Power Brick related battery_status.msg fields
system_source - This battery status is for the brick that is
                   supplying VDD_5V_IN
   priority      - Zero based, This battery status is for the brick
                   that is connected to the Power controller's
                   N-1 priority input. V1..VN. 0 would normally be
                   Brick1, 1 for Brick2 etc

  Battery now assigns connected from the api in the
  updateBatteryStatus, as well as system_source and priority
2017-07-17 21:02:50 -10:00
David Sidrane
4349f49610 PX4 System:Expunge the nuttx adc structure from the system
This PR is preliminary ground work for FMUv5.

   PX4 does not use the NuttX adc driver. But used the same format
   for the data returned by the nuttx ADC driver.

   There was a fixme:in src/platforms/px4_adc.h "this needs to be
   a px4_adc_msg_s type" With this PR the need for
   src/platforms/px4_adc.h goes away as the driver drv_adc.h now
   describes the px4_adc_msg_t.
2017-07-17 22:28:29 +02:00
Nicolae Rosia
5618f34f3b Remove usage of waitForUpdate/updateNotify, there are no users of this feature.
Signed-off-by: Nicolae Rosia <nicolae.rosia@gmail.com>
2017-07-15 09:50:24 +08:00
Nicolae Rosia
67987d27d8 barosim: revamp driver
Current driver was copy pasted from a MS5611 driver.
The existing driver takes data from Simulator, not from
an actual device.

Signed-off-by: Nicolae Rosia <nicolae.rosia@gmail.com>
2017-07-15 09:50:24 +08:00
Beat Küng
3b64be44f4 ModuleBase: add wait_until_running() method 2017-07-14 11:57:11 +02:00
Beat Küng
053eb12329 Module documentation: switch to Markdown 2017-07-14 11:57:11 +02:00
Beat Küng
63af349bba px4_module.h: include <cstring> for strcmp() 2017-07-14 11:57:11 +02:00
Beat Küng
59bde454b5 ModuleBase: instanciate -> instantiate 2017-07-14 11:57:11 +02:00
Beat Küng
04c4339ca3 module: add a common module base class with usage printf methods
Provides:
- thread-safety for module start/stop
- some shared code for module start/stop. Should also be less prone to
  errors.
- constructor & destructors are called from within the new module thread
- can be used for work queue & thread modules
- strutured & formal way for module printf usage & module documentation

Limitation:
- supports only modules with one instance (eg. not mavlink)
2017-07-14 11:57:11 +02:00
Daniel Agar
eb067291bf airspeed sensors apply offset separately 2017-07-06 10:05:07 -04:00
Lorenz Meier
1acf547e8b POSIX: Move C/C++ separation 2017-07-02 21:50:42 +02:00
Lorenz Meier
a6ef6c6e33 SITL Launcher: gzserver must be running when gzclient connects 2017-06-27 11:59:29 +02:00
Lorenz Meier
dea467bdbd POSIX: Make sure we do not run out of PX4 file descriptors 2017-06-27 11:59:29 +02:00
Daniel Agar
f947205cbe delete vehicle_global_velocity_setpoint 2017-06-26 11:31:25 -04:00
Daniel Agar
6a443765a5 cmake only include mavlink where used 2017-06-19 20:24:09 +02:00