Compare commits

...

205 Commits

Author SHA1 Message Date
Roman f13bbacd52 mc_att_control: copy sensor_correction topic once initially
Signed-off-by: Roman <bapstroman@gmail.com>
2018-11-12 21:00:28 -05:00
Daniel Agar 82aa24adfc tap_esc increase stack 1100 -> 1180 bytes 2018-10-19 20:11:14 -04:00
Daniel Agar a7969de738 cmake fix BUILD_URI 2018-10-19 20:11:14 -04:00
Daniel Agar 33e86d25b9 FMU relocate MOT_SLEW_MAX and THR_MDL_FAC parameters centrally 2018-10-19 20:11:14 -04:00
Daniel Agar 805dfc4312 PWM parameters centralize under sensors and add aux 7&8 2018-10-19 20:11:14 -04:00
Daniel Agar ab2d595224 FMU PWM parameters respect instance for MAIN/AUX usage 2018-10-19 20:11:14 -04:00
Philipp Oettershagen ab044e274d Navigator: Fix fixed-wing first order altitude hold (#9850)
i.e. the altitude reference oscillations caused by it in LOITER mode
2018-10-19 20:11:14 -04:00
Daniel Agar b0f766d90e mavlink MOUNT_ORIENTATION use math::degrees 2018-10-19 20:11:14 -04:00
Daniel Agar 2bb9d7e91f mavlink properly wrap heading fields
- fixes #9867
2018-10-19 20:11:14 -04:00
Beat Küng 5f8c08db79 mavlink_ulog: clear potential existing ulog_stream messages on start
- the uorb behavior got recently changed so that we now need to clear
  any potential existing messages when we start log streaming.
- ulog_stream_ack should also not use a queue, since the ack is done
  synchonous between mavlink and the logger.
2018-09-13 12:56:00 +02:00
DanielePettenuzzo a936dc291e airspeed drivers: add PX4_I2C_BUS_ONBOARD as possible bus 2018-08-03 13:41:56 +02:00
DanielePettenuzzo 42dc2bd890 rc.sensors: look for airspeed sensors on all busses 2018-08-03 13:41:56 +02:00
DanielePettenuzzo 9d878c719d ets_airspeed: add -a flag to scan all i2c busses during start 2018-08-03 13:41:56 +02:00
DanielePettenuzzo 649d4be185 sdp3x_airspeed: add -a flag to scan all i2c busses during start 2018-08-03 13:41:56 +02:00
DanielePettenuzzo bec74085f1 ms5525_airspeed: add -a flag to scan all i2c busses during start 2018-08-03 13:41:56 +02:00
DanielePettenuzzo 350df41e42 ms4525_airspeed: remove i2c_bus parameter from start function (it tries all busses) 2018-08-03 13:41:56 +02:00
DanielePettenuzzo 95295b30e8 ms4525_airspeed: change start_bus from bool to int 2018-08-03 13:41:56 +02:00
DanielePettenuzzo dd044ed4be ms4525_airspeed: remove PX4_I2C_ALL 2018-08-03 13:41:56 +02:00
DanielePettenuzzo 9b2e32c976 ms4525_airspeed: add -a flag to scan all i2c busses during start 2018-08-03 13:41:56 +02:00
Roman e1bca8d01a mavlink: fixed nullptr dereferencing in case unknown mavlink message is
forwarded

Signed-off-by: Roman <bapstroman@gmail.com>
2018-08-02 15:09:03 +02:00
Lorenz Meier 96443b3cf3 Update README 2018-06-19 08:23:34 +02:00
Beat Küng d1343b0ccb calibration_routines: fix 'Command denied during calibration' error message
The uorb subscribe logic got changed for queued topics with
https://github.com/PX4/Firmware/pull/9436, meaning an orb_subscribe will
return past messages as well now.

This lead to an error 'Command denied during calibration' for the previously
received calibration start command.
2018-06-18 15:06:58 +02:00
PX4 Jenkins 1fac3a1cee Update submodule sitl_gazebo to latest Sat Jun 16 21:27:20 EDT 2018
- sitl_gazebo in PX4/Firmware (ebc40067c7): https://github.com/PX4/sitl_gazebo/commit/8a3166bf5d315274cfd503a75880e9837faa9694
    - sitl_gazebo current upstream: https://github.com/PX4/sitl_gazebo/commit/b5a92095bfb1b6a218a80f58ad9fe09c89ef4598
    - Changes: https://github.com/PX4/sitl_gazebo/compare/8a3166bf5d315274cfd503a75880e9837faa9694...b5a92095bfb1b6a218a80f58ad9fe09c89ef4598

    b5a9209 2018-06-10 TSC21 - travis_ci: Add OSX build
2018-06-17 10:30:44 +02:00
rolandash ebc40067c7 otherwise posix_sitl_rtps fail to build (MACOS) 2018-06-16 10:13:33 +02:00
Lorenz Meier d14d31df14 PX4IO: Initialize all channels to zero
This sets all channels to zero, including unused channels. Any consumer of the data using the channel count will not see a difference, but this is helpful to avoid confusion in log analysis.
2018-06-16 00:05:18 +02:00
PX4 Jenkins af07d4b37b Update submodule apps to latest Fri Jun 15 15:25:42 UTC 2018
- apps in PX4/Firmware (1bc4a73eaacdb40f7d3f5ebd11882913b541b419): https://github.com/PX4-NuttX/apps/commit/7e2f17db4e770e65ee39b1a964cf4644720d976c
    - apps current upstream: https://github.com/PX4-NuttX/apps/commit/36806ba3d84c0fa07ed86857d4c92a997b7cd194
    - Changes: https://github.com/PX4-NuttX/apps/compare/7e2f17db4e770e65ee39b1a964cf4644720d976c...36806ba3d84c0fa07ed86857d4c92a997b7cd194

    36806ba 2018-06-06 Beat Küng - nsh_parse.c: fix 'while' and 'until' loop condition
2018-06-15 11:56:15 -04:00
PX4 Jenkins 499337ad7f Update submodule v2.0 to latest Fri Jun 15 15:25:36 UTC 2018
- v2.0 in PX4/Firmware (a19fecad94): https://github.com/mavlink/c_library_v2/commit/653ac745a57794a38c831f1ff296066a2e09c09b
    - v2.0 current upstream: https://github.com/mavlink/c_library_v2/commit/033fa8e7a4a75a0c3f17cea57e3be8966e05f770
    - Changes: https://github.com/mavlink/c_library_v2/compare/653ac745a57794a38c831f1ff296066a2e09c09b...033fa8e7a4a75a0c3f17cea57e3be8966e05f770

    033fa8e 2018-05-24 PX4BuildBot - autogenerated headers for rev https://github.com/mavlink/mavlink/tree/d8ea87b9c6173ad72a032219588e302eb8cb212a
2018-06-15 11:55:52 -04:00
David Sidrane a19fecad94 Removed zero termination as a for constuct was used 2018-06-15 17:08:01 +02:00
David Sidrane 3e0928d9ea Changed variable type and used cpp array init. 2018-06-15 17:08:01 +02:00
David Sidrane 22b8a6c57e Fixed capitalization grammar 2018-06-15 17:08:01 +02:00
David Sidrane afc8fe39df Rename trigger argument for clarity 2018-06-15 17:08:01 +02:00
David Sidrane 4e5e0c6921 camera_trigger:Refacter GPIO camera triggering
Refactored for efficiency and simplicity.
2018-06-15 17:08:01 +02:00
Beat Küng ff365cad08 rtl: change "RTL: land at home" message from critical to info 2018-06-15 15:53:28 +02:00
Beat Küng 04db56638e ecl: update submodule
contains:
- https://github.com/PX4/ecl/pull/460
- https://github.com/PX4/ecl/pull/462
2018-06-15 15:53:28 +02:00
Anthony Lamping e263af359e launch: make px4 required (#9682) 2018-06-14 20:37:25 -04:00
DanielePettenuzzo 1da87aa173 Vl53lxx Driver Coverity Fixes (#9671) 2018-06-14 20:36:43 -04:00
David Sidrane 3098b09bbd Updated submudule platforms/nuttx/NuttX/nuttx
to include [BACKPORT] Merged in kekiefer/nuttx/stm32f7-serial-fix-tiocssinglewire-upstream
2018-06-14 17:25:24 -04:00
Beat Küng 229b1274d0 fix camera_trigger gpio: _pins[i] == 0 is valid
Because _pins[i] is set from parameter value - 1
2018-06-14 15:03:39 -04:00
David Sidrane a38b94c7dd BUGFIX:GPS not working. Invalid values passed to px4_arch_configgpio
This is the root cause of https://github.com/PX4/Firmware/issues/9461
   The _pins array was initialized to -1. It was used to index the
   _gpios array. The value at _gpios[-1] was a number that mapped to
   Analog mode on Port A pin 0. These is the UART4_TX pin and was
   being reconfigured by the fault in the camera_trigger to an
   alaog input.
2018-06-14 15:03:39 -04:00
David Sidrane ae389ed0e3 Revert "gps: reopen the gps port on failed auto-detection"
This reverts commit a62a71f48f.
   The root cause was the camera trigger passing invalid pin
   configuration setting overwriting the UART4 TX pin setting
2018-06-14 15:03:39 -04:00
Roman Bapst 27fa29787d updated sitl_gazebo: use asphalt plane instead of uneven ground to reduce (#9675)
computational load in optical flow simulation

Signed-off-by: Roman <bapstroman@gmail.com>
2018-06-14 14:28:28 -04:00
Daniel Agar 322c7ad5da Jenkins SITL tests completely wipe workspace (#9677) 2018-06-14 14:27:35 -04:00
Beat Küng b66f0f36a5 ros tests: add an interactive flag & disable the PX4 shell for ROS tests (#9672) 2018-06-14 12:37:47 -04:00
Philipp Oettershagen 753ad0e0df Fixed-wing autoland: Fix bug that could cause a steep pitch increase and thus aircraft stall during the flare (#9674) 2018-06-14 11:29:03 -04:00
Oleg Kalachev 23cd6adbe7 precland: put land precision parameter to MAVLink mission item 2018-06-13 23:32:51 -04:00
Oleg Kalachev 86d3603e2d precland: fix landing target pose validity checking
In precland the copter may switch to horizontal approach state with an
old landing target pose message.
2018-06-13 23:32:51 -04:00
Beat Küng 036b59f3de posix main: convert c to a char when extending add_string 2018-06-13 16:19:34 +02:00
Beat Küng f241e49ebf voted_sensors_update: initialize _last_magnetometer & _last_airdata 2018-06-13 16:19:34 +02:00
Beat Küng 20f2303e8a test_mixer: fix resource leak (unclosed dp) 2018-06-13 16:19:34 +02:00
Beat Küng 76c94b08f1 PositionControl: use constant references instead of pass-by-value for structs 2018-06-13 16:19:34 +02:00
Beat Küng 5cc450c7cb srf02: fix resource leak (unclosed fd) 2018-06-13 16:19:34 +02:00
Beat Küng ab94bf1d60 batt_smbus: initialize _last_report 2018-06-13 16:19:34 +02:00
Beat Küng 4eda0ed782 posix main shell: fix getchar() return value and check for EOF to avoid busy loop 2018-06-13 16:19:34 +02:00
Beat Küng 226d7c79da sensors: initialize adc only if BOARD_NUMBER_BRICKS > 0
Fixes the SITL startup error:
ERROR [sensors] no ADC found: /dev/adc0 (9)

Introduced in 8404889098
2018-06-13 15:54:45 +02:00
Beat Küng 08064c2b71 mavlink_main: remove nonexisting streams
Removes SITL startup warnings:
WARN  [mavlink] stream SCALED_IMU2 not found
WARN  [mavlink] stream SCALED_IMU3 not found

Introduced in 9122725052
2018-06-13 15:54:45 +02:00
Ivo Drescher 42ebbd14bb Changed the intendation to tabs
Signed-off-by: Ivo Drescher <ivo.drescher@gmail.com>
2018-06-13 12:46:42 +02:00
Ivo Drescher 77d4554e6d Modified comment about feed forward of yaw setpoint rate.
Added more explanations regarding the coordinate transformation.

Signed-off-by: Ivo Drescher <ivo.drescher@gmail.com>
2018-06-13 12:46:42 +02:00
johannes b583c5f69a ekf-tools: fix late start early end buffer, split imu checks
analyse_logdata_ekf:
- fix the buffer to start the analyses 5s after takeoff and end
them 5s before landing for logs that start or finish in air
- add flag for turning on-off 5s late start early end buffer
- split the combined imu sensor check into checks for vibration,
bias and output predictor
2018-06-13 08:37:48 +02:00
Daniel Agar daa6f29b58 commander ignore failsafe transitions when in mission and disarmed 2018-06-13 08:37:00 +02:00
Anthony Lamping aa625d9af8 Jenkins rm duplicate sitl build node def, don't checkout scm for S3 upload 2018-06-12 19:08:51 -04:00
Anthony Lamping fc2e7e4dc4 Jenkins tests verbose package extract and list workspace on failure 2018-06-12 19:08:51 -04:00
Daniel Agar f24353d02a Jenkins artifacts don't allow empty and skip test builds 2018-06-12 19:08:51 -04:00
Daniel Agar b183764dc7 cmake nuttx fix upload target 2018-06-12 16:46:21 -04:00
Daniel Agar 44ad3c98ad Update submodule matrix to latest Tue Jun 12 15:14:08 CDT 2018 (#9649)
- matrix in PX4/Firmware (ed6db94ec0f1ce2b6e4a975229c51fb5e3ff559a): https://github.com/PX4/Matrix/commit/03a3e3ad46d21bb90e78f8cedd3526d24617df5f
    - matrix current upstream: https://github.com/PX4/Matrix/commit/b815fc97c4e686a93a8074f27d1830a031b0d38d
    - Changes: https://github.com/PX4/Matrix/compare/03a3e3ad46d21bb90e78f8cedd3526d24617df5f...b815fc97c4e686a93a8074f27d1830a031b0d38d

    b815fc9 2018-06-12 Roman Bapst - replace quiet_NaN() with INFINITY (#70)
2018-06-12 16:45:51 -04:00
David Sidrane 8aa1d4d68d BUGFIX hardfault FMUv5 List was used before being initalized.
_uavcan_open_request_list was accessed before it was initalized.
2018-06-12 13:44:04 -07:00
PX4 Jenkins 55728ab129 Update submodule nuttx to latest Tue Jun 12 15:14:01 CDT 2018
- nuttx in PX4/Firmware (ed7eb8b4b4f792b8c373692812c8e255669f482e): https://github.com/PX4-NuttX/nuttx/commit/0ac630e6d0e90480121c74d59a92676f0b951dce
    - nuttx current upstream: https://github.com/PX4-NuttX/nuttx/commit/80e58380a8d2b4da0f29eee7e0a820abf0d9f793
    - Changes: https://github.com/PX4-NuttX/nuttx/compare/0ac630e6d0e90480121c74d59a92676f0b951dce...80e58380a8d2b4da0f29eee7e0a820abf0d9f793

    80e5838 2018-06-07 David Sidrane - [REJECTED] When console is absent preserve stdio fd numbering.
2018-06-12 13:43:03 -07:00
David Sidrane b42794f3b9 Updated libuavcan to 883cba97 + NuttX IRQ patch 2018-06-12 13:01:12 -07:00
Florian Achermann 4697bf428b Navigator Fix: Do not set the closest mission item in normal mission mode (#9646)
- fixes #9606
2018-06-12 12:11:14 -04:00
Beat Küng 9151351b8d l3gd20: add argc check and use px4_getopt 2018-06-12 11:02:50 +02:00
Daniel Agar 4d3ad1b5c3 cmake consistency with build directory and and nuttx binary naming 2018-06-12 10:14:03 +02:00
Daniel Agar 0430520371 Revert "px4io: fix NuttX build"
This reverts commit 27e75920bd.
2018-06-12 10:14:03 +02:00
Daniel Agar 20aabd3566 move systemlib/airspeed to standalone lib 2018-06-12 09:06:30 +02:00
Daniel Agar b23e40ca42 move systemlib/pid to standalone lib 2018-06-12 09:06:30 +02:00
Daniel Agar e468a9bbcc move systemlib/pwm_limit to standalone lib 2018-06-12 09:06:30 +02:00
Daniel Agar 387bc81f26 move systemlib/circuit_breaker.cpp to standalone lib 2018-06-12 09:06:30 +02:00
Daniel Agar 7eeba7b8ca systemlib delete unused board_serial 2018-06-12 09:06:30 +02:00
Daniel Agar 965eaecf4d systemlib printload naming consistency 2018-06-12 09:06:30 +02:00
Daniel Agar dfb98b2a70 systemlib delete unused getopt_long 2018-06-12 09:06:30 +02:00
Daniel Agar f913e062da systemlib delete unused err.c 2018-06-12 09:06:30 +02:00
Daniel Agar d3f7de6f9c systemlib delete unused state_table.h 2018-06-12 09:06:30 +02:00
Daniel Agar d73d20bcce systemlib delete unused systemlib.h 2018-06-12 09:06:30 +02:00
Daniel Agar fda25e9f3a systemlib delete unused ppm_decode 2018-06-12 09:06:30 +02:00
Daniel Agar d0bde9ab2a replace geo _wrap_pi with matrix::wrap_pi 2018-06-12 09:00:52 +02:00
TSC21 518daa4a8d fastrtps: clean up and fix template for client/agent code 2018-06-11 22:54:58 +02:00
Daniel Agar 3399ec9e73 move systemlib/rc_check to commander (the only usage) and convert to c++ 2018-06-11 22:53:38 +02:00
Daniel Agar a6883c3a0d uORB generated header use full name in C define 2018-06-11 22:53:38 +02:00
Julian Oes 27e75920bd px4io: fix NuttX build
This change lead to a build error and is therefore reverted here.
2018-06-11 12:09:36 +02:00
Elia Tarasov 9ccf17dbee add sitl init file for iris_vision model 2018-06-10 21:26:44 -04:00
Elia Tarasov 981db0e21d add iris_vision sitl model 2018-06-10 21:26:44 -04:00
PX4 Jenkins 5d066f95c7 Update submodule matrix to latest Sun Jun 10 18:15:08 UTC 2018
- matrix in PX4/Firmware (a138252aea03ff414ef5b4444c61e2f7d5075ebc): https://github.com/PX4/Matrix/commit/21d47424c6050bb94da5de3f7580a8df66b6fcc7
    - matrix current upstream: https://github.com/PX4/Matrix/commit/03a3e3ad46d21bb90e78f8cedd3526d24617df5f
    - Changes: https://github.com/PX4/Matrix/compare/21d47424c6050bb94da5de3f7580a8df66b6fcc7...03a3e3ad46d21bb90e78f8cedd3526d24617df5f

    03a3e3a 2018-06-09 Daniel Agar - helper_functions add wrap_2pi
abc8f82 2018-06-09 Daniel Agar - travis-ci add codecov.io (#69)
2018-06-10 20:42:33 +02:00
Lorenz Meier 3da459899a Gazebo Sim fix: Remove duplicate message spec causing compile error. 2018-06-10 13:51:19 +02:00
JohannesBrand 3b4d9efc8f ecl_ekf tools: add sideslip and gps fix type to fix bit error (#9619)
analyse_logdata_ekf:
- add sideslip innovation fail check flag to fix wrongly selected
bits for hagl innovation and optical flow innovations
- plot sideslip innovation fail
- add gps fix type fail flag to fix wrongly selected bits for all
gps check fail flags
- plot gps fix type
2018-06-09 21:57:46 -04:00
PX4 Jenkins 7278bdd4ab Update submodule sitl_gazebo to latest Sat Jun 9 21:28:20 UTC 2018
- sitl_gazebo in PX4/Firmware (1b33445c7b): https://github.com/PX4/sitl_gazebo/commit/e8b3624b9dad63a492ae58c1ce8661488128966b
    - sitl_gazebo current upstream: https://github.com/PX4/sitl_gazebo/commit/59f01ae9bd8ee1937be368f9b536fda02bf1aba6
    - Changes: https://github.com/PX4/sitl_gazebo/compare/e8b3624b9dad63a492ae58c1ce8661488128966b...59f01ae9bd8ee1937be368f9b536fda02bf1aba6

    59f01ae 2018-06-07 Julian Oes - cmake: add tinyxml dependency
2018-06-09 17:55:56 -04:00
Daniel Agar 1b33445c7b simulator mavlink set lpos ground truth limits to infinity 2018-06-09 17:24:35 -04:00
PX4 Jenkins fc29e78978 Update submodule ecl to latest Sat Jun 9 15:26:38 CDT 2018
- ecl in PX4/Firmware (f7937d783496e954efc52439148ef66824d9c80a): https://github.com/PX4/ecl/commit/1fdf33b343e361de6410515a0359f3cb7f34d499
    - ecl current upstream: https://github.com/PX4/ecl/commit/d177e96508d2572f6fa8eb7ff41852749c882548
    - Changes: https://github.com/PX4/ecl/compare/1fdf33b343e361de6410515a0359f3cb7f34d499...d177e96508d2572f6fa8eb7ff41852749c882548

    d177e96 2018-06-08 Paul Riseborough - EKF: Fix bug causing slow drift when high rate flow data is used
ee2dc7d 2018-05-30 Paul Riseborough - EKF: Rework optical flow selection logic
e383b6a 2018-05-29 Paul Riseborough - EKF: rework optical flow selection logic
487e6a0 2018-05-28 Paul Riseborough - EKF: enable user selection of auto mag free operation
6bdbe03 2018-05-28 Paul Riseborough - EKF: Fallback to optical flow for all in-flight loss of navigation scenarios
b4d2b8c 2018-05-19 Mohammed Kabir - EKF : introduce new architechture for navigation limits
8a71339 2018-05-19 Paul Riseborough - EKF: Improve ground effect compensation
39697f1 2018-05-18 Paul Riseborough - EKF: rework optical flow switching
1cfe845 2018-05-18 Paul Riseborough - EKF: rework GPS quality check
99a8038 2018-05-18 Paul Riseborough - EKF: improve optical flow GPS quality checking
7f36add 2018-05-18 Paul Riseborough - EKF: scale GPS vertical accuracy check when using optical flow
fc9f532 2018-05-18 Paul Riseborough - EKF: relax range finder data continuity check
93c456f 2018-05-18 Paul Riseborough - EKF: Improve protection against badly conditioned dVel bias covariances
225057a 2018-05-18 Paul Riseborough - EKF: Fix bug preventing use of terrain estimator
adb4a09 2018-05-17 Paul Riseborough - EKF: Fix bug causing large yaw innovations when GPS is lost
f59cd0f 2018-05-16 Paul Riseborough - EKF: Don't make detection of indoor operation dependent on optical flow
1562a82 2018-05-16 Paul Riseborough - EKF: Add parameter to adjust on-ground movement detector sensitivity
ea9e824 2018-05-16 Paul Riseborough - EKF: Improve detection of indoor flight condition
565f992 2018-05-16 Paul Riseborough - EKF: Reduce effect of yaw gyro bias when using optical flow indoors
e10798b 2018-05-16 Paul Riseborough - EKF: Add on ground movement detector
2d3b652 2018-05-15 Paul Riseborough - EKF: Reset yaw gyro bias learning when resuming use of magnetometer
8191068 2018-05-15 Paul Riseborough - EKF: Don't start using mag if optical flow use is interrupted
4889e84 2018-05-15 Paul Riseborough - EKF: Don't fuse multi rotor drag if yaw angle is bad
092a8d8 2018-05-15 Paul Riseborough - EKF: Fix GPS validity time check error
0160aaa 2018-05-15 Paul Riseborough - EKF: Don't use magnetometer with optical flow only nav if GPS checks are failing
8451676 2018-05-14 Paul Riseborough - EKF: Use stricter GPS accuracy test when optical flow is being used
a80b3ab 2018-05-27 Daniel Agar - set MODULE define for each library
2018-06-09 17:24:35 -04:00
Daniel Agar 619cc6aedc mavlink disable conversion helpers and use Matrix 2018-06-09 21:19:33 +02:00
Beat Küng a76c82f5f2 airframes: update 4050 generic 250 racer defaults
- P and D gains are too high for a racer
- default I gain is too low (0.25 is still quite low)
- use the thrust curve param instead of TPA
- improve responsiveness in Manual & increase max tilt angle to 60 degrees
- enable one-shot
- enable high-rate logging profile
- disable RC filter
2018-06-09 17:00:35 +02:00
Daniel Agar a99f75dde2 Mavlink set last sent timestamp to space out initial publication
- remove QURT defines no longer required
2018-06-09 13:38:44 +02:00
Paul Riseborough 98465171aa ecl: include fix for bug affecting use of high frequency optical flow data 2018-06-09 13:38:04 +02:00
Paul Riseborough c84d35e3d7 mc_pos_control: rework height limiter to stay in velocity mode 2018-06-09 13:38:04 +02:00
Paul Riseborough d26da5fa3b mc_pos_control: Improve maximum height limiter
Implements a better method of determining when to switch from velocity to altitude control to keep height limit from being exceeded.
This method removes the overshoot and transients in height caused by the switching of the previous algorithm.
2018-06-09 13:38:04 +02:00
Paul Riseborough f0a1cd197e mc_pos_control: formatting fixes 2018-06-09 13:38:04 +02:00
Paul Riseborough b77845a3c0 mc_pos_control: Fix bug in calculation of altitude limit
The correction for stopping distance applied to the maximum altitude limiter uses the vertical velocity estimate and gives the same offset for both positive (down) and negative (up) velocity.
This calculation has been corrected and simplified and variable names changes to make the functionality clearer.
2018-06-09 13:38:04 +02:00
Paul Riseborough 967b27f131 ecl: rework optical flow selection logic
Fixes a race condition introduced by use of _is_dead-reckoning.
Only runs flow use logic when there is flow data available
2018-06-09 13:38:04 +02:00
Paul Riseborough e3a6528a80 ecl: include fixes to flow selection logic 2018-06-09 13:38:04 +02:00
Paul Riseborough 366e36a07b ekf2: Update parameter description 2018-06-09 13:38:04 +02:00
Paul Riseborough d46ee571ce ecl: test changes to pr-ekfOptFlowFixes 2018-06-09 13:38:04 +02:00
Mohammed Kabir 9a83f55c6a ecl: test PX4/ecl/pull/452 2018-06-09 13:38:04 +02:00
Mohammed Kabir c1169eb38b mc_pos_control : update to use new navigation limits architechture 2018-06-09 13:38:04 +02:00
Mohammed Kabir 8f5ceac936 ekf2 : use INFINITY when altitude limiting is not needed 2018-06-09 13:38:04 +02:00
Mohammed Kabir 1a2f9dd37a land_detector : use INFINITY when altitude limiting is not needed 2018-06-09 13:38:04 +02:00
Mohammed Kabir 31aa1cbf01 simulator : publish optical flow limits over uORB 2018-06-09 13:38:04 +02:00
Mohammed Kabir e8f1d50758 mavlink : update for compatibility with new navigation limits architechture 2018-06-09 13:38:04 +02:00
Mohammed Kabir 1d1dec0a8b inav : update for compatibility with new navigation limits architechture 2018-06-09 13:38:04 +02:00
Mohammed Kabir 9483885ed9 lpe : update for compatibility with new navigation limits architechture 2018-06-09 13:38:04 +02:00
Mohammed Kabir 6a9377846f ekf2 : update to use new navigation limits architechture 2018-06-09 13:38:04 +02:00
Mohammed Kabir 8299f571c8 msg : add height limits to local position 2018-06-09 13:38:04 +02:00
Mohammed Kabir 7f1686171b sensors : add parameter for maximum flow rate 2018-06-09 13:38:04 +02:00
Mohammed Kabir 32a7097018 px4flow : publish sensor limits over uORB 2018-06-09 13:38:04 +02:00
Mohammed Kabir 230d6c5aa2 msg : add sensor limits to optical flow message 2018-06-09 13:38:04 +02:00
Mohammed Kabir b3c5e53333 Unify optical flow height limiting 2018-06-09 13:38:04 +02:00
Paul Riseborough 0113212b34 mc_pos_control: Update parameter descriptions 2018-06-09 13:38:04 +02:00
Paul Riseborough 9e567cadd6 ekf2: Update parameter description 2018-06-09 13:38:04 +02:00
Paul Riseborough 0dc2377c2f mc_pos_control: format fixes 2018-06-09 13:38:04 +02:00
Paul Riseborough 9fb674929c commander: do not check global position when using flow in POSCTL 2018-06-09 13:38:04 +02:00
Paul Riseborough 2c325414f9 mc_pos_control: limit maximum height when reliant on optical flow data 2018-06-09 13:38:04 +02:00
Paul Riseborough 9028592c5f mc_pos_control: control height above ground when reliant on optical flow 2018-06-09 13:38:04 +02:00
Paul Riseborough 98597dcffc commander: allow position uncertainty to grow when operator can correct for drift 2018-06-09 13:38:04 +02:00
Paul Riseborough e5d428bd65 msg: add definitions for estimator status control mode bit positions 2018-06-09 13:38:04 +02:00
Lorenz Meier aee05d0ac5 FMU: Increase stack space as needed (shown by instrumentation) to retain a 300 bytes buffer. 2018-06-08 08:39:14 +02:00
Beat Küng a62a71f48f gps: reopen the gps port on failed auto-detection
work-around for https://github.com/PX4/Firmware/issues/9461
2018-06-07 22:20:47 +02:00
Lorenz Meier f87fa9131b FMUv5: Fix RGB led usage - these are individual status leds. 2018-06-06 23:03:28 +02:00
Lorenz Meier 02eaf2ce28 FMUv5: Fix safety switch led
Both IO and FMU are connected to the safety switch for default models. This needs later to be broken out to a config option for builds that do not contain an IO.
2018-06-06 22:23:24 +02:00
Philipp Oettershagen 9f414e82f6 Subsystem_info status flags & checks: Add comment to indicate that the IMU+MAG consistency checks need to be performed AFTER the individual checks are complete 2018-06-06 18:54:24 +02:00
Philipp Oettershagen e12b470cac Subsystem_info status flags & checks: Small fixes according to @bkueng's review 2018-06-06 18:54:24 +02:00
Philipp Oettershagen 0b71c52225 Subsystem_info status flags & checks: Suppress sensor failover warnings in Hardware in the loop (HITL) 2018-06-06 18:54:24 +02:00
Philipp Oettershagen 302cb0a285 Subsystem_info status flags & checks: Moved the set_health_flags helper functions out of the /lib/ folder and into the module/commander folder because they are actually only needed there 2018-06-06 18:54:24 +02:00
Philipp Oettershagen bd2af289f5 Subsystem_info status flags & checks: Code style fixes and cleanup to avoid strcmp() as suggested by @LorenzMeier 2018-06-06 18:54:24 +02:00
Philipp Oettershagen e4d863b95f Subsystem_info status flags & checks: Separate the functionality to a) set the health flags inside commander and b) to publish them from external modules 2018-06-06 18:54:24 +02:00
Philipp Oettershagen a807d34a7a Remove distance sensor checks again. These checks should be handled by EKF2 and should thus be added there later 2018-06-06 18:54:24 +02:00
Philipp Oettershagen be4ba32cf0 vl53lxx distance sensor: Remove subsystem_info calls because all sensors are now checked inside commander 2018-06-06 18:54:24 +02:00
Philipp Oettershagen 075009be2f Subsystem_info status flags & checks: 1) Set health flags in commander directly instead of publishing via uORB 2) move publish_subsystem_info into lib/ folder" 2018-06-06 18:54:24 +02:00
Philipp Oettershagen f5847a4a7b Subsystem_info status flags & checks: Switch back to uORB for inter-process communication, handle GPS checks completely inside ekf2, add distance_sensor checks 2018-06-06 18:54:24 +02:00
Philipp Oettershagen 6f1f414b49 Subsystem_info status flags & checks : Initial commit, updating the health flags in a centralized way mostly in commander and the votedSensorsUpdate function. 2018-06-06 18:54:24 +02:00
DanielePettenuzzo 40e6a5a39b fmu-v5: fix ms5611 2018-06-06 17:31:33 +02:00
DanielePettenuzzo 2ab5dc2951 fmu-v5: remove i2c3 as bus expansion because used just for internal mag (ONBOARD) 2018-06-06 17:31:33 +02:00
DanielePettenuzzo 7a760ee501 fmu-v5: add PX4_I2C_BUS_EXPANSION1 and 2 to all drivers that check all the busses 2018-06-06 17:31:33 +02:00
MaEtUgR 01afeed967 cmake nuttx upload: add verbatim parameter
to disable automatic evaluation of /dev/ttyS* expression in cygwin.
On linux verbatim seems to be default anyways. At least it doesn't get
evaluated on linux.
2018-06-06 12:32:03 +02:00
Philipp Oettershagen ba2cf5fa9a fw_att_control: Fix stuttering rudder in manual mode (#9607)
fw_att_control: Fix bug that caused the rudder to stutter when FW_RLL_TO_YAW_FF>0 and aileron input was supplied
2018-06-06 12:31:24 +02:00
PX4 Jenkins 64cf043481 Update submodule sitl_gazebo to latest Tue Jun 5 20:26:27 CDT 2018
- sitl_gazebo in PX4/Firmware (bbc104ad4c): https://github.com/PX4/sitl_gazebo/commit/371e7c36c34d7dd45da5602a14a6ee01e9fe74db
    - sitl_gazebo current upstream: https://github.com/PX4/sitl_gazebo/commit/e8b3624b9dad63a492ae58c1ce8661488128966b
    - Changes: https://github.com/PX4/sitl_gazebo/compare/371e7c36c34d7dd45da5602a14a6ee01e9fe74db...e8b3624b9dad63a492ae58c1ce8661488128966b

    e8b3624 2018-06-04 Elia Tarasov - tune gimbal pid gains
54c256d 2018-06-05 Poutshi - Update README.md (#211)
1992b0d 2018-06-05 TSC21 - CMakeLists: fix targe msg links
10b0597 2018-06-01 TSC21 - validade_sdf: fix typo
8fee88e 2018-06-01 TSC21 - travis_ci: add catkin build
de983cc 2018-05-31 TSC21 - generate separate protobuff libs for each msg category
6cb9360 2018-05-31 TSC21 - restructure proto msg API (rename, organize list)
5a250a2 2018-05-31 TSC21 - proto msgs: use PascalCase convention
ea6e2da 2018-05-31 TSC21 - remove the rotors_ prefix from plugin names
7989043 2018-05-31 TSC21 - allow building with the most recent C++ compiler available on the host
b819817 2018-05-31 TSC21 - package.xml: update and reorganize package list
a20bf63 2018-05-31 TSC21 - CMakeLists: reorganize build target and dependecies list
ae7df80 2018-05-31 TSC21 - CMakeLists: remove exception for ROS when building gazebo_geotagged_images_plugin (no longer applicable)
0a4e27b 2018-05-31 TSC21 - CMakeLists: fix typo on building gazebo_motor_failure_plugin
27f977b 2018-05-31 TSC21 - gazebo_mavlink_interface: add support for Gazebo 9 for model_param func
eded9b2 2018-05-31 Elia Tarasov - set default pid gains as constants
29b5424 2018-05-31 Elia Tarasov - add default pid control gains to sdf xml
4caf496 2018-05-30 Elia Tarasov - move pid control gains to sdf xml
2018-06-06 08:40:41 +02:00
githubDLG 563200fee6 fix rgbled On and Powersave value in read mode
fix rgbled On and Powersave value in read mode.
In read mode, the ENABLE and SHDN is in bit 4 and bit5, so we may need a 4bit left shift to get a correct value.
2018-06-06 08:19:18 +02:00
Lorenz Meier bbc104ad4c Added missing fields to IST8310 mag report. 2018-06-05 23:21:53 +02:00
Elia Tarasov 384028aa7b decrease rollrate P gain due to gimbal oscillations 2018-06-05 20:57:08 +02:00
Beat Küng 2fa8783795 mavlink_receiver: implement MAV_CMD_REQUEST_STORAGE_INFORMATION 2018-06-05 14:40:01 +02:00
mcsauder ca5e22583f Remove extra newline in omnibus-f4sd/usb.c to quiet git new blank line at EOF warning. 2018-06-05 09:15:21 +05:30
Beat Küng d1a7a367ac fix px4_getopt: add argc check for options that take an argument
Fixes the following corner case:
mpu9250 start -R
This would return a valid result (myoptind < argc), but myoptind pointed
to a NULL argument (and thus mpu9250 would crash).
With this patch, px4_getopt will return '?', indicating a parser error.
2018-06-04 16:33:55 +02:00
Beat Küng 2de6192f66 position_estimator_inav: add missing return 2018-06-04 16:33:55 +02:00
Beat Küng ad587def24 test_ppm: add argc check 2018-06-04 16:33:55 +02:00
Beat Küng dc7db9d793 iridiumsbd: add argc check 2018-06-04 16:33:55 +02:00
Beat Küng 7c79c1ae9f pwm_input: add argc check 2018-06-04 16:33:55 +02:00
Beat Küng cce3c270c3 lis3mdl: add argc check and use px4_getopt 2018-06-04 16:33:55 +02:00
Beat Küng ffccba12e2 bmm150: add argc check and use px4_getopt 2018-06-04 16:33:55 +02:00
Beat Küng 009b2d4d6b mpu9250: add argc check and use px4_getopt 2018-06-04 16:33:55 +02:00
Beat Küng c2c3780918 mpu6000: add argc check and use px4_getopt 2018-06-04 16:33:55 +02:00
Beat Küng a0d4e7aa90 bmi160: add argc check and use px4_getopt 2018-06-04 16:33:55 +02:00
Beat Küng 8f5fb3d0e5 bma180: add argc check 2018-06-04 16:33:55 +02:00
Beat Küng 7a3b34be74 tfmini: add argc check and fix argv index 2018-06-04 16:33:55 +02:00
Beat Küng eabfac71d6 teraranger: add argc check and fix argv index 2018-06-04 16:33:55 +02:00
Beat Küng 554003b3f1 srf02: add argc check 2018-06-04 16:33:55 +02:00
Beat Küng 490ccc0076 sf1xx: add argc check 2018-06-04 16:33:55 +02:00
Beat Küng 2a7cd392b1 sf0x: add argc check and fix argv index 2018-06-04 16:33:55 +02:00
Beat Küng 85c676316c mb12xx: add argc check and fix argv index 2018-06-04 16:33:55 +02:00
Beat Küng 19933b4d3b sdp3x: add argc check and use px4_getopt 2018-06-04 16:33:55 +02:00
Beat Küng 4b8658a318 ms5525: add argc check and use px4_getopt 2018-06-04 16:33:55 +02:00
Beat Küng d3f9f419f1 ms4525: add argc check and use px4_getopt 2018-06-04 16:33:55 +02:00
Beat Küng 61b4b2df88 ets_airspeed: add argc check and use px4_getopt 2018-06-04 16:33:55 +02:00
Beat Küng ae8439f0af ms5611: add argc check 2018-06-04 16:33:55 +02:00
Beat Küng 7e7905acd1 lps22hb: add argc check and use px4_getopt 2018-06-04 16:33:55 +02:00
Beat Küng 22bc35c048 bmp280: add argc check and use px4_getopt 2018-06-04 16:33:55 +02:00
Beat Küng 5f87545e48 mavlink_messages: fill in all 16 servo channels 2018-06-04 10:55:29 +02:00
Lorenz Meier eb188996d0 Update LICENSE
Update year to 2018
2018-06-03 10:21:56 +02:00
Alessandro Simovic 15a44a059d addressing review comments from #9563 2018-06-02 08:36:35 +02:00
Alessandro Simovic 52c290e234 commander: moved emergency shutdown to end of cycle 2018-06-02 08:36:35 +02:00
mcsauder 861af1dac7 Remove whitespace from the top-level CMakeLists.txt. 2018-06-02 06:22:54 +05:30
Beat Küng 537451c2a0 Debug/Nuttx.py: fix 'mon reg' does not exist
Also there was no register xPSR.

Stack usage calculation is still broken...
2018-06-01 19:27:30 +02:00
Simone Guscetti 700b2c6294 logger: fix overflow on SD card total bytes 2018-06-01 19:27:30 +02:00
Jun-Tao c7cb62eb28 logger: Fix calculation of total and left bytes 2018-06-01 19:27:30 +02:00
Beat Küng f8dd833a14 onmibus-f4sd: add ADC support 2018-05-31 19:13:00 +02:00
Beat Küng acc1cb08d4 omnibus-f4sd cmake config: minor cleanup 2018-05-31 19:13:00 +02:00
Daniel Agar 6ca078425e Jenkins archive nuttx bin file 2018-05-31 07:38:07 +02:00
PX4 Jenkins 35963abddd Update submodule sitl_gazebo to latest Thu May 31 01:26:50 UTC 2018
- sitl_gazebo in PX4/Firmware (1ee08da9c4): https://github.com/PX4/sitl_gazebo/commit/651ca351fd1030870b42528db17e4fe2816d46e5
    - sitl_gazebo current upstream: https://github.com/PX4/sitl_gazebo/commit/371e7c36c34d7dd45da5602a14a6ee01e9fe74db
    - Changes: https://github.com/PX4/sitl_gazebo/compare/651ca351fd1030870b42528db17e4fe2816d46e5...371e7c36c34d7dd45da5602a14a6ee01e9fe74db

    371e7c3 2018-04-10 korotkoves - udp port for each model instance from options file
376258d 2018-04-17 korotkoves - change file format to use common and model specific parameters
b4b7245 2018-01-17 korotkoves - function to load parameters for each model from xml file
2018-05-30 21:08:26 -07:00
johannes 1ee08da9c4 ekf log analysis: fix filter_fault_status and one-off index bug
- analysed_logdata: add filter_fault_status check to test_results
dictionary to prevent a missing entry exception
- analyse_logdata: fix one-off errors of list indices due to python
non-inclusive end indices
2018-05-29 23:43:34 +02:00
Daniel Agar 2fbe1428a3 Jenkins temporarily disable address sanitizer mission test and test codecov 2018-05-29 21:29:24 +02:00
Beat Küng 77cea8844f ROMFS: fix SYS_USE_IO==0
When SYS_USE_IO was disabled, px4io would not start and thus there was no
RC. SYS_USE_IO=0 is interesting on Quads to avoid the IO and reduce output
latency.

Tested on Pixhawk 1 and Pixhawk 4
2018-05-28 19:03:33 +02:00
Beat Küng ae75ff6c72 px4fmu-v5/board_config.h: update BOARD_BATTERY1_V_DIV 2018-05-28 15:38:29 +02:00
Beat Küng 3f00e2e6c2 mavlink mission: send an ack on duplicated last uploaded mission item 2018-05-28 11:57:35 +02:00
acfloria ff4d95168e IridiumSBD: Fix for multiple MT messages
If MT messages are waiting on the server immediately restart a new session.
2018-05-28 09:26:11 +02:00
Hamish Willee 309b5bae98 Fix link to flight reporting page (#9541)
* Fix link to flight reporting page
2018-05-28 09:21:49 +02:00
Daniel Agar 3e843ba2d2 posix main add SIGSEGV handler 2018-05-28 08:40:05 +02:00
Daniel Agar 5234ba49ad Jenkins code coverage build 2018-05-28 08:40:05 +02:00
Hamish Willee 92d4a54012 Delete old issue template 2018-05-28 08:38:12 +02:00
Hamish Willee 1c5c3232fd Fix link to slack (Broken) 2018-05-28 08:37:43 +02:00
Beat Küng 4f1c01de7f fmu params: add MOT_ORDERING to adjust the motor ordering
Useful for 4-in-1 ESCs such as the Hobbywing XRotor Micro 40A 4in1
where the FC can be directly plugged on top.
2018-05-28 08:37:08 +02:00
Daniel Agar e8fa94126e set MODULE_NAME for parameters library and external ecl libraries (#9536) 2018-05-27 14:36:41 -04:00
Daniel Agar 2c7788060d Jenkins mission tests delete old build first 2018-05-27 19:49:25 +02:00
311 changed files with 3116 additions and 3387 deletions
+8 -6
View File
@@ -5,7 +5,7 @@ about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
A clear and concise description of the bug.
**To Reproduce**
Steps to reproduce the behavior:
@@ -18,13 +18,15 @@ Steps to reproduce the behavior:
A clear and concise description of what you expected to happen.
**Log Files and Screenshots**
Always provide the flight log file, add screenshots to help explain your problem.
- Download the flight log file from the vehicle ([tutorial](https://docs.px4.io/en/flight-reporting.html))
- Share the link to a log showing the problem on [PX4 Flight Review](http://logs.px4.io/)
*Always* provide a link to the flight log file:
- Download the flight log file from the vehicle ([tutorial](https://docs.px4.io/en/getting_started/flight_reporting.html)).
- Share the link to a log showing the problem on [PX4 Flight Review](http://logs.px4.io/).
Add screenshots to help explain your problem.
**Drone (please complete the following information):**
- Description of the type of drone
- Photo of the IMU / autopilot setup if possible
- Describe the type of drone.
- Photo of the IMU / autopilot setup if possible.
**Additional context**
Add any other context about the problem here.
+7 -7
View File
@@ -4,16 +4,16 @@ about: Suggest an idea for this project
---
For general questions please use [PX4 Discuss](http://discuss.px4.io/) or [Slack](slack.px4.io).
For general questions please use [PX4 Discuss](http://discuss.px4.io/) or [Slack](http://slack.px4.io/).
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe problem solved by the proposed feature**
A clear and concise description of the problem, if any, this feature will solve. E.g. I'm always frustrated when ...
**Describe the solution you'd like**
**Describe your preferred solution**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Describe possible alternatives**
A clear and concise description of alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
Add any other context or screenshots for the feature request here.
-9
View File
@@ -1,9 +0,0 @@
**Bug Report** or **Feature Request**
For general questions please use [PX4 Discuss](http://discuss.px4.io/) or [Slack](slack.px4.io). Issue reports need to contain the items below:
- Download the flight log file from the vehicle ([tutorial](https://docs.px4.io/en/flight-reporting.html))
- Share the link to a log showing the problem on [PX4 Flight Review](http://logs.px4.io/)
- Expected behavior and actual behavior.
- Steps to reproduce the problem.
- Specifications like the version of the project, operating system, or hardware.
+1 -1
View File
@@ -466,7 +466,7 @@ if ("${CMAKE_SYSTEM}" MATCHES "Linux")
if (EXISTS ${DPKG_PROGRAM})
list (APPEND CPACK_GENERATOR "DEB")
endif()
else()
else()
set(CPACK_GENERATOR "ZIP")
endif()
Vendored
+108 -43
View File
@@ -44,7 +44,7 @@ pipeline {
sh "make nuttx_px4fmu-v3_rtps"
sh "make sizes"
sh "ccache -s"
archiveArtifacts(allowEmptyArchive: true, artifacts: 'build/**/*.px4, build/**/*.elf', fingerprint: true, onlyIfSuccessful: true)
archiveArtifacts(allowEmptyArchive: false, artifacts: 'build/**/*.px4, build/**/*.elf', fingerprint: true, onlyIfSuccessful: true)
sh "make distclean"
}
}
@@ -55,7 +55,7 @@ pipeline {
// nuttx default targets that are archived and uploaded to s3
for (def option in ["px4fmu-v4", "px4fmu-v4pro", "px4fmu-v5", "aerofc-v1", "aerocore2", "auav-x21", "crazyflie", "mindpx-v2", "nxphlite-v3", "tap-v1", "omnibus-f4sd"]) {
def node_name = "${option}"
builds[node_name] = createBuildNode(docker_nuttx, "${node_name}_default")
builds[node_name] = createBuildNodeArchive(docker_nuttx, "${node_name}_default")
}
// other nuttx default targets
@@ -64,7 +64,6 @@ pipeline {
builds[node_name] = createBuildNode(docker_nuttx, "${node_name}_default")
}
builds["sitl"] = createBuildNode(docker_base, 'posix_sitl_default')
builds["sitl_rtps"] = createBuildNode(docker_base, 'posix_sitl_rtps')
builds["sitl (GCC 7)"] = createBuildNode(docker_arch, 'posix_sitl_default')
@@ -264,24 +263,51 @@ pipeline {
}
}
stage('tests (address sanitizer)') {
agent {
docker {
image 'px4io/px4-dev-base:2018-03-30'
args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
}
}
environment {
PX4_ASAN = 1
ASAN_OPTIONS = "color=always:check_initialization_order=1:detect_stack_use_after_return=1"
}
steps {
sh 'export'
sh 'make distclean'
sh 'make tests'
sh 'make distclean'
}
}
// TODO: PX4 requires clean shutdown first
// stage('tests (address sanitizer)') {
// agent {
// docker {
// image 'px4io/px4-dev-base:2018-03-30'
// args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
// }
// }
// environment {
// PX4_ASAN = 1
// ASAN_OPTIONS = "color=always:check_initialization_order=1:detect_stack_use_after_return=1"
// }
// steps {
// sh 'export'
// sh 'make distclean'
// sh 'make tests'
// sh 'make distclean'
// }
// }
// TODO: test and re-enable once GDB is available in px4-dev-ros
// stage('tests (code coverage)') {
// agent {
// docker {
// image 'px4io/px4-dev-ros:2018-03-30'
// args '-e CCACHE_BASEDIR=$WORKSPACE -v ${CCACHE_DIR}:${CCACHE_DIR}:rw'
// }
// }
// steps {
// sh 'export'
// sh 'make distclean'
// sh 'ulimit -c unlimited; make tests_coverage'
// sh 'ls'
// withCredentials([string(credentialsId: 'FIRMWARE_CODECOV_TOKEN', variable: 'CODECOV_TOKEN')]) {
// sh 'curl -s https://codecov.io/bash | bash -s'
// }
// sh 'make distclean'
// }
// post {
// failure {
// sh('find . -name core')
// sh('gdb --batch --quiet -ex "thread apply all bt full" -ex "quit" build/posix_sitl_default/px4 core')
// }
// }
// }
stage('check stack') {
agent {
@@ -310,9 +336,9 @@ pipeline {
}
steps {
sh 'export'
sh 'rm -rf .ros; rm -rf .gazebo'
sh 'rm -rf build; rm -rf px4-posix_sitl_default*; rm -rf .ros; rm -rf .gazebo'
unstash 'px4_sitl_package'
sh 'tar -xjpf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'tar -xjpvf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'px4-posix_sitl_default*/px4/test/rostest_px4_run.sh mavros_posix_test_mission.test mission:=vtol_new_1 vehicle:=standard_vtol'
sh 'px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py `find . -name *.ulg -print -quit`'
}
@@ -321,8 +347,10 @@ pipeline {
sh 'px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/rootfs/fs/microsd/log/*/*.ulg'
archiveArtifacts '.ros/**/*.pdf'
archiveArtifacts '.ros/**/*.csv'
deleteDir()
}
failure {
sh 'ls -a'
archiveArtifacts '.ros/**/*.ulg'
archiveArtifacts '.ros/**/rosunit-*.xml'
archiveArtifacts '.ros/**/rostest-*.log'
@@ -342,9 +370,9 @@ pipeline {
}
steps {
sh 'export'
sh 'rm -rf .ros; rm -rf .gazebo'
sh 'rm -rf build; rm -rf px4-posix_sitl_default*; rm -rf .ros; rm -rf .gazebo'
unstash 'px4_sitl_package'
sh 'tar -xjpf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'tar -xjpvf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'px4-posix_sitl_default*/px4/test/rostest_px4_run.sh mavros_posix_test_mission.test mission:=vtol_new_1 vehicle:=tailsitter'
sh 'px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py `find . -name *.ulg -print -quit`'
}
@@ -353,8 +381,10 @@ pipeline {
sh 'px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/rootfs/fs/microsd/log/*/*.ulg'
archiveArtifacts '.ros/**/*.pdf'
archiveArtifacts '.ros/**/*.csv'
deleteDir()
}
failure {
sh 'ls -a'
archiveArtifacts '.ros/**/*.ulg'
archiveArtifacts '.ros/**/rosunit-*.xml'
archiveArtifacts '.ros/**/rostest-*.log'
@@ -374,9 +404,9 @@ pipeline {
}
steps {
sh 'export'
sh 'rm -rf .ros; rm -rf .gazebo'
sh 'rm -rf build; rm -rf px4-posix_sitl_default*; rm -rf .ros; rm -rf .gazebo'
unstash 'px4_sitl_package'
sh 'tar -xjpf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'tar -xjpvf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'px4-posix_sitl_default*/px4/test/rostest_px4_run.sh mavros_posix_test_mission.test mission:=vtol_new_1 vehicle:=tiltrotor'
sh 'px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py `find . -name *.ulg -print -quit`'
}
@@ -385,8 +415,10 @@ pipeline {
sh 'px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/rootfs/fs/microsd/log/*/*.ulg'
archiveArtifacts '.ros/**/*.pdf'
archiveArtifacts '.ros/**/*.csv'
deleteDir()
}
failure {
sh 'ls -a'
archiveArtifacts '.ros/**/*.ulg'
archiveArtifacts '.ros/**/rosunit-*.xml'
archiveArtifacts '.ros/**/rostest-*.log'
@@ -406,9 +438,9 @@ pipeline {
}
steps {
sh 'export'
sh 'rm -rf .ros; rm -rf .gazebo'
sh 'rm -rf build; rm -rf px4-posix_sitl_default*; rm -rf .ros; rm -rf .gazebo'
unstash 'px4_sitl_package'
sh 'tar -xjpf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'tar -xjpvf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'px4-posix_sitl_default*/px4/test/rostest_px4_run.sh mavros_posix_test_mission.test mission:=vtol_new_2 vehicle:=standard_vtol'
sh 'px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py `find . -name *.ulg -print -quit`'
}
@@ -417,8 +449,10 @@ pipeline {
sh 'px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/rootfs/fs/microsd/log/*/*.ulg'
archiveArtifacts '.ros/**/*.pdf'
archiveArtifacts '.ros/**/*.csv'
deleteDir()
}
failure {
sh 'ls -a'
archiveArtifacts '.ros/**/*.ulg'
archiveArtifacts '.ros/**/rosunit-*.xml'
archiveArtifacts '.ros/**/rostest-*.log'
@@ -438,9 +472,9 @@ pipeline {
}
steps {
sh 'export'
sh 'rm -rf .ros; rm -rf .gazebo'
sh 'rm -rf build; rm -rf px4-posix_sitl_default*; rm -rf .ros; rm -rf .gazebo'
unstash 'px4_sitl_package'
sh 'tar -xjpf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'tar -xjpvf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'px4-posix_sitl_default*/px4/test/rostest_px4_run.sh mavros_posix_test_mission.test mission:=vtol_old_1 vehicle:=standard_vtol'
sh 'px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py `find . -name *.ulg -print -quit`'
}
@@ -449,8 +483,10 @@ pipeline {
sh 'px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/rootfs/fs/microsd/log/*/*.ulg'
archiveArtifacts '.ros/**/*.pdf'
archiveArtifacts '.ros/**/*.csv'
deleteDir()
}
failure {
sh 'ls -a'
archiveArtifacts '.ros/**/*.ulg'
archiveArtifacts '.ros/**/rosunit-*.xml'
archiveArtifacts '.ros/**/rostest-*.log'
@@ -470,9 +506,9 @@ pipeline {
}
steps {
sh 'export'
sh 'rm -rf .ros; rm -rf .gazebo'
sh 'rm -rf build; rm -rf px4-posix_sitl_default*; rm -rf .ros; rm -rf .gazebo'
unstash 'px4_sitl_package'
sh 'tar -xjpf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'tar -xjpvf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'px4-posix_sitl_default*/px4/test/rostest_px4_run.sh mavros_posix_test_mission.test mission:=vtol_old_2 vehicle:=standard_vtol'
sh 'px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py `find . -name *.ulg -print -quit`'
}
@@ -481,8 +517,10 @@ pipeline {
sh 'px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/rootfs/fs/microsd/log/*/*.ulg'
archiveArtifacts '.ros/**/*.pdf'
archiveArtifacts '.ros/**/*.csv'
deleteDir()
}
failure {
sh 'ls -a'
archiveArtifacts '.ros/**/*.ulg'
archiveArtifacts '.ros/**/rosunit-*.xml'
archiveArtifacts '.ros/**/rostest-*.log'
@@ -502,9 +540,9 @@ pipeline {
}
steps {
sh 'export'
sh 'rm -rf .ros; rm -rf .gazebo'
sh 'rm -rf build; rm -rf px4-posix_sitl_default*; rm -rf .ros; rm -rf .gazebo'
unstash 'px4_sitl_package'
sh 'tar -xjpf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'tar -xjpvf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'px4-posix_sitl_default*/px4/test/rostest_px4_run.sh mavros_posix_test_mission.test mission:=multirotor_box vehicle:=iris'
sh 'px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py `find . -name *.ulg -print -quit`'
}
@@ -513,8 +551,10 @@ pipeline {
sh 'px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/rootfs/fs/microsd/log/*/*.ulg'
archiveArtifacts '.ros/**/*.pdf'
archiveArtifacts '.ros/**/*.csv'
deleteDir()
}
failure {
sh 'ls -a'
archiveArtifacts '.ros/**/*.ulg'
archiveArtifacts '.ros/**/rosunit-*.xml'
archiveArtifacts '.ros/**/rostest-*.log'
@@ -534,9 +574,9 @@ pipeline {
}
steps {
sh 'export'
sh 'rm -rf .ros; rm -rf .gazebo'
sh 'rm -rf build; rm -rf px4-posix_sitl_default*; rm -rf .ros; rm -rf .gazebo'
unstash 'px4_sitl_package'
sh 'tar -xjpf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'tar -xjpvf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'px4-posix_sitl_default*/px4/test/rostest_px4_run.sh mavros_posix_tests_offboard_attctl.test'
sh 'px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py `find . -name *.ulg -print -quit`'
}
@@ -545,8 +585,10 @@ pipeline {
sh 'px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/rootfs/fs/microsd/log/*/*.ulg'
archiveArtifacts '.ros/**/*.pdf'
archiveArtifacts '.ros/**/*.csv'
deleteDir()
}
failure {
sh 'ls -a'
archiveArtifacts '.ros/**/*.ulg'
archiveArtifacts '.ros/**/rosunit-*.xml'
archiveArtifacts '.ros/**/rostest-*.log'
@@ -563,9 +605,9 @@ pipeline {
}
steps {
sh 'export'
sh 'rm -rf .ros; rm -rf .gazebo'
sh 'rm -rf build; rm -rf px4-posix_sitl_default*; rm -rf .ros; rm -rf .gazebo'
unstash 'px4_sitl_package'
sh 'tar -xjpf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'tar -xjpvf build/posix_sitl_default/px4-posix_sitl_default*.bz2'
sh 'px4-posix_sitl_default*/px4/test/rostest_px4_run.sh mavros_posix_tests_offboard_posctl.test'
sh 'px4-posix_sitl_default*/px4/Tools/ecl_ekf/process_logdata_ekf.py `find . -name *.ulg -print -quit`'
}
@@ -574,8 +616,10 @@ pipeline {
sh 'px4-posix_sitl_default*/px4/Tools/upload_log.py -q --description "${JOB_NAME}: ${STAGE_NAME}" --feedback "${JOB_NAME} ${CHANGE_TITLE} ${CHANGE_URL}" --source CI .ros/rootfs/fs/microsd/log/*/*.ulg'
archiveArtifacts '.ros/**/*.pdf'
archiveArtifacts '.ros/**/*.csv'
deleteDir()
}
failure {
sh 'ls -a'
archiveArtifacts '.ros/**/*.ulg'
archiveArtifacts '.ros/**/rosunit-*.xml'
archiveArtifacts '.ros/**/rostest-*.log'
@@ -644,11 +688,14 @@ pipeline {
}
}
// TODO: actually upload artifacts to S3
stage('S3 Upload') {
agent {
docker { image 'px4io/px4-dev-base:2018-03-30' }
}
options {
skipDefaultCheckout()
}
when {
anyOf {
branch 'master'
@@ -656,7 +703,6 @@ pipeline {
branch 'stable'
}
}
steps {
sh 'echo "uploading to S3"'
}
@@ -686,7 +732,27 @@ def createBuildNode(String docker_repo, String target) {
sh('make ' + target)
sh('ccache -s')
sh('make sizes')
archiveArtifacts(allowEmptyArchive: true, artifacts: 'build/**/*.px4, build/**/*.elf', fingerprint: true, onlyIfSuccessful: true)
sh('make distclean')
}
}
}
}
}
def createBuildNodeArchive(String docker_repo, String target) {
return {
node {
docker.image(docker_repo).inside('-e CCACHE_BASEDIR=${WORKSPACE} -v ${CCACHE_DIR}:${CCACHE_DIR}:rw') {
stage(target) {
sh('export')
checkout scm
sh('make distclean')
sh('git fetch --tags')
sh('ccache -z')
sh('make ' + target)
sh('ccache -s')
sh('make sizes')
archiveArtifacts(allowEmptyArchive: false, artifacts: 'build/**/*.px4, build/**/*.elf, build/**/*.bin', fingerprint: true, onlyIfSuccessful: true)
sh('make distclean')
}
}
@@ -708,7 +774,6 @@ def createBuildNodeDockerLogin(String docker_repo, String docker_credentials, St
sh('make ' + target)
sh('ccache -s')
sh('make sizes')
archiveArtifacts(allowEmptyArchive: true, artifacts: 'build/**/*.px4, build/**/*.elf', fingerprint: true, onlyIfSuccessful: true)
sh('make distclean')
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
BSD 3-Clause License
Copyright (c) 2012 - 2017, PX4 Development Team
Copyright (c) 2012 - 2018, PX4 Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
+6 -10
View File
@@ -120,10 +120,11 @@ endif
# --------------------------------------------------------------------
# describe how to build a cmake config
define cmake-build
+@$(eval BUILD_DIR = $(SRC_DIR)/build/$@$(BUILD_DIR_SUFFIX))
+@$(eval PX4_CONFIG = $(1))
+@$(eval BUILD_DIR = $(SRC_DIR)/build/$(PX4_CONFIG)$(BUILD_DIR_SUFFIX))
+@if [ $(PX4_CMAKE_GENERATOR) = "Ninja" ] && [ -e $(BUILD_DIR)/Makefile ]; then rm -rf $(BUILD_DIR); fi
+@if [ ! -e $(BUILD_DIR)/CMakeCache.txt ]; then mkdir -p $(BUILD_DIR) && cd $(BUILD_DIR) && cmake $(2) -G"$(PX4_CMAKE_GENERATOR)" $(CMAKE_ARGS) -DCONFIG=$(1) || (rm -rf $(BUILD_DIR)); fi
+@(cd $(BUILD_DIR) && $(PX4_MAKE) $(PX4_MAKE_ARGS) $(ARGS))
+@if [ ! -e $(BUILD_DIR)/CMakeCache.txt ]; then mkdir -p $(BUILD_DIR) && cd $(BUILD_DIR) && cmake $(SRC_DIR) -G"$(PX4_CMAKE_GENERATOR)" $(CMAKE_ARGS) -DCONFIG=$(PX4_CONFIG) || (rm -rf $(BUILD_DIR)); fi
+@$(PX4_MAKE) -C $(BUILD_DIR) $(PX4_MAKE_ARGS) $(ARGS)
endef
COLOR_BLUE = \033[0;94m
@@ -144,13 +145,13 @@ NUTTX_CONFIG_TARGETS := $(patsubst nuttx_%,%,$(filter nuttx_%,$(ALL_CONFIG_TARGE
# All targets.
$(ALL_CONFIG_TARGETS):
$(call cmake-build,$@,$(SRC_DIR))
$(call cmake-build,$@)
# Abbreviated config targets.
# nuttx_ is left off by default; provide a rule to allow that.
$(NUTTX_CONFIG_TARGETS):
$(call cmake-build,nuttx_$@,$(SRC_DIR))
$(call cmake-build,nuttx_$@)
all_nuttx_targets: $(NUTTX_CONFIG_TARGETS)
@@ -288,11 +289,6 @@ tests:
tests_coverage:
@$(MAKE) clean
@$(MAKE) --no-print-directory posix_sitl_default PX4_CMAKE_BUILD_TYPE=Coverage
@$(MAKE) --no-print-directory posix_sitl_default sitl_gazebo PX4_CMAKE_BUILD_TYPE=Coverage
@$(SRC_DIR)/test/rostest_px4_run.sh mavros_posix_tests_missions.test
@$(SRC_DIR)/test/rostest_px4_run.sh mavros_posix_tests_offboard_attctl.test
@$(SRC_DIR)/test/rostest_px4_run.sh mavros_posix_tests_offboard_posctl.test
@$(MAKE) --no-print-directory posix_sitl_default test_coverage_genhtml PX4_CMAKE_BUILD_TYPE=Coverage
@echo "Open $(SRC_DIR)/build/posix_sitl_default/coverage-html/index.html to see coverage"
+1 -1
View File
@@ -35,7 +35,7 @@ See the [forum and chat](https://dev.px4.io/en/#support) if you need help!
The PX4 Dev Team syncs up on a [weekly dev call](https://dev.px4.io/en/contribute/#dev_call).
> **Note** The dev call is open to all interested developers (not just the core dev team). This is a great opportunity to meet the team and contribute to the ongoing development of the platform. It includes a QA session for newcomers.
> **Note** The dev call is open to all interested developers (not just the core dev team). This is a great opportunity to meet the team and contribute to the ongoing development of the platform. It includes a QA session for newcomers. All regular calls are listed in the [Dronecode calendar](https://www.dronecode.org/calendar/).
## Maintenance Team
+22 -16
View File
@@ -13,32 +13,38 @@ sh /etc/init.d/4001_quad_x
if [ $AUTOCNF == yes ]
then
param set MC_ROLL_P 8.0
param set MC_ROLLRATE_P 0.19
param set MC_ROLLRATE_I 0.1
param set MC_ROLLRATE_D 0.0055
param set MC_ROLLRATE_P 0.08
param set MC_ROLLRATE_I 0.25
param set MC_ROLLRATE_D 0.001
param set MC_PITCH_P 8.0
param set MC_PITCHRATE_P 0.19
param set MC_PITCHRATE_I 0.1
param set MC_PITCHRATE_D 0.0055
param set MC_PITCHRATE_P 0.08
param set MC_PITCHRATE_I 0.25
param set MC_PITCHRATE_D 0.001
param set MC_YAW_P 4.0
param set MC_YAWRATE_P 0.2
param set MC_YAWRATE_I 0.1
param set MC_YAWRATE_D 0.0
param set MC_YAW_FF 0.5
param set MC_ROLLRATE_MAX 720.0
param set MC_PITCHRATE_MAX 720.0
param set MC_YAWRATE_MAX 400.0
param set MC_ACRO_R_MAX 360.0
param set MC_ACRO_P_MAX 360.0
param set MC_TPA_BREAK_P 0.5
param set MC_TPA_RATE_P 0.5
param set MC_ROLLRATE_MAX 1600.0
param set MC_PITCHRATE_MAX 1600.0
param set MC_YAWRATE_MAX 1000.0
param set MPC_MANTHR_MIN 0.0
param set MPC_MAN_TILT_MAX 60
# use thrust curve factor (instead of TPA)
param set THR_MDL_FAC 0.3
param set PWM_MIN 1075
# enable one-shot
param set PWM_RATE 0
param set MPC_THR_MIN 0.06
param set MPC_MANTHR_MIN 0.06
# enable high-rate logging profile (helps with tuning)
param set SDLOG_PROFILE 19
param set ATT_BIAS_MAX 0.0
# disable RC filtering
param set RC_FLT_CUTOFF 0.00000
param set CBRK_IO_SAFETY 22027
fi
+5
View File
@@ -125,6 +125,11 @@ then
set MIXER_AUX none
fi
if [ $USE_IO == no ]
then
set MIXER_AUX none
fi
if [ $MIXER_AUX != none -a $AUX_MODE != none ]
then
#
+7 -16
View File
@@ -280,6 +280,8 @@ then
hmc5883 -X start
bmp280 start
adc start
fi
if ver hwcmp PX4FMU_V4PRO
@@ -341,11 +343,7 @@ if [ ${VEHICLE_TYPE} == fw -o ${VEHICLE_TYPE} == vtol ]
then
if param compare CBRK_AIRSPD_CHK 0
then
if sdp3x_airspeed start
then
else
sdp3x_airspeed start -b 2
fi
sdp3x_airspeed start -a
# Pixhawk 2.1 has a MS5611 on I2C which gets wrongly
# detected as MS5525 because the chip manufacturer was so
@@ -355,20 +353,13 @@ then
then
ms5525_airspeed start -b 2
else
ms5525_airspeed start
ms5525_airspeed start -a
fi
if ms4525_airspeed start
then
else
ms4525_airspeed start -b 2
fi
ms4525_airspeed start -a
ets_airspeed start -a
if ets_airspeed start
then
else
ets_airspeed start -b 1
fi
fi
fi
+40 -43
View File
@@ -321,60 +321,57 @@ then
set IO_PRESENT no
if [ $USE_IO == yes ]
#
# Check if PX4IO present and update firmware if needed
#
if [ -f /etc/extras/px4io-v2.bin ]
then
#
# Check if PX4IO present and update firmware if needed
#
if [ -f /etc/extras/px4io-v2.bin ]
set IO_FILE /etc/extras/px4io-v2.bin
if px4io checkcrc ${IO_FILE}
then
set IO_FILE /etc/extras/px4io-v2.bin
set IO_PRESENT yes
else
tone_alarm MLL32CP8MB
if px4io checkcrc ${IO_FILE}
if px4io start
then
set IO_PRESENT yes
else
tone_alarm MLL32CP8MB
if px4io start
# try to safe px4 io so motor outputs dont go crazy
if px4io safety_on
then
# try to safe px4 io so motor outputs dont go crazy
if px4io safety_on
then
# success! no-op
else
# px4io did not respond to the safety command
px4io stop
fi
fi
if px4io forceupdate 14662 ${IO_FILE}
then
usleep 10000
if px4io checkcrc ${IO_FILE}
then
echo "PX4IO CRC OK after updating" >> $LOG_FILE
tone_alarm MLL8CDE
set IO_PRESENT yes
else
echo "PX4IO update failed" >> $LOG_FILE
tone_alarm ${TUNE_ERR}
fi
# success! no-op
else
echo "PX4IO update failed" >> $LOG_FILE
tune_control play -m ${TUNE_ERR}
# px4io did not respond to the safety command
px4io stop
fi
fi
fi
unset IO_FILE
if [ $IO_PRESENT == no ]
then
echo "PX4IO not found" >> $LOG_FILE
tune_control play -m ${TUNE_ERR}
if px4io forceupdate 14662 ${IO_FILE}
then
usleep 10000
if px4io checkcrc ${IO_FILE}
then
echo "PX4IO CRC OK after updating" >> $LOG_FILE
tone_alarm MLL8CDE
set IO_PRESENT yes
else
echo "PX4IO update failed" >> $LOG_FILE
tone_alarm ${TUNE_ERR}
fi
else
echo "PX4IO update failed" >> $LOG_FILE
tune_control play -m ${TUNE_ERR}
fi
fi
fi
unset IO_FILE
if [ $USE_IO == yes -a $IO_PRESENT == no ]
then
echo "PX4IO not found" >> $LOG_FILE
tune_control play -m ${TUNE_ERR}
fi
#
# Set default output if not set
+117 -83
View File
@@ -8,7 +8,7 @@ import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
def analyse_ekf(estimator_status, ekf2_innovations, sensor_preflight, check_levels,
plot=False, output_plot_filename=None):
plot=False, output_plot_filename=None, late_start_early_ending=True):
if plot:
# create summary plots
@@ -502,6 +502,11 @@ def analyse_ekf(estimator_status, ekf2_innovations, sensor_preflight, check_leve
using_evpos = ((2 ** 12 & estimator_status['control_mode_flags']) > 0) * 1
using_evyaw = ((2 ** 13 & estimator_status['control_mode_flags']) > 0) * 1
using_evhgt = ((2 ** 14 & estimator_status['control_mode_flags']) > 0) * 1
# define flags for starting and finishing in air
b_starts_in_air = False
b_finishes_in_air = False
# calculate in-air transition time
if (np.amin(airborne) < 0.5) and (np.amax(airborne) > 0.5):
in_air_transtion_time_arg = np.argmax(np.diff(airborne))
@@ -509,6 +514,7 @@ def analyse_ekf(estimator_status, ekf2_innovations, sensor_preflight, check_leve
elif (np.amax(airborne) > 0.5):
in_air_transition_time = np.amin(status_time)
print('log starts while in-air at ' + str(round(in_air_transition_time, 1)) + ' sec')
b_starts_in_air = True
else:
in_air_transition_time = float('NaN')
print('always on ground')
@@ -519,6 +525,7 @@ def analyse_ekf(estimator_status, ekf2_innovations, sensor_preflight, check_leve
elif (np.amax(airborne) > 0.5):
on_ground_transition_time = np.amax(status_time)
print('log finishes while in-air at ' + str(round(on_ground_transition_time, 1)) + ' sec')
b_finishes_in_air = True
else:
on_ground_transition_time = float('NaN')
print('always on ground')
@@ -710,9 +717,10 @@ def analyse_ekf(estimator_status, ekf2_innovations, sensor_preflight, check_leve
# 5 - true if the Z magnetometer observation has been rejected
# 6 - true if the yaw observation has been rejected
# 7 - true if the airspeed observation has been rejected
# 8 - true if the height above ground observation has been rejected
# 9 - true if the X optical flow observation has been rejected
# 10 - true if the Y optical flow observation has been rejected
# 8 - true if synthetic sideslip observation has been rejected
# 9 - true if the height above ground observation has been rejected
# 10 - true if the X optical flow observation has been rejected
# 11 - true if the Y optical flow observation has been rejected
vel_innov_fail = ((2 ** 0 & estimator_status['innovation_check_flags']) > 0) * 1
posh_innov_fail = ((2 ** 1 & estimator_status['innovation_check_flags']) > 0) * 1
posv_innov_fail = ((2 ** 2 & estimator_status['innovation_check_flags']) > 0) * 1
@@ -721,14 +729,15 @@ def analyse_ekf(estimator_status, ekf2_innovations, sensor_preflight, check_leve
magz_innov_fail = ((2 ** 5 & estimator_status['innovation_check_flags']) > 0) * 1
yaw_innov_fail = ((2 ** 6 & estimator_status['innovation_check_flags']) > 0) * 1
tas_innov_fail = ((2 ** 7 & estimator_status['innovation_check_flags']) > 0) * 1
hagl_innov_fail = ((2 ** 8 & estimator_status['innovation_check_flags']) > 0) * 1
ofx_innov_fail = ((2 ** 9 & estimator_status['innovation_check_flags']) > 0) * 1
ofy_innov_fail = ((2 ** 10 & estimator_status['innovation_check_flags']) > 0) * 1
sli_innov_fail = ((2 ** 8 & estimator_status['innovation_check_flags']) > 0) * 1
hagl_innov_fail = ((2 ** 9 & estimator_status['innovation_check_flags']) > 0) * 1
ofx_innov_fail = ((2 ** 10 & estimator_status['innovation_check_flags']) > 0) * 1
ofy_innov_fail = ((2 ** 11 & estimator_status['innovation_check_flags']) > 0) * 1
if plot:
# plot innovation_check_flags summary
plt.figure(11, figsize=(20, 13))
plt.subplot(5, 1, 1)
plt.subplot(6, 1, 1)
plt.title('EKF Innovation Test Fails')
plt.plot(status_time, vel_innov_fail, 'b', label='vel NED')
plt.plot(status_time, posh_innov_fail, 'r', label='pos NE')
@@ -736,14 +745,14 @@ def analyse_ekf(estimator_status, ekf2_innovations, sensor_preflight, check_leve
plt.ylabel('failed')
plt.legend(loc='upper left')
plt.grid()
plt.subplot(5, 1, 2)
plt.subplot(6, 1, 2)
plt.plot(status_time, posv_innov_fail, 'b', label='hgt absolute')
plt.plot(status_time, hagl_innov_fail, 'r', label='hgt above ground')
plt.ylim(-0.1, 1.1)
plt.ylabel('failed')
plt.legend(loc='upper left')
plt.grid()
plt.subplot(5, 1, 3)
plt.subplot(6, 1, 3)
plt.plot(status_time, magx_innov_fail, 'b', label='mag_x')
plt.plot(status_time, magy_innov_fail, 'r', label='mag_y')
plt.plot(status_time, magz_innov_fail, 'g', label='mag_z')
@@ -752,13 +761,19 @@ def analyse_ekf(estimator_status, ekf2_innovations, sensor_preflight, check_leve
plt.ylim(-0.1, 1.1)
plt.ylabel('failed')
plt.grid()
plt.subplot(5, 1, 4)
plt.subplot(6, 1, 4)
plt.plot(status_time, tas_innov_fail, 'b', label='airspeed')
plt.ylim(-0.1, 1.1)
plt.ylabel('failed')
plt.legend(loc='upper left')
plt.grid()
plt.subplot(5, 1, 5)
plt.subplot(6, 1, 5)
plt.plot(status_time, sli_innov_fail, 'b', label='sideslip')
plt.ylim(-0.1, 1.1)
plt.ylabel('failed')
plt.legend(loc='upper left')
plt.grid()
plt.subplot(6, 1, 6)
plt.plot(status_time, ofx_innov_fail, 'b', label='flow X')
plt.plot(status_time, ofy_innov_fail, 'r', label='flow Y')
plt.ylim(-0.1, 1.1)
@@ -770,26 +785,29 @@ def analyse_ekf(estimator_status, ekf2_innovations, sensor_preflight, check_leve
plt.close(11)
# gps_check_fail_flags summary
plt.figure(12, figsize=(20, 13))
# 0 : minimum required sat count fail
# 1 : minimum required GDoP fail
# 2 : maximum allowed horizontal position error fail
# 3 : maximum allowed vertical position error fail
# 4 : maximum allowed speed error fail
# 5 : maximum allowed horizontal position drift fail
# 6 : maximum allowed vertical position drift fail
# 7 : maximum allowed horizontal speed fail
# 8 : maximum allowed vertical velocity discrepancy fail
nsat_fail = ((2 ** 0 & estimator_status['gps_check_fail_flags']) > 0) * 1
gdop_fail = ((2 ** 1 & estimator_status['gps_check_fail_flags']) > 0) * 1
herr_fail = ((2 ** 2 & estimator_status['gps_check_fail_flags']) > 0) * 1
verr_fail = ((2 ** 3 & estimator_status['gps_check_fail_flags']) > 0) * 1
serr_fail = ((2 ** 4 & estimator_status['gps_check_fail_flags']) > 0) * 1
hdrift_fail = ((2 ** 5 & estimator_status['gps_check_fail_flags']) > 0) * 1
vdrift_fail = ((2 ** 6 & estimator_status['gps_check_fail_flags']) > 0) * 1
hspd_fail = ((2 ** 7 & estimator_status['gps_check_fail_flags']) > 0) * 1
veld_diff_fail = ((2 ** 8 & estimator_status['gps_check_fail_flags']) > 0) * 1
# 0 : insufficient fix type (no 3D solution)
# 1 : minimum required sat count fail
# 2 : minimum required GDoP fail
# 3 : maximum allowed horizontal position error fail
# 4 : maximum allowed vertical position error fail
# 5 : maximum allowed speed error fail
# 6 : maximum allowed horizontal position drift fail
# 7 : maximum allowed vertical position drift fail
# 8 : maximum allowed horizontal speed fail
# 9 : maximum allowed vertical velocity discrepancy fail
gfix_fail = ((2 ** 0 & estimator_status['gps_check_fail_flags']) > 0) * 1
nsat_fail = ((2 ** 1 & estimator_status['gps_check_fail_flags']) > 0) * 1
gdop_fail = ((2 ** 2 & estimator_status['gps_check_fail_flags']) > 0) * 1
herr_fail = ((2 ** 3 & estimator_status['gps_check_fail_flags']) > 0) * 1
verr_fail = ((2 ** 4 & estimator_status['gps_check_fail_flags']) > 0) * 1
serr_fail = ((2 ** 5 & estimator_status['gps_check_fail_flags']) > 0) * 1
hdrift_fail = ((2 ** 6 & estimator_status['gps_check_fail_flags']) > 0) * 1
vdrift_fail = ((2 ** 7 & estimator_status['gps_check_fail_flags']) > 0) * 1
hspd_fail = ((2 ** 8 & estimator_status['gps_check_fail_flags']) > 0) * 1
veld_diff_fail = ((2 ** 9 & estimator_status['gps_check_fail_flags']) > 0) * 1
plt.subplot(2, 1, 1)
plt.title('GPS Direct Output Check Failures')
plt.plot(status_time, gfix_fail, 'k', label='fix type')
plt.plot(status_time, nsat_fail, 'b', label='N sats')
plt.plot(status_time, gdop_fail, 'r', label='GDOP')
plt.plot(status_time, herr_fail, 'g', label='horiz pos error')
@@ -997,22 +1015,27 @@ def analyse_ekf(estimator_status, ekf2_innovations, sensor_preflight, check_leve
plt.close("all")
# Do some automated analysis of the status data
# find a late/early index range from 5 sec after in_air_transtion_time to 5 sec before on-ground transition time for mag and optical flow checks to avoid false positives
# this can be used to prevent false positives for sensors adversely affected by close proximity to the ground
late_start_index = np.amin(np.where(status_time > (in_air_transition_time + 5.0)))
early_end_index = np.amax(np.where(status_time < (on_ground_transition_time - 5.0)))
num_valid_values_trimmed = (early_end_index - late_start_index + 1)
# normal index range is defined by the flight duration
start_index = np.amin(np.where(status_time > in_air_transition_time))
end_index = np.amax(np.where(status_time < on_ground_transition_time))
end_index = np.amax(np.where(status_time <= on_ground_transition_time))
num_valid_values = (end_index - start_index + 1)
# find a late/early index range from 5 sec after in_air_transtion_time to 5 sec before on-ground transition time for mag and optical flow checks to avoid false positives
# this can be used to prevent false positives for sensors adversely affected by close proximity to the ground
# don't do this if the log starts or finishes in air or if it is shut off by flag
late_start_index = np.amin(np.where(status_time > (in_air_transition_time + 5.0)))\
if (late_start_early_ending and not b_starts_in_air) else start_index
early_end_index = np.amax(np.where(status_time <= (on_ground_transition_time - 5.0))) \
if (late_start_early_ending and not b_finishes_in_air) else end_index
num_valid_values_trimmed = (early_end_index - late_start_index + 1)
# also find the start and finish indexes for the innovation data
innov_late_start_index = np.amin(np.where(innov_time > (in_air_transition_time + 5.0)))
innov_early_end_index = np.amax(np.where(innov_time < (on_ground_transition_time - 5.0)))
innov_num_valid_values_trimmed = (innov_early_end_index - innov_late_start_index + 1)
innov_start_index = np.amin(np.where(innov_time > in_air_transition_time))
innov_end_index = np.amax(np.where(innov_time < on_ground_transition_time))
innov_end_index = np.amax(np.where(innov_time <= on_ground_transition_time))
innov_num_valid_values = (innov_end_index - innov_start_index + 1)
innov_late_start_index = np.amin(np.where(innov_time > (in_air_transition_time + 5.0))) \
if (late_start_early_ending and not b_starts_in_air) else innov_start_index
innov_early_end_index = np.amax(np.where(innov_time <= (on_ground_transition_time - 5.0))) \
if (late_start_early_ending and not b_finishes_in_air) else innov_end_index
innov_num_valid_values_trimmed = (innov_early_end_index - innov_late_start_index + 1)
# define dictionary of test results and descriptions
test_results = {
'master_status': ['Pass',
@@ -1033,8 +1056,16 @@ def analyse_ekf(estimator_status, ekf2_innovations, sensor_preflight, check_leve
'Airspeed sensor check summary. A Fail result indicates a significant error that caused a significant reduction in vehicle navigation performance was detected. A Warning result indicates that error levels higher than normal were detected but these errors did not significantly impact navigation performance. A Pass result indicates that no amonalies were detected and no further investigation is required'],
'imu_sensor_status': ['Pass',
'IMU sensor check summary. A Fail result indicates a significant error that caused a significant reduction in vehicle navigation performance was detected. A Warning result indicates that error levels higher than normal were detected but these errors did not significantly impact navigation performance. A Pass result indicates that no amonalies were detected and no further investigation is required'],
'imu_vibration_check': ['Pass',
'IMU vibration check summary. A Fail result indicates a significant error that caused a significant reduction in vehicle navigation performance was detected. A Warning result indicates that error levels higher than normal were detected but these errors did not significantly impact navigation performance. A Pass result indicates that no amonalies were detected and no further investigation is required'],
'imu_bias_check': ['Pass',
'IMU bias check summary. A Fail result indicates a significant error that caused a significant reduction in vehicle navigation performance was detected. A Warning result indicates that error levels higher than normal were detected but these errors did not significantly impact navigation performance. A Pass result indicates that no amonalies were detected and no further investigation is required'],
'imu_output_predictor_check': ['Pass',
'IMU output predictor check summary. A Fail result indicates a significant error that caused a significant reduction in vehicle navigation performance was detected. A Warning result indicates that error levels higher than normal were detected but these errors did not significantly impact navigation performance. A Pass result indicates that no amonalies were detected and no further investigation is required'],
'flow_sensor_status': ['Pass',
'Optical Flow sensor check summary. A Fail result indicates a significant error that caused a significant reduction in vehicle navigation performance was detected. A Warning result indicates that error levels higher than normal were detected but these errors did not significantly impact navigation performance. A Pass result indicates that no amonalies were detected and no further investigation is required'],
'filter_fault_status': ['Pass',
'Internal Filter check summary. A Fail result indicates a significant error that caused a significant reduction in vehicle navigation performance was detected. A Warning result indicates that error levels higher than normal were detected but these errors did not significantly impact navigation performance. A Pass result indicates that no amonalies were detected and no further investigation is required'],
'mag_percentage_red': [float('NaN'),
'The percentage of in-flight consolidated magnetic field sensor innovation consistency test values > 1.0.'],
'mag_percentage_amber': [float('NaN'),
@@ -1138,105 +1169,105 @@ def analyse_ekf(estimator_status, ekf2_innovations, sensor_preflight, check_leve
if (innov_early_end_index > (innov_late_start_index + 100)):
# Output Observer Tracking Errors
test_results['output_obs_ang_err_median'][0] = np.median(
ekf2_innovations['output_tracking_error[0]'][innov_late_start_index:innov_early_end_index])
ekf2_innovations['output_tracking_error[0]'][innov_late_start_index:innov_early_end_index + 1])
test_results['output_obs_vel_err_median'][0] = np.median(
ekf2_innovations['output_tracking_error[1]'][innov_late_start_index:innov_early_end_index])
ekf2_innovations['output_tracking_error[1]'][innov_late_start_index:innov_early_end_index + 1])
test_results['output_obs_pos_err_median'][0] = np.median(
ekf2_innovations['output_tracking_error[2]'][innov_late_start_index:innov_early_end_index])
ekf2_innovations['output_tracking_error[2]'][innov_late_start_index:innov_early_end_index + 1])
# reduction of status message data
if (early_end_index > (late_start_index + 100)):
# IMU vibration checks
temp = np.amax(estimator_status['vibe[0]'][late_start_index:early_end_index])
if (temp > 0.0):
test_results['imu_coning_peak'][0] = temp
test_results['imu_coning_mean'][0] = np.mean(estimator_status['vibe[0]'][late_start_index:early_end_index])
test_results['imu_coning_mean'][0] = np.mean(estimator_status['vibe[0]'][late_start_index:early_end_index + 1])
temp = np.amax(estimator_status['vibe[1]'][late_start_index:early_end_index])
if (temp > 0.0):
test_results['imu_hfdang_peak'][0] = temp
test_results['imu_hfdang_mean'][0] = np.mean(estimator_status['vibe[1]'][late_start_index:early_end_index])
test_results['imu_hfdang_mean'][0] = np.mean(estimator_status['vibe[1]'][late_start_index:early_end_index + 1])
temp = np.amax(estimator_status['vibe[2]'][late_start_index:early_end_index])
if (temp > 0.0):
test_results['imu_hfdvel_peak'][0] = temp
test_results['imu_hfdvel_mean'][0] = np.mean(estimator_status['vibe[2]'][late_start_index:early_end_index])
test_results['imu_hfdvel_mean'][0] = np.mean(estimator_status['vibe[2]'][late_start_index:early_end_index + 1])
# Magnetometer Sensor Checks
if (np.amax(yaw_aligned) > 0.5):
mag_num_red = (estimator_status['mag_test_ratio'][start_index:end_index] > 1.0).sum()
mag_num_amber = (estimator_status['mag_test_ratio'][start_index:end_index] > 0.5).sum() - mag_num_red
mag_num_red = (estimator_status['mag_test_ratio'][start_index:end_index + 1] > 1.0).sum()
mag_num_amber = (estimator_status['mag_test_ratio'][start_index:end_index + 1] > 0.5).sum() - mag_num_red
test_results['mag_percentage_red'][0] = 100.0 * mag_num_red / num_valid_values_trimmed
test_results['mag_percentage_amber'][0] = 100.0 * mag_num_amber / num_valid_values_trimmed
test_results['mag_test_max'][0] = np.amax(
estimator_status['mag_test_ratio'][late_start_index:early_end_index])
estimator_status['mag_test_ratio'][late_start_index:early_end_index + 1])
test_results['mag_test_mean'][0] = np.mean(estimator_status['mag_test_ratio'][start_index:end_index])
test_results['magx_fail_percentage'][0] = 100.0 * (
magx_innov_fail[late_start_index:early_end_index] > 0.5).sum() / num_valid_values_trimmed
magx_innov_fail[late_start_index:early_end_index + 1] > 0.5).sum() / num_valid_values_trimmed
test_results['magy_fail_percentage'][0] = 100.0 * (
magy_innov_fail[late_start_index:early_end_index] > 0.5).sum() / num_valid_values_trimmed
magy_innov_fail[late_start_index:early_end_index + 1] > 0.5).sum() / num_valid_values_trimmed
test_results['magz_fail_percentage'][0] = 100.0 * (
magz_innov_fail[late_start_index:early_end_index] > 0.5).sum() / num_valid_values_trimmed
magz_innov_fail[late_start_index:early_end_index + 1] > 0.5).sum() / num_valid_values_trimmed
test_results['yaw_fail_percentage'][0] = 100.0 * (
yaw_innov_fail[late_start_index:early_end_index] > 0.5).sum() / num_valid_values_trimmed
yaw_innov_fail[late_start_index:early_end_index + 1] > 0.5).sum() / num_valid_values_trimmed
# Velocity Sensor Checks
if (np.amax(using_gps) > 0.5):
vel_num_red = (estimator_status['vel_test_ratio'][start_index:end_index] > 1.0).sum()
vel_num_amber = (estimator_status['vel_test_ratio'][start_index:end_index] > 0.5).sum() - vel_num_red
vel_num_red = (estimator_status['vel_test_ratio'][start_index:end_index + 1] > 1.0).sum()
vel_num_amber = (estimator_status['vel_test_ratio'][start_index:end_index + 1] > 0.5).sum() - vel_num_red
test_results['vel_percentage_red'][0] = 100.0 * vel_num_red / num_valid_values
test_results['vel_percentage_amber'][0] = 100.0 * vel_num_amber / num_valid_values
test_results['vel_test_max'][0] = np.amax(estimator_status['vel_test_ratio'][start_index:end_index])
test_results['vel_test_mean'][0] = np.mean(estimator_status['vel_test_ratio'][start_index:end_index])
test_results['vel_test_max'][0] = np.amax(estimator_status['vel_test_ratio'][start_index:end_index + 1])
test_results['vel_test_mean'][0] = np.mean(estimator_status['vel_test_ratio'][start_index:end_index + 1])
test_results['vel_fail_percentage'][0] = 100.0 * (
vel_innov_fail[start_index:end_index] > 0.5).sum() / num_valid_values
vel_innov_fail[start_index:end_index + 1] > 0.5).sum() / num_valid_values
# Position Sensor Checks
if ((np.amax(using_gps) > 0.5) or (np.amax(using_evpos) > 0.5)):
pos_num_red = (estimator_status['pos_test_ratio'][start_index:end_index] > 1.0).sum()
pos_num_amber = (estimator_status['pos_test_ratio'][start_index:end_index] > 0.5).sum() - pos_num_red
pos_num_red = (estimator_status['pos_test_ratio'][start_index:end_index + 1] > 1.0).sum()
pos_num_amber = (estimator_status['pos_test_ratio'][start_index:end_index + 1] > 0.5).sum() - pos_num_red
test_results['pos_percentage_red'][0] = 100.0 * pos_num_red / num_valid_values
test_results['pos_percentage_amber'][0] = 100.0 * pos_num_amber / num_valid_values
test_results['pos_test_max'][0] = np.amax(estimator_status['pos_test_ratio'][start_index:end_index])
test_results['pos_test_mean'][0] = np.mean(estimator_status['pos_test_ratio'][start_index:end_index])
test_results['pos_test_max'][0] = np.amax(estimator_status['pos_test_ratio'][start_index:end_index + 1])
test_results['pos_test_mean'][0] = np.mean(estimator_status['pos_test_ratio'][start_index:end_index + 1])
test_results['pos_fail_percentage'][0] = 100.0 * (
posh_innov_fail[start_index:end_index] > 0.5).sum() / num_valid_values
posh_innov_fail[start_index:end_index + 1] > 0.5).sum() / num_valid_values
# Height Sensor Checks
hgt_num_red = (estimator_status['hgt_test_ratio'][late_start_index:early_end_index] > 1.0).sum()
hgt_num_amber = (estimator_status['hgt_test_ratio'][late_start_index:early_end_index] > 0.5).sum() - hgt_num_red
hgt_num_red = (estimator_status['hgt_test_ratio'][late_start_index:early_end_index + 1] > 1.0).sum()
hgt_num_amber = (estimator_status['hgt_test_ratio'][late_start_index:early_end_index + 1] > 0.5).sum() - hgt_num_red
test_results['hgt_percentage_red'][0] = 100.0 * hgt_num_red / num_valid_values_trimmed
test_results['hgt_percentage_amber'][0] = 100.0 * hgt_num_amber / num_valid_values_trimmed
test_results['hgt_test_max'][0] = np.amax(estimator_status['hgt_test_ratio'][late_start_index:early_end_index])
test_results['hgt_test_mean'][0] = np.mean(estimator_status['hgt_test_ratio'][late_start_index:early_end_index])
test_results['hgt_test_max'][0] = np.amax(estimator_status['hgt_test_ratio'][late_start_index:early_end_index + 1])
test_results['hgt_test_mean'][0] = np.mean(estimator_status['hgt_test_ratio'][late_start_index:early_end_index + 1])
test_results['hgt_fail_percentage'][0] = 100.0 * (
posv_innov_fail[late_start_index:early_end_index] > 0.5).sum() / num_valid_values_trimmed
posv_innov_fail[late_start_index:early_end_index + 1] > 0.5).sum() / num_valid_values_trimmed
# Airspeed Sensor Checks
if (tas_test_max > 0.0):
tas_num_red = (estimator_status['tas_test_ratio'][start_index:end_index] > 1.0).sum()
tas_num_amber = (estimator_status['tas_test_ratio'][start_index:end_index] > 0.5).sum() - tas_num_red
tas_num_red = (estimator_status['tas_test_ratio'][start_index:end_index + 1] > 1.0).sum()
tas_num_amber = (estimator_status['tas_test_ratio'][start_index:end_index + 1] > 0.5).sum() - tas_num_red
test_results['tas_percentage_red'][0] = 100.0 * tas_num_red / num_valid_values
test_results['tas_percentage_amber'][0] = 100.0 * tas_num_amber / num_valid_values
test_results['tas_test_max'][0] = np.amax(estimator_status['tas_test_ratio'][start_index:end_index])
test_results['tas_test_mean'][0] = np.mean(estimator_status['tas_test_ratio'][start_index:end_index])
test_results['tas_test_max'][0] = np.amax(estimator_status['tas_test_ratio'][start_index:end_index + 1])
test_results['tas_test_mean'][0] = np.mean(estimator_status['tas_test_ratio'][start_index:end_index + 1])
test_results['tas_fail_percentage'][0] = 100.0 * (
tas_innov_fail[start_index:end_index] > 0.5).sum() / num_valid_values
tas_innov_fail[start_index:end_index + 1] > 0.5).sum() / num_valid_values
# HAGL Sensor Checks
if (hagl_test_max > 0.0):
hagl_num_red = (estimator_status['hagl_test_ratio'][start_index:end_index] > 1.0).sum()
hagl_num_amber = (estimator_status['hagl_test_ratio'][start_index:end_index] > 0.5).sum() - hagl_num_red
hagl_num_red = (estimator_status['hagl_test_ratio'][start_index:end_index + 1] > 1.0).sum()
hagl_num_amber = (estimator_status['hagl_test_ratio'][start_index:end_index + 1] > 0.5).sum() - hagl_num_red
test_results['hagl_percentage_red'][0] = 100.0 * hagl_num_red / num_valid_values
test_results['hagl_percentage_amber'][0] = 100.0 * hagl_num_amber / num_valid_values
test_results['hagl_test_max'][0] = np.amax(estimator_status['hagl_test_ratio'][start_index:end_index])
test_results['hagl_test_mean'][0] = np.mean(estimator_status['hagl_test_ratio'][start_index:end_index])
test_results['hagl_test_max'][0] = np.amax(estimator_status['hagl_test_ratio'][start_index:end_index + 1])
test_results['hagl_test_mean'][0] = np.mean(estimator_status['hagl_test_ratio'][start_index:end_index + 1])
test_results['hagl_fail_percentage'][0] = 100.0 * (
hagl_innov_fail[start_index:end_index] > 0.5).sum() / num_valid_values
hagl_innov_fail[start_index:end_index + 1] > 0.5).sum() / num_valid_values
# optical flow sensor checks
if (np.amax(using_optflow) > 0.5):
test_results['ofx_fail_percentage'][0] = 100.0 * (
ofx_innov_fail[late_start_index:early_end_index] > 0.5).sum() / num_valid_values_trimmed
ofx_innov_fail[late_start_index:early_end_index + 1] > 0.5).sum() / num_valid_values_trimmed
test_results['ofy_fail_percentage'][0] = 100.0 * (
ofy_innov_fail[late_start_index:early_end_index] > 0.5).sum() / num_valid_values_trimmed
ofy_innov_fail[late_start_index:early_end_index + 1] > 0.5).sum() / num_valid_values_trimmed
# IMU bias checks
test_results['imu_dang_bias_median'][0] = (np.median(estimator_status['states[10]']) ** 2 + np.median(
@@ -1278,16 +1309,19 @@ def analyse_ekf(estimator_status, ekf2_innovations, sensor_preflight, check_leve
(test_results.get('imu_hfdvel_peak')[0] > check_levels.get('imu_hfdvel_peak_warn')) or
(test_results.get('imu_hfdvel_mean')[0] > check_levels.get('imu_hfdvel_mean_warn'))):
test_results['master_status'][0] = 'Warning'
test_results['imu_sensor_status'][0] = 'Warning - Vibration'
test_results['imu_sensor_status'][0] = 'Warning'
test_results['imu_vibration_check'][0] = 'Warning'
if ((test_results.get('imu_dang_bias_median')[0] > check_levels.get('imu_dang_bias_median_warn')) or
(test_results.get('imu_dvel_bias_median')[0] > check_levels.get('imu_dvel_bias_median_warn'))):
test_results['master_status'][0] = 'Warning'
test_results['imu_sensor_status'][0] = 'Warning - Bias'
test_results['imu_sensor_status'][0] = 'Warning'
test_results['imu_bias_check'][0] = 'Warning'
if ((test_results.get('output_obs_ang_err_median')[0] > check_levels.get('obs_ang_err_median_warn')) or
(test_results.get('output_obs_vel_err_median')[0] > check_levels.get('obs_vel_err_median_warn')) or
(test_results.get('output_obs_pos_err_median')[0] > check_levels.get('obs_pos_err_median_warn'))):
test_results['master_status'][0] = 'Warning'
test_results['imu_sensor_status'][0] = 'Warning - Output Predictor'
test_results['imu_sensor_status'][0] = 'Warning'
test_results['imu_output_predictor_check'][0] = 'Warning'
# check for failures
if ((test_results.get('magx_fail_percentage')[0] > check_levels.get('mag_fail_pct')) or
(test_results.get('magy_fail_percentage')[0] > check_levels.get('mag_fail_pct')) or
+1 -1
View File
@@ -27,7 +27,7 @@ add_definitions(
)
px4_nuttx_make_uavcan_bootloadable(BOARD ${BOARD}
BIN ${PX4_BINARY_DIR}/platforms/nuttx/esc35-v1.bin
BIN ${PX4_BINARY_DIR}/esc35-v1.bin
HWNAME ${uavcanblid_name}
HW_MAJOR ${uavcanblid_hw_version_major}
HW_MINOR ${uavcanblid_hw_version_minor}
+3 -14
View File
@@ -18,19 +18,12 @@ set(config_module_list
#drivers/blinkm
#drivers/camera_trigger
drivers/gps
#drivers/irlock
#drivers/mkblctrl
#drivers/oreoled
#drivers/pca9685
#drivers/pwm_input
drivers/px4flow
drivers/px4fmu
drivers/rgbled
drivers/stm32
#drivers/stm32/adc
drivers/stm32/adc
#drivers/stm32/tone_alarm
#drivers/tap_esc
#drivers/vmount
modules/sensors
#
@@ -38,8 +31,7 @@ set(config_module_list
#
systemcmds/bl_update
systemcmds/config
#systemcmds/dumpfile
#systemcmds/esc_calib
systemcmds/esc_calib
systemcmds/hardfault_log
systemcmds/led_control
systemcmds/mixer
@@ -50,7 +42,7 @@ set(config_module_list
systemcmds/perf
systemcmds/pwm
systemcmds/reboot
#systemcmds/sd_bench
systemcmds/sd_bench
systemcmds/top
systemcmds/topic_listener
systemcmds/tune_control
@@ -80,7 +72,6 @@ set(config_module_list
modules/load_mon
modules/mavlink
modules/navigator
#modules/uavcan
#
# Estimation modules
@@ -89,7 +80,6 @@ set(config_module_list
modules/ekf2
modules/landing_target_estimator
modules/local_position_estimator
#modules/position_estimator_inav
modules/wind_estimator
#
@@ -107,7 +97,6 @@ set(config_module_list
# Logging
#
modules/logger
modules/sdlog2
#
# Library modules
@@ -25,7 +25,7 @@ add_definitions(
)
px4_nuttx_make_uavcan_bootloadable(BOARD ${BOARD}
BIN ${PX4_BINARY_DIR}/platforms/nuttx/px4cannode-v1.bin
BIN ${PX4_BINARY_DIR}/px4cannode-v1.bin
HWNAME ${uavcanblid_name}
HW_MAJOR ${uavcanblid_hw_version_major}
HW_MINOR ${uavcanblid_hw_version_minor}
+1 -1
View File
@@ -27,7 +27,7 @@ add_definitions(
)
px4_nuttx_make_uavcan_bootloadable(BOARD ${BOARD}
BIN ${PX4_BINARY_DIR}/platforms/nuttx/px4esc-v1.bin
BIN ${PX4_BINARY_DIR}/px4esc-v1.bin
HWNAME ${uavcanblid_name}
HW_MAJOR ${uavcanblid_hw_version_major}
HW_MINOR ${uavcanblid_hw_version_minor}
+2 -1
View File
@@ -31,7 +31,8 @@ set(config_module_list
drivers/px4fmu
drivers/px4io
drivers/rgbled
drivers/rgbled_pwm
# Enable the line below to put the three leds into PWM RGB mode
#drivers/rgbled_pwm
drivers/stm32
drivers/stm32/adc
drivers/stm32/tone_alarm
+1 -1
View File
@@ -21,7 +21,7 @@ include(configs/uavcan_board_ident/s2740vc-v1)
# N.B. this would be uncommented when there is an APP
#px4_nuttx_make_uavcan_bootloadable(BOARD ${BOARD}
# BIN ${PX4_BINARY_DIR}/platforms/nuttx/s2740vc-v1.bin
# BIN ${PX4_BINARY_DIR}/s2740vc-v1.bin
# HWNAME ${uavcanblid_name}
# HW_MAJOR ${uavcanblid_hw_version_major}
# HW_MINOR ${uavcanblid_hw_version_minor}
+3
View File
@@ -24,6 +24,8 @@
<!-- MAVROS configs -->
<arg name="fcu_url" default="udp://:14540@localhost:14557"/>
<arg name="respawn_mavros" default="false"/>
<!-- PX4 configs -->
<arg name="interactive" default="true"/>
<!-- PX4 SITL and Gazebo -->
<include file="$(find px4)/launch/posix_sitl.launch">
<arg name="x" value="$(arg x)"/>
@@ -37,6 +39,7 @@
<arg name="sdf" value="$(arg sdf)"/>
<arg name="rcS" value="$(arg rcS)"/>
<arg name="gui" value="$(arg gui)"/>
<arg name="interactive" value="$(arg interactive)"/>
<arg name="debug" value="$(arg debug)"/>
<arg name="verbose" value="$(arg verbose)"/>
<arg name="paused" value="$(arg paused)"/>
+5 -1
View File
@@ -21,8 +21,12 @@
<arg name="verbose" default="false"/>
<arg name="paused" default="false"/>
<arg name="respawn_gazebo" default="false"/>
<!-- PX4 configs -->
<arg name="interactive" default="true"/>
<!-- PX4 SITL -->
<node name="sitl" pkg="px4" type="px4" output="screen" args="$(find px4) $(arg rcS)"/>
<arg unless="$(arg interactive)" name="px4_command_arg1" value="-d"/>
<arg if="$(arg interactive)" name="px4_command_arg1" value=""/>
<node name="sitl" pkg="px4" type="px4" output="screen" args="$(find px4) $(arg rcS) $(arg px4_command_arg1)" required="true"/>
<!-- Gazebo sim -->
<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="gui" value="$(arg gui)"/>
+5 -1
View File
@@ -15,11 +15,15 @@
<arg name="ID" default="1"/>
<arg name="rcS" default="$(find px4)/posix-configs/SITL/init/$(arg est)/$(arg vehicle)_$(arg ID)"/>
<arg name="mavlink_udp_port" default="14560"/>
<!-- PX4 configs -->
<arg name="interactive" default="true"/>
<!-- generate urdf vehicle model -->
<arg name="cmd" default="$(find xacro)/xacro $(find px4)/Tools/sitl_gazebo/models/rotors_description/urdf/$(arg vehicle)_base.xacro rotors_description_dir:=$(find px4)/Tools/sitl_gazebo/models/rotors_description mavlink_udp_port:=$(arg mavlink_udp_port) --inorder"/>
<param command="$(arg cmd)" name="rotors_description"/>
<!-- PX4 SITL -->
<node name="sitl_$(arg ID)" pkg="px4" type="px4" output="screen" args="$(find px4) $(arg rcS)">
<arg unless="$(arg interactive)" name="px4_command_arg1" value=""/>
<arg if="$(arg interactive)" name="px4_command_arg1" value="-d"/>
<node name="sitl_$(arg ID)" pkg="px4" type="px4" output="screen" args="$(find px4) $(arg rcS) $(arg px4_command_arg1)">
</node>
<!-- spawn vehicle -->
<node name="$(arg vehicle)_$(arg ID)_spawn" output="screen" pkg="gazebo_ros" type="spawn_model" args="-urdf -param rotors_description -model $(arg vehicle)_$(arg ID) -package_to_model -x $(arg x) -y $(arg y) -z $(arg z) -R $(arg R) -P $(arg P) -Y $(arg Y)"/>
+32 -30
View File
@@ -13,38 +13,40 @@ float32[24] covariances # Diagonal Elements of Covariance Matrix
uint16 gps_check_fail_flags # Bitmask to indicate status of GPS checks - see definition below
# bits are true when corresponding test has failed
uint16 GPS_CHECK_FAIL_GPS_FIX = 0 # 0 : insufficient fix type (no 3D solution)
uint16 GPS_CHECK_FAIL_MIN_SAT_COUNT = 1 # 1 : minimum required sat count fail
uint16 GPS_CHECK_FAIL_MIN_GDOP = 2 # 2 : minimum required GDoP fail
uint16 GPS_CHECK_FAIL_MAX_HORZ_ERR = 3 # 3 : maximum allowed horizontal position error fail
uint16 GPS_CHECK_FAIL_MAX_VERT_ERR = 4 # 4 : maximum allowed vertical position error fail
uint16 GPS_CHECK_FAIL_MAX_SPD_ERR = 5 # 5 : maximum allowed speed error fail
uint16 GPS_CHECK_FAIL_MAX_HORZ_DRIFT = 6 # 6 : maximum allowed horizontal position drift fail - requires stationary vehicle
uint16 GPS_CHECK_FAIL_MAX_VERT_DRIFT = 7 # 7 : maximum allowed vertical position drift fail - requires stationary vehicle
uint16 GPS_CHECK_FAIL_MAX_HORZ_SPD_ERR = 8 # 8 : maximum allowed horizontal speed fail - requires stationary vehicle
uint16 GPS_CHECK_FAIL_MAX_VERT_SPD_ERR = 9 # 9 : maximum allowed vertical velocity discrepancy fail
uint8 GPS_CHECK_FAIL_GPS_FIX = 0 # 0 : insufficient fix type (no 3D solution)
uint8 GPS_CHECK_FAIL_MIN_SAT_COUNT = 1 # 1 : minimum required sat count fail
uint8 GPS_CHECK_FAIL_MIN_GDOP = 2 # 2 : minimum required GDoP fail
uint8 GPS_CHECK_FAIL_MAX_HORZ_ERR = 3 # 3 : maximum allowed horizontal position error fail
uint8 GPS_CHECK_FAIL_MAX_VERT_ERR = 4 # 4 : maximum allowed vertical position error fail
uint8 GPS_CHECK_FAIL_MAX_SPD_ERR = 5 # 5 : maximum allowed speed error fail
uint8 GPS_CHECK_FAIL_MAX_HORZ_DRIFT = 6 # 6 : maximum allowed horizontal position drift fail - requires stationary vehicle
uint8 GPS_CHECK_FAIL_MAX_VERT_DRIFT = 7 # 7 : maximum allowed vertical position drift fail - requires stationary vehicle
uint8 GPS_CHECK_FAIL_MAX_HORZ_SPD_ERR = 8 # 8 : maximum allowed horizontal speed fail - requires stationary vehicle
uint8 GPS_CHECK_FAIL_MAX_VERT_SPD_ERR = 9 # 9 : maximum allowed vertical velocity discrepancy fail
uint32 control_mode_flags # Bitmask to indicate EKF logic state
# 0 - true if the filter tilt alignment is complete
# 1 - true if the filter yaw alignment is complete
# 2 - true if GPS measurements are being fused
# 3 - true if optical flow measurements are being fused
# 4 - true if a simple magnetic yaw heading is being fused
# 5 - true if 3-axis magnetometer measurement are being fused
# 6 - true if synthetic magnetic declination measurements are being fused
# 7 - true when the vehicle is airborne
# 8 - true when wind velocity is being estimated
# 9 - true when baro height is being fused as a primary height reference
# 10 - true when range finder height is being fused as a primary height reference
# 11 - true when GPS height is being fused as a primary height reference
# 12 - true when local position data from external vision is being fused
# 13 - true when yaw data from external vision measurements is being fused
# 14 - true when height data from external vision measurements is being fused
# 15 - true when synthetic sideslip measurements are being fused
# 16 - true when only the magnetic field states are updated by the magnetometer
# 17 - true when the vehicle is operating as a fixed wing vehicle
# 18 - true when the magnetomer has been declared faulty and is no longer being used
# 19 - true when airspeed measurements are being fused
uint8 CS_TILT_ALIGN = 0 # 0 - true if the filter tilt alignment is complete
uint8 CS_YAW_ALIGN = 1 # 1 - true if the filter yaw alignment is complete
uint8 CS_GPS = 2 # 2 - true if GPS measurements are being fused
uint8 CS_OPT_FLOW = 3 # 3 - true if optical flow measurements are being fused
uint8 CS_MAG_HDG = 4 # 4 - true if a simple magnetic yaw heading is being fused
uint8 CS_MAG_3D = 5 # 5 - true if 3-axis magnetometer measurement are being fused
uint8 CS_MAG_DEC = 6 # 6 - true if synthetic magnetic declination measurements are being fused
uint8 CS_IN_AIR = 7 # 7 - true when thought to be airborne
uint8 CS_WIND = 8 # 8 - true when wind velocity is being estimated
uint8 CS_BARO_HGT = 9 # 9 - true when baro height is being fused as a primary height reference
uint8 CS_RNG_HGT = 10 # 10 - true when range finder height is being fused as a primary height reference
uint8 CS_GPS_HGT = 11 # 11 - true when GPS height is being fused as a primary height reference
uint8 CS_EV_POS = 12 # 12 - true when local position data from external vision is being fused
uint8 CS_EV_YAW = 13 # 13 - true when yaw data from external vision measurements is being fused
uint8 CS_EV_HGT = 14 # 14 - true when height data from external vision measurements is being fused
uint8 CS_BETA = 15 # 15 - true when synthetic sideslip measurements are being fused
uint8 CS_MAG_FIELD = 16 # 16 - true when only the magnetic field states are updated by the magnetometer
uint8 CS_FIXED_WING = 17 # 17 - true when thought to be operating as a fixed wing vehicle with constrained sideslip
uint8 CS_MAG_FAULT = 18 # 18 - true when the magnetomer has been declared faulty and is no longer being used
uint8 CS_ASPD = 19 # 19 - true when airspeed measurements are being fused
uint8 CS_GND_EFFECT = 20 # 20 - true when when protection from ground effect induced static pressure rise is active
uint8 CS_RNG_STUCK = 21 # 21 - true when a stuck range finder sensor has been detected
uint16 filter_fault_flags # Bitmask to indicate EKF internal faults
# 0 - true if the fusion of the magnetometer X-axis has encountered a numerical error
+4
View File
@@ -13,3 +13,7 @@ uint32 time_since_last_sonar_update # time since last sonar update in microsecon
uint16 frame_count_since_last_readout # number of accumulated frames in timespan
int16 gyro_temperature # Temperature * 100 in centi-degrees Celsius
uint8 quality # Average of quality of accumulated frames, 0: bad quality, 255: maximum quality
float32 max_flow_rate # Magnitude of maximum angular which the optical flow sensor can measure reliably
float32 min_ground_distance # Minimum distance from ground at which the optical flow sensor operates reliably
float32 max_ground_distance # Maximum distance from ground at which the optical flow sensor operates reliably
+17 -4
View File
@@ -11,12 +11,25 @@ uint64 SUBSYSTEM_TYPE_EXTERNALGROUNDTRUTH = 512
uint64 SUBSYSTEM_TYPE_ANGULARRATECONTROL = 1024
uint64 SUBSYSTEM_TYPE_ATTITUDESTABILIZATION = 2048
uint64 SUBSYSTEM_TYPE_YAWPOSITION = 4096
uint64 SUBSYSTEM_TYPE_ALTITUDECONTROL = 16384
uint64 SUBSYSTEM_TYPE_POSITIONCONTROL = 32768
uint64 SUBSYSTEM_TYPE_MOTORCONTROL = 65536
uint64 SUBSYSTEM_TYPE_RANGEFINDER = 131072
uint64 SUBSYSTEM_TYPE_ALTITUDECONTROL = 8192
uint64 SUBSYSTEM_TYPE_POSITIONCONTROL = 16384
uint64 SUBSYSTEM_TYPE_MOTORCONTROL = 32768
uint64 SUBSYSTEM_TYPE_RCRECEIVER = 65536
uint64 SUBSYSTEM_TYPE_GYRO2 = 131072
uint64 SUBSYSTEM_TYPE_ACC2 = 262144
uint64 SUBSYSTEM_TYPE_MAG2 = 524288
uint64 SUBSYSTEM_TYPE_GEOFENCE = 1048576
uint64 SUBSYSTEM_TYPE_AHRS = 2097152
uint64 SUBSYSTEM_TYPE_TERRAIN = 4194304
uint64 SUBSYSTEM_TYPE_REVERSEMOTOR = 8388608
uint64 SUBSYSTEM_TYPE_LOGGING = 16777216
uint64 SUBSYSTEM_TYPE_SENSORBATTERY = 33554432
uint64 SUBSYSTEM_TYPE_SENSORPROXIMITY = 67108864
uint64 SUBSYSTEM_TYPE_MISSION = 134217728
bool present
bool enabled
bool ok
uint64 subsystem_type
uint32 ORB_QUEUE_LENGTH = 5
+2 -1
View File
@@ -57,6 +57,7 @@ import gencpp
from px_generate_uorb_topic_helper import * # this is in Tools/
uorb_struct = '%s_s'%spec.short_name
uorb_struct_upper = spec.short_name.upper()
topic_name = spec.short_name
}@
@@ -83,7 +84,7 @@ for field in spec.parsed_fields():
@# Constants c style
#ifndef __cplusplus
@[for constant in spec.constants]@
#define @(constant.name) @(int(constant.val))
#define @(uorb_struct_upper)_@(constant.name) @(int(constant.val))
@[end for]
#endif
+14 -14
View File
@@ -48,7 +48,7 @@ topic = spec.short_name
*
****************************************************************************/
/*!
/*!
* @@file @(topic)_Publisher.cpp
* This file contains the implementation of the publisher functions.
*
@@ -74,26 +74,26 @@ topic = spec.short_name
bool @(topic)_Publisher::init()
{
// Create RTPSParticipant
ParticipantAttributes PParam;
PParam.rtps.builtin.domainId = 0;
PParam.rtps.builtin.leaseDuration = c_TimeInfinite;
PParam.rtps.setName("Participant_publisher"); //You can put here the name you want
PParam.rtps.setName("@(topic)_publisher"); //You can put here the name you want
mp_participant = Domain::createParticipant(PParam);
if(mp_participant == nullptr)
return false;
//Register the type
Domain::registerType(mp_participant,(TopicDataType*) &myType);
Domain::registerType(mp_participant, (TopicDataType*) &myType);
// Create Publisher
PublisherAttributes Wparam;
Wparam.topic.topicKind = NO_KEY;
Wparam.topic.topicDataType = myType.getName(); //This type MUST be registered
Wparam.topic.topicName = "@(topic)_PubSubTopic";
mp_publisher = Domain::createPublisher(mp_participant,Wparam,(PublisherListener*)&m_listener);
Wparam.topic.topicName = "@(topic)";
mp_publisher = Domain::createPublisher(mp_participant, Wparam, (PublisherListener*) &m_listener);
if(mp_publisher == nullptr)
return false;
//std::cout << "Publisher created, waiting for Subscribers." << std::endl;
@@ -120,13 +120,13 @@ void @(topic)_Publisher::run()
{
eClock::my_sleep(250); // Sleep 250 ms
}
// Publication code
@(topic)_ st;
/* Initialize your structure here */
int msgsent = 0;
char ch = 'y';
do
+6 -5
View File
@@ -48,7 +48,7 @@ topic = spec.short_name
*
****************************************************************************/
/*!
/*!
* @@file @(topic)_Publisher.h
* This header file contains the declaration of the publisher functions.
*
@@ -65,8 +65,9 @@ topic = spec.short_name
#include "@(topic)_PubSubTypes.h"
using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;
class @(topic)_Publisher
class @(topic)_Publisher
{
public:
@(topic)_Publisher();
@@ -77,16 +78,16 @@ public:
private:
Participant *mp_participant;
Publisher *mp_publisher;
class PubListener : public PublisherListener
{
public:
PubListener() : n_matched(0){};
~PubListener(){};
void onPublicationMatched(Publisher* pub,MatchingInfo& info);
void onPublicationMatched(Publisher* pub, MatchingInfo& info);
int n_matched;
} m_listener;
@(topic)_PubSubType myType;
};
#endif // _@(topic)__PUBLISHER_H_
#endif // _@(topic)__PUBLISHER_H_
+11 -11
View File
@@ -48,7 +48,7 @@ topic = spec.short_name
*
****************************************************************************/
/*!
/*!
* @@file @(topic)_Subscriber.cpp
* This file contains the implementation of the subscriber functions.
*
@@ -72,26 +72,26 @@ topic = spec.short_name
bool @(topic)_Subscriber::init()
{
// Create RTPSParticipant
ParticipantAttributes PParam;
PParam.rtps.builtin.domainId = 0; //MUST BE THE SAME AS IN THE PUBLISHER
PParam.rtps.builtin.leaseDuration = c_TimeInfinite;
PParam.rtps.setName("Participant_subscriber"); //You can put the name you want
PParam.rtps.setName("@(topic)_subscriber"); //You can put the name you want
mp_participant = Domain::createParticipant(PParam);
if(mp_participant == nullptr)
return false;
//Register the type
Domain::registerType(mp_participant,(TopicDataType*) &myType);
Domain::registerType(mp_participant, (TopicDataType*) &myType);
// Create Subscriber
SubscriberAttributes Rparam;
Rparam.topic.topicKind = NO_KEY;
Rparam.topic.topicDataType = myType.getName(); //Must be registered before the creation of the subscriber
Rparam.topic.topicName = "@(topic)_PubSubTopic";
mp_subscriber = Domain::createSubscriber(mp_participant,Rparam,(SubscriberListener*)&m_listener);
Rparam.topic.topicName = "@(topic)";
mp_subscriber = Domain::createSubscriber(mp_participant, Rparam, (SubscriberListener*) &m_listener);
if(mp_subscriber == nullptr)
return false;
return true;
@@ -143,4 +143,4 @@ bool @(topic)_Subscriber::hasMsg()
{
m_listener.has_msg = false;
return m_listener.msg;
}
}
+7 -6
View File
@@ -48,7 +48,7 @@ topic = spec.short_name
*
****************************************************************************/
/*!
/*!
* @@file @(topic)_Subscriber.h
* This header file contains the declaration of the subscriber functions.
*
@@ -65,8 +65,9 @@ topic = spec.short_name
#include "@(topic)_PubSubTypes.h"
using namespace eprosima::fastrtps;
using namespace eprosima::fastrtps::rtps;
class @(topic)_Subscriber
class @(topic)_Subscriber
{
public:
@(topic)_Subscriber();
@@ -78,13 +79,13 @@ public:
private:
Participant *mp_participant;
Subscriber *mp_subscriber;
class SubListener : public SubscriberListener
{
public:
SubListener() : n_matched(0),n_msg(0){};
SubListener() : n_matched(0), n_msg(0){};
~SubListener(){};
void onSubscriptionMatched(Subscriber* sub,MatchingInfo& info);
void onSubscriptionMatched(Subscriber* sub, MatchingInfo& info);
void onNewDataMessage(Subscriber* sub);
SampleInfo_t m_info;
int n_matched;
@@ -96,4 +97,4 @@ private:
@(topic)_PubSubType myType;
};
#endif // _@(topic)__SUBSCRIBER_H_
#endif // _@(topic)__SUBSCRIBER_H_
@@ -194,7 +194,7 @@ void t_send(void *data)
// Send subscribed topics over UART
while (topics.hasMsg(&topic_ID))
{
uint16_t header_length = get_header_length();
uint16_t header_length = transport_node->get_header_length();
/* make room for the header to fill in later */
eprosima::fastcdr::FastBuffer cdrbuffer(&data_buffer[header_length], sizeof(data_buffer)-header_length);
eprosima::fastcdr::Cdr scdr(cdrbuffer);
+4 -2
View File
@@ -56,7 +56,9 @@ float32 evh # Standard deviation of horizontal velocity error, (metres/sec)
float32 evv # Standard deviation of horizontal velocity error, (metres/sec)
# estimator specified vehicle limits
float32 vxy_max # maximum horizontal speed - set to 0 when not applicable (metres/sec)
bool limit_hagl # true when the height above ground needs to be limited to observe optical flow focus and range finder limits
float32 vxy_max # maximum horizontal speed - set to 0 when limiting not required (meters/sec)
float32 vz_max # maximum vertical speed - set to 0 when limiting not required (meters/sec)
float32 hagl_min # minimum height above ground level - set to 0 when limiting not required (meters)
float32 hagl_max # maximum height above ground level - set to 0 when limiting not required (meters)
# TOPICS vehicle_local_position vehicle_local_position_groundtruth vehicle_vision_position
+1
View File
@@ -27,5 +27,6 @@ bool offboard_control_loss_timeout # true if offboard is lost for
bool rc_signal_found_once
bool rc_input_blocked # set if RC input should be ignored temporarily
bool rc_calibration_valid # set if RC calibration is valid
bool vtol_transition_failure # Set to true if vtol transition failed
bool usb_connected # status of the USB power supply
+11 -8
View File
@@ -52,7 +52,6 @@ list(APPEND nuttx_libs
nuttx_apps
nuttx_arch
nuttx_binfmt
nuttx_binfmt
nuttx_c
nuttx_configs
nuttx_cxx
@@ -116,12 +115,15 @@ if (config_romfs_root)
endif()
# create px4 file (combined firmware and metadata)
set(fw_file ${PX4_BINARY_DIR}/${FW_NAME})
string(REPLACE ".elf" ".px4" fw_file ${fw_file})
string(REPLACE "nuttx_" "" fw_file ${fw_file})
# for historical reasons we name the final output binary without nuttx_
set(fw_name_short)
string(REPLACE "nuttx_" "" fw_name_short ${FW_NAME})
add_custom_command(OUTPUT ${BOARD}.bin
COMMAND ${OBJCOPY} -O binary ${PX4_BINARY_DIR_REL}/${FW_NAME} ${BOARD}.bin
set(fw_file ${PX4_BINARY_DIR}/${fw_name_short})
string(REPLACE ".elf" ".px4" fw_file ${fw_file})
add_custom_command(OUTPUT ${PX4_BINARY_DIR_REL}/${BOARD}.bin
COMMAND ${OBJCOPY} -O binary ${PX4_BINARY_DIR_REL}/${FW_NAME} ${PX4_BINARY_DIR_REL}/${BOARD}.bin
DEPENDS ${FW_NAME}
)
@@ -136,8 +138,8 @@ if (TARGET parameters_xml AND TARGET airframes_xml)
--git_identity ${PX4_SOURCE_DIR}
--parameter_xml ${PX4_BINARY_DIR}/parameters.xml
--airframe_xml ${PX4_BINARY_DIR}/airframes.xml
--image ${BOARD}.bin > ${fw_file}
DEPENDS ${BOARD}.bin parameters_xml airframes_xml
--image ${PX4_BINARY_DIR}/${BOARD}.bin > ${fw_file}
DEPENDS ${PX4_BINARY_DIR}/${BOARD}.bin parameters_xml airframes_xml
COMMENT "Creating ${fw_file}"
)
@@ -184,6 +186,7 @@ if (TARGET parameters_xml AND TARGET airframes_xml)
${PX4_SOURCE_DIR}/Tools/px_uploader.py --port ${serial_ports} ${fw_file}
DEPENDS ${fw_file}
COMMENT "uploading px4"
VERBATIM
USES_TERMINAL
)
endif()
+4 -4
View File
@@ -81,7 +81,7 @@ class NX_register_set(object):
self.regs['LR'] = self.mon_reg_call('lr')
self.regs['R15'] = self.mon_reg_call('r15')
self.regs['PC'] = self.mon_reg_call('pc')
self.regs['XPSR'] = self.mon_reg_call('xPSR')
#self.regs['XPSR'] = self.mon_reg_call('xPSR')
else:
for key in self.v7em_regmap.keys():
self.regs[key] = int(xcpt_regs[self.v7em_regmap[key]])
@@ -91,11 +91,11 @@ class NX_register_set(object):
register is the register as a string e.g. 'pc'
return integer containing the value of the register
"""
str_to_eval = "mon reg "+register
str_to_eval = "info registers "+register
resp = gdb.execute(str_to_eval,to_string = True)
content = resp.split()[-1];
content = resp.split()[-1]
try:
return int(content,16)
return int(content)
except:
return 0
@@ -371,7 +371,7 @@ CONFIG_STM32_HAVE_TIM14=y
CONFIG_STM32_HAVE_ADC2=y
CONFIG_STM32_HAVE_ADC3=y
# CONFIG_STM32_HAVE_ADC4 is not set
# CONFIG_STM32_HAVE_ADC1_DMA is not set
CONFIG_STM32_HAVE_ADC1_DMA=y
# CONFIG_STM32_HAVE_ADC2_DMA is not set
# CONFIG_STM32_HAVE_ADC3_DMA is not set
# CONFIG_STM32_HAVE_ADC4_DMA is not set
@@ -408,7 +408,7 @@ CONFIG_STM32_HAVE_I2S3=y
# CONFIG_STM32_HAVE_OPAMP2 is not set
# CONFIG_STM32_HAVE_OPAMP3 is not set
# CONFIG_STM32_HAVE_OPAMP4 is not set
# CONFIG_STM32_ADC1 is not set
CONFIG_STM32_ADC1=y
# CONFIG_STM32_ADC2 is not set
# CONFIG_STM32_ADC3 is not set
CONFIG_STM32_BKPSRAM=y
@@ -460,6 +460,7 @@ CONFIG_STM32_UART4=y
CONFIG_STM32_USART6=y
# CONFIG_STM32_IWDG is not set
CONFIG_STM32_WWDG=y
CONFIG_STM32_ADC=y
CONFIG_STM32_SPI=y
CONFIG_STM32_I2C=y
# CONFIG_STM32_NOEXT_VECTORS is not set
@@ -488,6 +489,9 @@ CONFIG_STM32_DMACAPABLE=y
# CONFIG_STM32_TIM1_PWM is not set
# CONFIG_STM32_TIM3_PWM is not set
# CONFIG_STM32_TIM5_PWM is not set
# CONFIG_STM32_TIM1_ADC is not set
# CONFIG_STM32_TIM3_ADC is not set
# CONFIG_STM32_TIM5_ADC is not set
# CONFIG_STM32_TIM1_CAP is not set
# CONFIG_STM32_TIM3_CAP is not set
# CONFIG_STM32_TIM4_CAP is not set
@@ -499,6 +503,12 @@ CONFIG_STM32_DMACAPABLE=y
# CONFIG_STM32_TIM12_CAP is not set
# CONFIG_STM32_TIM13_CAP is not set
# CONFIG_STM32_TIM14_CAP is not set
#
# ADC Configuration
#
# CONFIG_STM32_ADC_NO_STARTUP_CONV is not set
# CONFIG_STM32_ADC1_DMA is not set
CONFIG_STM32_USART=y
CONFIG_STM32_SERIALDRIVER=y
+1 -1
View File
@@ -47,7 +47,7 @@ ExternalProject_Add_Step(sitl_gazebo forceconfigure
# create targets for each viewer/model/debugger combination
set(viewers none jmavsim gazebo replay)
set(debuggers none ide gdb lldb ddd valgrind callgrind)
set(models none iris iris_opt_flow iris_rplidar iris_irlock standard_vtol plane solo tailsitter typhoon_h480 rover hippocampus tiltrotor)
set(models none iris iris_opt_flow iris_vision iris_rplidar iris_irlock standard_vtol plane solo tailsitter typhoon_h480 rover hippocampus tiltrotor)
set(all_posix_vmd_make_targets)
foreach(viewer ${viewers})
foreach(debugger ${debuggers})
+27 -9
View File
@@ -83,6 +83,7 @@ extern "C" {
cout.flush();
_ExitFlag = true;
}
void _SigFpeHandler(int sig_num);
void _SigFpeHandler(int sig_num)
{
@@ -91,6 +92,15 @@ extern "C" {
PX4_BACKTRACE();
cout.flush();
}
void _SigSegvHandler(int sig_num);
void _SigSegvHandler(int sig_num)
{
cout.flush();
cout << endl << "segmentation fault" << endl;
PX4_BACKTRACE();
cout.flush();
}
}
static inline bool fileExists(const string &name)
@@ -299,20 +309,24 @@ int main(int argc, char **argv)
tcgetattr(0, &orig_term);
atexit(restore_term);
struct sigaction sig_int;
memset(&sig_int, 0, sizeof(struct sigaction));
// SIGINT
struct sigaction sig_int {};
sig_int.sa_handler = _SigIntHandler;
sig_int.sa_flags = 0;// not SA_RESTART!;
sigaction(SIGINT, &sig_int, nullptr);
struct sigaction sig_fpe;
memset(&sig_fpe, 0, sizeof(struct sigaction));
// SIGFPE
struct sigaction sig_fpe {};
sig_fpe.sa_handler = _SigFpeHandler;
sig_fpe.sa_flags = 0;// not SA_RESTART!;
sigaction(SIGINT, &sig_int, nullptr);
//sigaction(SIGTERM, &sig_int, NULL);
sigaction(SIGFPE, &sig_fpe, nullptr);
// SIGSEGV
struct sigaction sig_segv {};
sig_segv.sa_handler = _SigSegvHandler;
sig_segv.sa_flags = SA_RESTART | SA_SIGINFO;
sigaction(SIGSEGV, &sig_segv, nullptr);
set_cpu_scaling();
int index = 1;
@@ -519,11 +533,15 @@ int main(int argc, char **argv)
while (!_ExitFlag) {
char c = getchar();
int c = getchar();
string add_string; // string to add at current cursor position
bool update_prompt = true;
switch (c) {
case EOF:
_ExitFlag = true;
break;
case 127: // backslash
if (mystr.length() - cursor_position > 0) {
mystr.erase(mystr.length() - cursor_position - 1, 1);
@@ -620,7 +638,7 @@ int main(int argc, char **argv)
default: // any other input
if (c > 3) {
add_string += c;
add_string += (char)c;
} else {
update_prompt = false;
+83
View File
@@ -0,0 +1,83 @@
uorb start
param load
param set MAV_TYPE 2
param set SYS_AUTOSTART 4010
param set SYS_RESTART_TYPE 2
param set SYS_MC_EST_GROUP 2
dataman start
param set BAT_N_CELLS 3
param set CAL_GYRO0_ID 2293768
param set CAL_ACC0_ID 1376264
param set CAL_ACC1_ID 1310728
param set CAL_MAG0_ID 196616
param set CAL_GYRO0_XOFF 0.01
param set CAL_ACC0_XOFF 0.01
param set CAL_ACC0_YOFF -0.01
param set CAL_ACC0_ZOFF 0.01
param set CAL_ACC0_XSCALE 1.01
param set CAL_ACC0_YSCALE 1.01
param set CAL_ACC0_ZSCALE 1.01
param set CAL_ACC1_XOFF 0.01
param set CAL_MAG0_XOFF 0.01
param set SENS_BOARD_ROT 0
param set SENS_BOARD_X_OFF 0.000001
param set COM_RC_IN_MODE 1
param set NAV_DLL_ACT 2
param set COM_DISARM_LAND 3
param set NAV_ACC_RAD 2.0
param set COM_OF_LOSS_T 5
param set COM_OBL_ACT 2
param set COM_OBL_RC_ACT 0
param set RTL_RETURN_ALT 30.0
param set RTL_DESCEND_ALT 5.0
param set RTL_LAND_DELAY 5
param set SDLOG_DIRS_MAX 7
param set MIS_TAKEOFF_ALT 2.5
param set MC_ROLLRATE_P 0.2
param set MC_PITCHRATE_P 0.2
param set MC_PITCH_P 6
param set MC_ROLL_P 6
param set MPC_HOLD_MAX_Z 2.0
param set MPC_Z_VEL_P 0.6
param set MPC_Z_VEL_I 0.15
param set EKF2_GBIAS_INIT 0.01
param set EKF2_ANGERR_INIT 0.01
param set EKF2_MAG_TYPE 1
param set EKF2_AID_MASK 8
param set EKF2_HGT_MODE 0
param set EKF2_EV_DELAY 5
param set EKF2_EVP_NOISE 0.05
param set EKF2_EVA_NOISE 0.05
replay tryapplyparams
simulator start -s
tone_alarm start
gyrosim start
accelsim start
barosim start
gpssim start
pwm_out_sim start
sensors start
commander start
land_detector start multicopter
navigator start
ekf2 start
mc_pos_control start
mc_att_control start
mixer load /dev/pwm_output0 ROMFS/px4fmu_common/mixers/quad_w.main.mix
mavlink start -x -u 14556 -r 4000000
mavlink start -x -u 14557 -r 4000000 -m onboard -o 14540
mavlink stream -r 50 -s POSITION_TARGET_LOCAL_NED -u 14556
mavlink stream -r 50 -s LOCAL_POSITION_NED -u 14556
mavlink stream -r 50 -s GLOBAL_POSITION_INT -u 14556
mavlink stream -r 50 -s ATTITUDE -u 14556
mavlink stream -r 50 -s ATTITUDE_QUATERNION -u 14556
mavlink stream -r 50 -s ATTITUDE_TARGET -u 14556
mavlink stream -r 50 -s SERVO_OUTPUT_RAW_0 -u 14556
mavlink stream -r 20 -s RC_CHANNELS -u 14556
mavlink stream -r 250 -s HIGHRES_IMU -u 14556
mavlink stream -r 10 -s OPTICAL_FLOW_RAD -u 14556
mavlink stream -r 10 -s DISTANCE_SENSOR -u 14556
mavlink stream -r 10 -s VISION_POSITION_ESTIMATE -u 14556
logger start -e -t
mavlink boot_complete
replay trystart
+1 -1
View File
@@ -26,7 +26,7 @@ param set MAV_TYPE 13
param set MC_PITCH_P 6
param set MC_PITCHRATE_P 0.1
param set MC_ROLL_P 6
param set MC_ROLLRATE_P 0.1
param set MC_ROLLRATE_P 0.05
param set MIS_TAKEOFF_ALT 2.5
param set MPC_HOLD_MAX_Z 2.0
param set MPC_XY_VEL_I 0.2
+13 -9
View File
@@ -50,7 +50,7 @@
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <getopt.h>
#include <px4_getopt.h>
#include <px4_log.h>
#include <nuttx/arch.h>
@@ -849,11 +849,12 @@ usage()
int
bmp280_main(int argc, char *argv[])
{
enum BMP280_BUS busid = BMP280_BUS_ALL;
int myoptind = 1;
int ch;
const char *myoptarg = nullptr;
enum BMP280_BUS busid = BMP280_BUS_ALL;
/* jump over start/off/etc and look at options first */
while ((ch = getopt(argc, argv, "XISs")) != EOF) {
while ((ch = px4_getopt(argc, argv, "XISs", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
case 'X':
busid = BMP280_BUS_I2C_EXTERNAL;
@@ -861,8 +862,6 @@ bmp280_main(int argc, char *argv[])
case 'I':
busid = BMP280_BUS_I2C_INTERNAL;
//PX4_ERR("not supported yet");
//exit(1);
break;
case 'S':
@@ -875,11 +874,16 @@ bmp280_main(int argc, char *argv[])
default:
bmp280::usage();
exit(0);
return 0;
}
}
const char *verb = argv[optind];
if (myoptind >= argc) {
bmp280::usage();
return -1;
}
const char *verb = argv[myoptind];
/*
* Start/load the driver.
@@ -910,5 +914,5 @@ bmp280_main(int argc, char *argv[])
}
PX4_ERR("unrecognized command, try 'start', 'test', 'reset' or 'info'");
exit(1);
return -1;
}
@@ -48,7 +48,6 @@
#include <uORB/uORB.h>
#include <float.h>
#include <getopt.h>
static constexpr uint8_t WHO_AM_I = 0x0F;
static constexpr uint8_t LPS22HB_ID_WHO_AM_I = 0xB1;
+20 -4
View File
@@ -33,6 +33,8 @@
#include "LPS22HB.hpp"
#include <px4_getopt.h>
#include <cstring>
extern "C" __EXPORT int lps22hb_main(int argc, char *argv[]);
@@ -58,6 +60,12 @@ struct lps22hb_bus_option {
LPS22HB *dev;
} bus_options[] = {
{ LPS22HB_BUS_I2C_EXTERNAL, "/dev/lps22hb_ext", &LPS22HB_I2C_interface, PX4_I2C_BUS_EXPANSION, NULL },
#ifdef PX4_I2C_BUS_EXPANSION1
{ LPS22HB_BUS_I2C_EXTERNAL, "/dev/lps22hb_ext1", &LPS22HB_I2C_interface, PX4_I2C_BUS_EXPANSION1, NULL },
#endif
#ifdef PX4_I2C_BUS_EXPANSION2
{ LPS22HB_BUS_I2C_EXTERNAL, "/dev/lps22hb_ext2", &LPS22HB_I2C_interface, PX4_I2C_BUS_EXPANSION2, NULL },
#endif
#ifdef PX4_I2C_BUS_ONBOARD
{ LPS22HB_BUS_I2C_INTERNAL, "/dev/lps22hb_int", &LPS22HB_I2C_interface, PX4_I2C_BUS_ONBOARD, NULL },
#endif
@@ -234,10 +242,13 @@ usage()
int
lps22hb_main(int argc, char *argv[])
{
enum LPS22HB_BUS busid = LPS22HB_BUS_ALL;
int myoptind = 1;
int ch;
const char *myoptarg = nullptr;
while ((ch = getopt(argc, argv, "XIS:")) != EOF) {
enum LPS22HB_BUS busid = LPS22HB_BUS_ALL;
while ((ch = px4_getopt(argc, argv, "XIS:", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
#if (PX4_I2C_BUS_ONBOARD || PX4_SPIDEV_HMC)
@@ -256,11 +267,16 @@ lps22hb_main(int argc, char *argv[])
default:
lps22hb::usage();
exit(0);
return 0;
}
}
const char *verb = argv[optind];
if (myoptind >= argc) {
lps22hb::usage();
return -1;
}
const char *verb = argv[myoptind];
/*
* Start/load the driver.
+6
View File
@@ -789,6 +789,12 @@ struct lps25h_bus_option {
LPS25H *dev;
} bus_options[] = {
{ LPS25H_BUS_I2C_EXTERNAL, "/dev/lps25h_ext", &LPS25H_I2C_interface, PX4_I2C_BUS_EXPANSION, NULL },
#ifdef PX4_I2C_BUS_EXPANSION1
{ LPS25H_BUS_I2C_EXTERNAL, "/dev/lps25h_ext1", &LPS25H_I2C_interface, PX4_I2C_BUS_EXPANSION1, NULL },
#endif
#ifdef PX4_I2C_BUS_EXPANSION2
{ LPS25H_BUS_I2C_EXTERNAL, "/dev/lps25h_ext2", &LPS25H_I2C_interface, PX4_I2C_BUS_EXPANSION2, NULL },
#endif
#ifdef PX4_I2C_BUS_ONBOARD
{ LPS25H_BUS_I2C_INTERNAL, "/dev/lps25h_int", &LPS25H_I2C_interface, PX4_I2C_BUS_ONBOARD, NULL },
#endif
@@ -714,6 +714,12 @@ struct mpl3115a2_bus_option {
#ifdef PX4_I2C_BUS_EXPANSION
{ MPL3115A2_BUS_I2C_EXTERNAL, "/dev/mpl3115a2_ext", &MPL3115A2_i2c_interface, PX4_I2C_BUS_EXPANSION, NULL },
#endif
#ifdef PX4_I2C_BUS_EXPANSION1
{ MPL3115A2_BUS_I2C_EXTERNAL, "/dev/mpl3115a2_ext1", &MPL3115A2_i2c_interface, PX4_I2C_BUS_EXPANSION1, NULL },
#endif
#ifdef PX4_I2C_BUS_EXPANSION2
{ MPL3115A2_BUS_I2C_EXTERNAL, "/dev/mpl3115a2_ext2", &MPL3115A2_i2c_interface, PX4_I2C_BUS_EXPANSION2, NULL },
#endif
};
#define NUM_BUS_OPTIONS (sizeof(bus_options)/sizeof(bus_options[0]))
+14 -3
View File
@@ -50,7 +50,6 @@
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <getopt.h>
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
@@ -870,6 +869,12 @@ struct ms5611_bus_option {
#ifdef PX4_I2C_BUS_EXPANSION
{ MS5611_BUS_I2C_EXTERNAL, "/dev/ms5611_ext", &MS5611_i2c_interface, PX4_I2C_BUS_EXPANSION, NULL },
#endif
#ifdef PX4_I2C_BUS_EXPANSION1
{ MS5611_BUS_I2C_EXTERNAL, "/dev/ms5611_ext1", &MS5611_i2c_interface, PX4_I2C_BUS_EXPANSION1, NULL },
#endif
#ifdef PX4_I2C_BUS_EXPANSION2
{ MS5611_BUS_I2C_EXTERNAL, "/dev/ms5611_ext2", &MS5611_i2c_interface, PX4_I2C_BUS_EXPANSION2, NULL },
#endif
};
#define NUM_BUS_OPTIONS (sizeof(bus_options)/sizeof(bus_options[0]))
@@ -1198,10 +1203,15 @@ ms5611_main(int argc, char *argv[])
default:
ms5611::usage();
exit(0);
return 0;
}
}
if (myoptind >= argc) {
ms5611::usage();
return -1;
}
const char *verb = argv[myoptind];
/*
@@ -1232,5 +1242,6 @@ ms5611_main(int argc, char *argv[])
ms5611::info();
}
errx(1, "unrecognised command, try 'start', 'test', 'reset' or 'info'");
PX4_ERR("unrecognised command, try 'start', 'test', 'reset' or 'info'");
return -1;
}
+1 -1
View File
@@ -53,7 +53,6 @@
#include <px4_workqueue.h>
#include <perf/perf_counter.h>
#include <uORB/topics/battery_status.h>
#include <uORB/topics/subsystem_info.h>
#include <uORB/uORB.h>
#define BATT_SMBUS_ADDR_MIN 0x00 ///< lowest possible address
@@ -250,6 +249,7 @@ int serial_number();
BATT_SMBUS::BATT_SMBUS(int bus, uint16_t batt_smbus_addr) :
I2C("batt_smbus", "/dev/batt_smbus0", bus, batt_smbus_addr, 100000),
_enabled(false),
_last_report{},
_batt_topic(nullptr),
_batt_orb_id(nullptr),
_start_time(0),
-1
View File
@@ -112,7 +112,6 @@
#include <perf/perf_counter.h>
#include <systemlib/err.h>
#include <systemlib/systemlib.h>
#include <board_config.h>
-1
View File
@@ -73,7 +73,6 @@
#include <systemlib/cpuload.h>
#include <systemlib/err.h>
#include <systemlib/hardfault_log.h>
#include <systemlib/systemlib.h>
#include <parameters/param.h>
# if defined(FLASH_BASED_PARAMS)
-1
View File
@@ -78,7 +78,6 @@
#include <systemlib/hardfault_log.h>
#include <systemlib/systemlib.h>
#include <parameters/param.h>
/****************************************************************************
-1
View File
@@ -71,7 +71,6 @@
#include <systemlib/cpuload.h>
#include <systemlib/err.h>
#include <systemlib/hardfault_log.h>
#include <systemlib/systemlib.h>
#include <parameters/param.h>
/****************************************************************************
-1
View File
@@ -72,7 +72,6 @@
#include <parameters/param.h>
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
#include <systemlib/systemlib.h>
#endif
# if defined(FLASH_BASED_PARAMS)
-1
View File
@@ -78,7 +78,6 @@
#include <systemlib/hardfault_log.h>
#include <systemlib/systemlib.h>
#include <parameters/param.h>
/****************************************************************************
-1
View File
@@ -80,7 +80,6 @@
#include <systemlib/hardfault_log.h>
#endif
#include <systemlib/systemlib.h>
/****************************************************************************
* Pre-Processor Definitions
+6 -16
View File
@@ -69,26 +69,16 @@
*
* These are the channel numbers of the ADCs of the microcontroller that can be used by the Px4 Firmware in the adc driver
*/
// TODO: ADCs, eg. pixracer
//#define ADC_CHANNELS (1 << 2) | (1 << 3) | (1 << 4) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13) | (1 << 14)
#define ADC_CHANNELS (1 << 0) | (1 << 11) | (1 << 12)
// Placeholder
#define ADC_BATTERY_VOLTAGE_CHANNEL ((uint8_t)(-1))
#define ADC_BATTERY_CURRENT_CHANNEL ((uint8_t)(-1))
#define ADC_AIRSPEED_VOLTAGE_CHANNEL ((uint8_t)(-1))
// TODO: ADCs
//#define ADC_BATTERY_VOLTAGE_CHANNEL 2
//#define ADC_BATTERY_CURRENT_CHANNEL 3
//#define ADC_5V_RAIL_SENSE 4
//#define ADC_RC_RSSI_CHANNEL 11
#define ADC_BATTERY_VOLTAGE_CHANNEL 12
#define ADC_BATTERY_CURRENT_CHANNEL 11
#define ADC_RC_RSSI_CHANNEL 0
/* Define Battery 1 Voltage Divider and A per V
*/
// TODO:
//#define BOARD_BATTERY1_V_DIV (13.653333333f)
//#define BOARD_BATTERY1_A_PER_V (36.367515152f)
#define BOARD_BATTERY1_V_DIV (11.12f)
#define BOARD_BATTERY1_A_PER_V (31.f)
/* User GPIOs
*
+4 -7
View File
@@ -78,7 +78,6 @@
#include <systemlib/hardfault_log.h>
#include <systemlib/systemlib.h>
#include <parameters/param.h>
/****************************************************************************
@@ -185,12 +184,10 @@ stm32_boardinitialize(void)
board_autoled_initialize();
//TODO: ADCs
///* configure ADC pins */
//stm32_configgpio(GPIO_ADC1_IN2); /* BATT_VOLTAGE_SENS */
//stm32_configgpio(GPIO_ADC1_IN3); /* BATT_CURRENT_SENS */
//stm32_configgpio(GPIO_ADC1_IN4); /* VDD_5V_SENS */
//stm32_configgpio(GPIO_ADC1_IN11); /* RSSI analog in */
/* configure ADC pins */
stm32_configgpio(GPIO_ADC1_IN12); /* BATT_VOLTAGE_SENS */
stm32_configgpio(GPIO_ADC1_IN11); /* BATT_CURRENT_SENS */
stm32_configgpio(GPIO_ADC1_IN0); /* RSSI analog in */
// TODO: power peripherals
///* configure power supply control/sense pins */
-1
View File
@@ -105,4 +105,3 @@ __EXPORT void stm32_usbsuspend(FAR struct usbdev_s *dev, bool resume)
{
uinfo("resume: %d\n", resume);
}
@@ -80,7 +80,6 @@
#include <systemlib/hardfault_log.h>
#include <systemlib/systemlib.h>
#include <parameters/param.h>
/****************************************************************************
-1
View File
@@ -72,7 +72,6 @@
#include <parameters/param.h>
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
#include <systemlib/systemlib.h>
#endif
#include "board_config.h"
-1
View File
@@ -72,7 +72,6 @@
#include <parameters/param.h>
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
#include <systemlib/systemlib.h>
#endif
# if defined(FLASH_BASED_PARAMS)
-1
View File
@@ -71,7 +71,6 @@
#include <systemlib/cpuload.h>
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
#include <systemlib/systemlib.h>
#endif
#include "board_config.h"
-1
View File
@@ -78,7 +78,6 @@
#include <systemlib/hardfault_log.h>
#include <systemlib/systemlib.h>
#include <parameters/param.h>
/****************************************************************************
-1
View File
@@ -79,7 +79,6 @@
#include <systemlib/hardfault_log.h>
#include <systemlib/systemlib.h>
#include <parameters/param.h>
/****************************************************************************
-1
View File
@@ -79,7 +79,6 @@
#include <systemlib/hardfault_log.h>
#include <systemlib/systemlib.h>
#include <parameters/param.h>
/****************************************************************************
+8 -5
View File
@@ -228,10 +228,9 @@
#define PX4_I2C_BUS_EXPANSION 1
#define PX4_I2C_BUS_EXPANSION1 2
#define PX4_I2C_BUS_EXPANSION2 3
#define PX4_I2C_BUS_EXPANSION3 4
#define PX4_I2C_BUS_ONBOARD 3
#define PX4_I2C_BUS_EXPANSION2 4
#define PX4_I2C_BUS_LED PX4_I2C_BUS_EXPANSION
#define PX4_I2C_BUS_ONBOARD PX4_I2C_BUS_EXPANSION2
#define BOARD_NUMBER_I2C_BUSES 4
#define BOARD_I2C_BUS_CLOCK_INIT {100000, 100000, 100000, 100000}
@@ -316,7 +315,7 @@
/* Define Battery 1 Voltage Divider and A per V
*/
#define BOARD_BATTERY1_V_DIV (10.133333333f)
#define BOARD_BATTERY1_V_DIV (18.1f) /* measured with the provided PM board */
#define BOARD_BATTERY1_A_PER_V (36.367515152f)
/* HW has to large of R termination on ADC todo:change when HW value is chosen */
@@ -549,7 +548,11 @@
#define GPIO_RSSI_IN /* PB0 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTB|GPIO_PIN0)
#define GPIO_RSSI_IN_INIT /* PB0 */ 0 /* Leave as ADC RSSI_IN */
#define GPIO_nSAFETY_SWITCH_LED_OUT /* PE12 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN12)
/* Change GPIO_nSAFETY_SWITCH_LED_OUT to
* (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN12)
* to enable the safety switch led on FMU
*/
#define GPIO_nSAFETY_SWITCH_LED_OUT /* PE12 */ (GPIO_INPUT|GPIO_FLOAT|GPIO_PORTE|GPIO_PIN12)
#define GPIO_nSAFETY_SWITCH_LED_OUT_INIT /* PE12 */ (GPIO_INPUT|GPIO_FLOAT|GPIO_PORTE|GPIO_PIN12)
#define GPIO_SAFETY_SWITCH_IN /* PE10 */ (GPIO_INPUT|GPIO_PULLUP|GPIO_PORTE|GPIO_PIN10)
-1
View File
@@ -81,7 +81,6 @@
#include <systemlib/hardfault_log.h>
#include <systemlib/systemlib.h>
#include <parameters/param.h>
#include "up_internal.h"
@@ -79,7 +79,6 @@
#include <systemlib/hardfault_log.h>
#include <systemlib/systemlib.h>
#include <parameters/param.h>
#include "up_internal.h"
-1
View File
@@ -72,7 +72,6 @@
#include <parameters/param.h>
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
#include <systemlib/systemlib.h>
#endif
#include "board_config.h"
-1
View File
@@ -71,7 +71,6 @@
#include <systemlib/cpuload.h>
#include <systemlib/err.h>
#include <systemlib/hardfault_log.h>
#include <systemlib/systemlib.h>
#include <parameters/param.h>
# if defined(FLASH_BASED_PARAMS)
@@ -71,7 +71,6 @@
#include <systemlib/cpuload.h>
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
#include <systemlib/systemlib.h>
#endif
#include "board_config.h"
@@ -51,7 +51,6 @@
#include <mathlib/mathlib.h>
#include <matrix/math.hpp>
#include <px4_workqueue.h>
#include <systemlib/systemlib.h>
#include <systemlib/err.h>
#include <parameters/param.h>
#include <systemlib/mavlink_log.h>
@@ -115,6 +115,9 @@ PARAM_DEFINE_INT32(TRIG_MODE, 0);
* Selects which pin is used, ranges from 1 to 6 (AUX1-AUX6 on px4fmu-v2 and the rail
* pins on px4fmu-v4). The PWM interface takes two pins per camera, while relay
* triggers on every pin individually. Example: Value 56 would trigger on pins 5 and 6.
* For GPIO mode Pin 6 will be triggered followed by 5. With a value of 65 pin 5 will
* be triggered followed by 6. Pins may be non contiguous. I.E. 16 or 61.
* In GPIO mode the delay pin to pin is < .2 uS.
*
* @min 1
* @max 123456
@@ -27,7 +27,7 @@ public:
* trigger the camera
* @param enable
*/
virtual void trigger(bool enable) {}
virtual void trigger(bool trigger_on_true) {}
/**
* send command to turn the camera on/off
@@ -1,15 +1,21 @@
#ifdef __PX4_NUTTX
#include "gpio.h"
#include <cstring>
constexpr uint32_t CameraInterfaceGPIO::_gpios[6];
CameraInterfaceGPIO::CameraInterfaceGPIO():
CameraInterface(),
_polarity(0)
_trigger_invert(false),
_triggers{0}
{
_p_polarity = param_find("TRIG_POLARITY");
param_get(_p_polarity, &_polarity);
// polarity of the trigger (0 = active low, 1 = active high )
int32_t polarity;
param_get(_p_polarity, &polarity);
_trigger_invert = (polarity == 0);
get_pins();
setup();
@@ -21,29 +27,28 @@ CameraInterfaceGPIO::~CameraInterfaceGPIO()
void CameraInterfaceGPIO::setup()
{
for (unsigned i = 0; i < arraySize(_pins); i++) {
px4_arch_configgpio(_gpios[_pins[i]]);
px4_arch_gpiowrite(_gpios[_pins[i]], !_polarity);
for (unsigned i = 0, t = 0; i < arraySize(_pins); i++) {
// Pin range is from 1 to 6, indexes are 0 to 5
if (_pins[i] >= 0 && _pins[i] < (int)arraySize(_gpios)) {
uint32_t gpio = _gpios[_pins[i]];
_triggers[t++] = gpio;
px4_arch_configgpio(gpio);
px4_arch_gpiowrite(gpio, false ^ _trigger_invert);
}
}
}
void CameraInterfaceGPIO::trigger(bool enable)
void CameraInterfaceGPIO::trigger(bool trigger_on_true)
{
if (enable) {
for (unsigned i = 0; i < arraySize(_pins); i++) {
if (_pins[i] >= 0) {
// ACTIVE_LOW == 1
px4_arch_gpiowrite(_gpios[_pins[i]], _polarity);
}
}
bool trigger_state = trigger_on_true ^ _trigger_invert;
} else {
for (unsigned i = 0; i < arraySize(_pins); i++) {
if (_pins[i] >= 0) {
// ACTIVE_LOW == 1
px4_arch_gpiowrite(_gpios[_pins[i]], !_polarity);
}
}
for (unsigned i = 0; i < arraySize(_triggers); i++) {
if (_triggers[i] == 0) { break; }
px4_arch_gpiowrite(_triggers[i], trigger_state);
}
}
@@ -51,7 +56,7 @@ void CameraInterfaceGPIO::info()
{
PX4_INFO("GPIO trigger mode, pins enabled : [%d][%d][%d][%d][%d][%d], polarity : %s",
_pins[5], _pins[4], _pins[3], _pins[2], _pins[1], _pins[0],
_polarity ? "ACTIVE_HIGH" : "ACTIVE_LOW");
_trigger_invert ? "ACTIVE_LOW" : "ACTIVE_HIGH");
}
#endif /* ifdef __PX4_NUTTX */
@@ -18,7 +18,7 @@ public:
CameraInterfaceGPIO();
virtual ~CameraInterfaceGPIO();
void trigger(bool enable);
void trigger(bool trigger_on_true);
void info();
@@ -28,7 +28,7 @@ private:
param_t _p_polarity;
int _polarity;
bool _trigger_invert;
static constexpr uint32_t _gpios[6] = {
GPIO_GPIO0_OUTPUT,
@@ -39,6 +39,7 @@ private:
GPIO_GPIO5_OUTPUT
};
uint32_t _triggers[arraySize(_gpios)];
};
#endif /* ifdef __PX4_NUTTX */
@@ -46,12 +46,12 @@ void CameraInterfacePWM::setup()
}
void CameraInterfacePWM::trigger(bool enable)
void CameraInterfacePWM::trigger(bool trigger_on_true)
{
for (unsigned i = 0; i < arraySize(_pins); i++) {
if (_pins[i] >= 0) {
// Set all valid pins to shoot or neutral levels
up_pwm_trigger_set(_pins[i], math::constrain(enable ? PWM_CAMERA_SHOOT : PWM_CAMERA_NEUTRAL, 1000, 2000));
up_pwm_trigger_set(_pins[i], math::constrain(trigger_on_true ? PWM_CAMERA_SHOOT : PWM_CAMERA_NEUTRAL, 1000, 2000));
}
}
}
@@ -20,7 +20,7 @@ public:
CameraInterfacePWM();
virtual ~CameraInterfacePWM();
void trigger(bool enable);
void trigger(bool trigger_on_true);
void info();
@@ -52,7 +52,7 @@ void CameraInterfaceSeagull::setup()
PX4_ERR("Bad pin configuration - Seagull MAP2 requires 2 consecutive pins for control.");
}
void CameraInterfaceSeagull::trigger(bool enable)
void CameraInterfaceSeagull::trigger(bool trigger_on_true)
{
if (!_camera_is_on) {
@@ -62,7 +62,7 @@ void CameraInterfaceSeagull::trigger(bool enable)
for (unsigned i = 0; i < arraySize(_pins); i = i + 2) {
if (_pins[i] >= 0 && _pins[i + 1] >= 0) {
// Set channel 1 to shoot or neutral levels
up_pwm_trigger_set(_pins[i + 1], enable ? PWM_1_CAMERA_INSTANT_SHOOT : PWM_CAMERA_NEUTRAL);
up_pwm_trigger_set(_pins[i + 1], trigger_on_true ? PWM_1_CAMERA_INSTANT_SHOOT : PWM_CAMERA_NEUTRAL);
}
}
}
@@ -18,7 +18,7 @@ public:
CameraInterfaceSeagull();
virtual ~CameraInterfaceSeagull();
void trigger(bool enable);
void trigger(bool trigger_on_true);
void send_keep_alive(bool enable);
@@ -38,14 +38,16 @@
* Driver for the Eagle Tree Airspeed V3 connected via I2C.
*/
#include <cfloat>
#include <px4_config.h>
#include <drivers/device/i2c.h>
#include <systemlib/airspeed.h>
#include <systemlib/err.h>
#include <parameters/param.h>
#include <perf/perf_counter.h>
#include <px4_getopt.h>
#include <drivers/drv_airspeed.h>
#include <drivers/drv_hrt.h>
@@ -53,7 +55,6 @@
#include <uORB/uORB.h>
#include <uORB/topics/differential_pressure.h>
#include <uORB/topics/subsystem_info.h>
#include <drivers/airspeed/airspeed.h>
/* I2C bus address */
@@ -238,19 +239,58 @@ namespace ets_airspeed
ETSAirspeed *g_dev;
int start(int i2c_bus);
int bus_options[] = {
#ifdef PX4_I2C_BUS_EXPANSION
PX4_I2C_BUS_EXPANSION,
#endif
#ifdef PX4_I2C_BUS_EXPANSION1
PX4_I2C_BUS_EXPANSION1,
#endif
#ifdef PX4_I2C_BUS_EXPANSION2
PX4_I2C_BUS_EXPANSION2,
#endif
#ifdef PX4_I2C_BUS_ONBOARD
PX4_I2C_BUS_ONBOARD,
#endif
};
#define NUM_BUS_OPTIONS (sizeof(bus_options)/sizeof(bus_options[0]))
int start();
int start_bus(int i2c_bus);
int stop();
int reset();
int info();
/**
* Start the driver.
* Attempt to start driver on all available I2C busses.
*
* This function will return as soon as the first sensor
* is detected on one of the available busses or if no
* sensors are detected.
*
*/
int
start()
{
for (unsigned i = 0; i < NUM_BUS_OPTIONS; i++) {
if (start_bus(bus_options[i]) == PX4_OK) {
return PX4_OK;
}
}
return PX4_ERROR;
}
/**
* Start the driver on a specific bus.
*
* This function only returns if the sensor is up and running
* or could not be detected successfully.
*/
int
start(int i2c_bus)
start_bus(int i2c_bus)
{
int fd;
@@ -348,6 +388,7 @@ ets_airspeed_usage()
PX4_INFO("usage: ets_airspeed command [options]");
PX4_INFO("options:");
PX4_INFO("\t-b --bus i2cbus (%d)", PX4_I2C_BUS_DEFAULT);
PX4_INFO("\t-a --all");
PX4_INFO("command:");
PX4_INFO("\tstart|stop|reset|info");
}
@@ -357,38 +398,58 @@ ets_airspeed_main(int argc, char *argv[])
{
int i2c_bus = PX4_I2C_BUS_DEFAULT;
int i;
int myoptind = 1;
int ch;
const char *myoptarg = nullptr;
bool start_all = false;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "--bus") == 0) {
if (argc > i + 1) {
i2c_bus = atoi(argv[i + 1]);
}
while ((ch = px4_getopt(argc, argv, "ab:", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
case 'b':
i2c_bus = atoi(myoptarg);
break;
case 'a':
start_all = true;
break;
default:
ets_airspeed_usage();
return 0;
}
}
if (myoptind >= argc) {
ets_airspeed_usage();
return -1;
}
/*
* Start/load the driver.
*/
if (!strcmp(argv[1], "start")) {
return ets_airspeed::start(i2c_bus);
if (!strcmp(argv[myoptind], "start")) {
if (start_all) {
return ets_airspeed::start();
} else {
return ets_airspeed::start_bus(i2c_bus);
}
}
/*
* Stop the driver
*/
if (!strcmp(argv[1], "stop")) {
if (!strcmp(argv[myoptind], "stop")) {
return ets_airspeed::stop();
}
/*
* Reset the driver.
*/
if (!strcmp(argv[1], "reset")) {
if (!strcmp(argv[myoptind], "reset")) {
return ets_airspeed::reset();
}
ets_airspeed_usage();
return PX4_OK;
return 0;
}
@@ -50,10 +50,10 @@
*/
#include <px4_config.h>
#include <px4_getopt.h>
#include <drivers/device/i2c.h>
#include <systemlib/airspeed.h>
#include <systemlib/err.h>
#include <parameters/param.h>
#include <perf/perf_counter.h>
@@ -65,7 +65,6 @@
#include <uORB/uORB.h>
#include <uORB/topics/differential_pressure.h>
#include <uORB/topics/subsystem_info.h>
#include <uORB/topics/system_power.h>
#include <drivers/airspeed/airspeed.h>
@@ -82,6 +81,7 @@
#define MEAS_DRIVER_FILTER_FREQ 1.2f
#define CONVERSION_INTERVAL (1000000 / MEAS_RATE) /* microseconds */
class MEASAirspeed : public Airspeed
{
public:
@@ -374,18 +374,57 @@ namespace meas_airspeed
MEASAirspeed *g_dev = nullptr;
int start(int i2c_bus);
int bus_options[] = {
#ifdef PX4_I2C_BUS_EXPANSION
PX4_I2C_BUS_EXPANSION,
#endif
#ifdef PX4_I2C_BUS_EXPANSION1
PX4_I2C_BUS_EXPANSION1,
#endif
#ifdef PX4_I2C_BUS_EXPANSION2
PX4_I2C_BUS_EXPANSION2,
#endif
#ifdef PX4_I2C_BUS_ONBOARD
PX4_I2C_BUS_ONBOARD,
#endif
};
#define NUM_BUS_OPTIONS (sizeof(bus_options)/sizeof(bus_options[0]))
int start();
int start_bus(int i2c_bus);
int stop();
int reset();
/**
* Start the driver.
* Attempt to start driver on all available I2C busses.
*
* This function will return as soon as the first sensor
* is detected on one of the available busses or if no
* sensors are detected.
*
*/
int
start()
{
for (unsigned i = 0; i < NUM_BUS_OPTIONS; i++) {
if (start_bus(bus_options[i]) == PX4_OK) {
return PX4_OK;
}
}
return PX4_ERROR;
}
/**
* Start the driver on a specific bus.
*
* This function call only returns once the driver is up and running
* or failed to detect the sensor.
*/
int
start(int i2c_bus)
start_bus(int i2c_bus)
{
int fd;
@@ -484,6 +523,7 @@ meas_airspeed_usage()
PX4_INFO("usage: meas_airspeed command [options]");
PX4_INFO("options:");
PX4_INFO("\t-b --bus i2cbus (%d)", PX4_I2C_BUS_DEFAULT);
PX4_INFO("\t-a --all");
PX4_INFO("command:");
PX4_INFO("\tstart|stop|reset");
}
@@ -493,38 +533,60 @@ ms4525_airspeed_main(int argc, char *argv[])
{
int i2c_bus = PX4_I2C_BUS_DEFAULT;
int i;
int myoptind = 1;
int ch;
const char *myoptarg = nullptr;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "--bus") == 0) {
if (argc > i + 1) {
i2c_bus = atoi(argv[i + 1]);
}
bool start_all = false;
while ((ch = px4_getopt(argc, argv, "ab:", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
case 'b':
i2c_bus = atoi(myoptarg);
break;
case 'a':
start_all = true;
break;
default:
meas_airspeed_usage();
return 0;
}
}
if (myoptind >= argc) {
meas_airspeed_usage();
return -1;
}
/*
* Start/load the driver.
*/
if (!strcmp(argv[1], "start")) {
return meas_airspeed::start(i2c_bus);
if (!strcmp(argv[myoptind], "start")) {
if (start_all) {
return meas_airspeed::start();
} else {
return meas_airspeed::start_bus(i2c_bus);
}
}
/*
* Stop the driver
*/
if (!strcmp(argv[1], "stop")) {
if (!strcmp(argv[myoptind], "stop")) {
return meas_airspeed::stop();
}
/*
* Reset the driver.
*/
if (!strcmp(argv[1], "reset")) {
if (!strcmp(argv[myoptind], "reset")) {
return meas_airspeed::reset();
}
meas_airspeed_usage();
return PX4_OK;
return 0;
}
@@ -41,7 +41,6 @@
#include <mathlib/math/filter/LowPassFilter2p.hpp>
#include <px4_config.h>
#include <sys/types.h>
#include <systemlib/airspeed.h>
#include <perf/perf_counter.h>
#include <uORB/topics/differential_pressure.h>
#include <uORB/uORB.h>
@@ -33,6 +33,8 @@
#include "MS5525.hpp"
#include <px4_getopt.h>
// Driver 'main' command.
extern "C" __EXPORT int ms5525_airspeed_main(int argc, char *argv[]);
@@ -41,15 +43,56 @@ namespace ms5525_airspeed
{
MS5525 *g_dev = nullptr;
int start(uint8_t i2c_bus);
int bus_options[] = {
#ifdef PX4_I2C_BUS_EXPANSION
PX4_I2C_BUS_EXPANSION,
#endif
#ifdef PX4_I2C_BUS_EXPANSION1
PX4_I2C_BUS_EXPANSION1,
#endif
#ifdef PX4_I2C_BUS_EXPANSION2
PX4_I2C_BUS_EXPANSION2,
#endif
#ifdef PX4_I2C_BUS_ONBOARD
PX4_I2C_BUS_ONBOARD,
#endif
};
#define NUM_BUS_OPTIONS (sizeof(bus_options)/sizeof(bus_options[0]))
int start();
int start_bus(uint8_t i2c_bus);
int stop();
int reset();
// Start the driver.
// This function call only returns once the driver is up and running
// or failed to detect the sensor.
/**
* Attempt to start driver on all available I2C busses.
*
* This function will return as soon as the first sensor
* is detected on one of the available busses or if no
* sensors are detected.
*
*/
int
start(uint8_t i2c_bus)
start()
{
for (unsigned i = 0; i < NUM_BUS_OPTIONS; i++) {
if (start_bus(bus_options[i]) == PX4_OK) {
return PX4_OK;
}
}
return PX4_ERROR;
}
/**
* Start the driver on a specific bus.
*
* This function call only returns once the driver is up and running
* or failed to detect the sensor.
*/
int
start_bus(uint8_t i2c_bus)
{
int fd = -1;
@@ -139,11 +182,12 @@ int reset()
static void
ms5525_airspeed_usage()
{
PX4_WARN("usage: ms5525_airspeed command [options]");
PX4_WARN("options:");
PX4_WARN("\t-b --bus i2cbus (%d)", PX4_I2C_BUS_DEFAULT);
PX4_WARN("command:");
PX4_WARN("\tstart|stop|reset");
PX4_INFO("usage: ms5525_airspeed command [options]");
PX4_INFO("options:");
PX4_INFO("\t-b --bus i2cbus (%d)", PX4_I2C_BUS_DEFAULT);
PX4_INFO("\t-a --all");
PX4_INFO("command:");
PX4_INFO("\tstart|stop|reset");
}
int
@@ -151,36 +195,58 @@ ms5525_airspeed_main(int argc, char *argv[])
{
uint8_t i2c_bus = PX4_I2C_BUS_DEFAULT;
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "--bus") == 0) {
if (argc > i + 1) {
i2c_bus = atoi(argv[i + 1]);
}
int myoptind = 1;
int ch;
const char *myoptarg = nullptr;
bool start_all = false;
while ((ch = px4_getopt(argc, argv, "ab:", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
case 'b':
i2c_bus = atoi(myoptarg);
break;
case 'a':
start_all = true;
break;
default:
ms5525_airspeed_usage();
return 0;
}
}
if (myoptind >= argc) {
ms5525_airspeed_usage();
return -1;
}
/*
* Start/load the driver.
*/
if (!strcmp(argv[1], "start")) {
return ms5525_airspeed::start(i2c_bus);
if (!strcmp(argv[myoptind], "start")) {
if (start_all) {
return ms5525_airspeed::start();
} else {
return ms5525_airspeed::start_bus(i2c_bus);
}
}
/*
* Stop the driver
*/
if (!strcmp(argv[1], "stop")) {
if (!strcmp(argv[myoptind], "stop")) {
return ms5525_airspeed::stop();
}
/*
* Reset the driver.
*/
if (!strcmp(argv[1], "reset")) {
if (!strcmp(argv[myoptind], "reset")) {
return ms5525_airspeed::reset();
}
ms5525_airspeed_usage();
return PX4_OK;
return 0;
}
@@ -49,7 +49,6 @@
#include <mathlib/math/filter/LowPassFilter2p.hpp>
#include <px4_config.h>
#include <sys/types.h>
#include <systemlib/airspeed.h>
#include <perf/perf_counter.h>
#include <uORB/topics/differential_pressure.h>
#include <uORB/uORB.h>
@@ -32,6 +32,7 @@
****************************************************************************/
#include "SDP3X.hpp"
#include <px4_getopt.h>
// Driver 'main' command.
extern "C" __EXPORT int sdp3x_airspeed_main(int argc, char *argv[]);
@@ -41,15 +42,56 @@ namespace sdp3x_airspeed
{
SDP3X *g_dev = nullptr;
int start(uint8_t i2c_bus);
int bus_options[] = {
#ifdef PX4_I2C_BUS_EXPANSION
PX4_I2C_BUS_EXPANSION,
#endif
#ifdef PX4_I2C_BUS_EXPANSION1
PX4_I2C_BUS_EXPANSION1,
#endif
#ifdef PX4_I2C_BUS_EXPANSION2
PX4_I2C_BUS_EXPANSION2,
#endif
#ifdef PX4_I2C_BUS_ONBOARD
PX4_I2C_BUS_ONBOARD,
#endif
};
#define NUM_BUS_OPTIONS (sizeof(bus_options)/sizeof(bus_options[0]))
int start();
int start_bus(uint8_t i2c_bus);
int stop();
int reset();
// Start the driver.
// This function call only returns once the driver is up and running
// or failed to detect the sensor.
/**
* Attempt to start driver on all available I2C busses.
*
* This function will return as soon as the first sensor
* is detected on one of the available busses or if no
* sensors are detected.
*
*/
int
start(uint8_t i2c_bus)
start()
{
for (unsigned i = 0; i < NUM_BUS_OPTIONS; i++) {
if (start_bus(bus_options[i]) == PX4_OK) {
return PX4_OK;
}
}
return PX4_ERROR;
}
/**
* Start the driver on a specific bus.
*
* This function call only returns once the driver is up and running
* or failed to detect the sensor.
*/
int
start_bus(uint8_t i2c_bus)
{
int fd = -1;
@@ -152,11 +194,12 @@ int reset()
static void
sdp3x_airspeed_usage()
{
PX4_WARN("usage: sdp3x_airspeed command [options]");
PX4_WARN("options:");
PX4_WARN("\t-b --bus i2cbus (%d)", PX4_I2C_BUS_DEFAULT);
PX4_WARN("command:");
PX4_WARN("\tstart|stop|reset");
PX4_INFO("usage: sdp3x_airspeed command [options]");
PX4_INFO("options:");
PX4_INFO("\t-b --bus i2cbus (%d)", PX4_I2C_BUS_DEFAULT);
PX4_INFO("\t-a --all");
PX4_INFO("command:");
PX4_INFO("\tstart|stop|reset");
}
int
@@ -164,36 +207,59 @@ sdp3x_airspeed_main(int argc, char *argv[])
{
uint8_t i2c_bus = PX4_I2C_BUS_DEFAULT;
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "--bus") == 0) {
if (argc > i + 1) {
i2c_bus = atoi(argv[i + 1]);
}
int myoptind = 1;
int ch;
const char *myoptarg = nullptr;
bool start_all = false;
while ((ch = px4_getopt(argc, argv, "ab:", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
case 'b':
i2c_bus = atoi(myoptarg);
break;
case 'a':
start_all = true;
break;
default:
sdp3x_airspeed_usage();
return 0;
}
}
if (myoptind >= argc) {
sdp3x_airspeed_usage();
return -1;
}
/*
* Start/load the driver.
*/
if (!strcmp(argv[1], "start")) {
return sdp3x_airspeed::start(i2c_bus);
if (!strcmp(argv[myoptind], "start")) {
if (start_all) {
return sdp3x_airspeed::start();
} else {
return sdp3x_airspeed::start_bus(i2c_bus);
}
}
/*
* Stop the driver
*/
if (!strcmp(argv[1], "stop")) {
if (!strcmp(argv[myoptind], "stop")) {
return sdp3x_airspeed::stop();
}
/*
* Reset the driver.
*/
if (!strcmp(argv[1], "reset")) {
if (!strcmp(argv[myoptind], "reset")) {
return sdp3x_airspeed::reset();
}
sdp3x_airspeed_usage();
return PX4_OK;
return 0;
}
@@ -64,7 +64,6 @@
#include <drivers/device/ringbuffer.h>
#include <uORB/uORB.h>
#include <uORB/topics/subsystem_info.h>
#include <uORB/topics/distance_sensor.h>
#define SR04_MAX_RANGEFINDERS 6
@@ -73,7 +72,6 @@
/* Configuration Constants */
#define SR04_DEVICE_PATH "/dev/hc_sr04"
#define SUBSYSTEM_TYPE_RANGEFINDER 131072
/* Device limits */
#define SR04_MIN_DISTANCE (0.10f)
#define SR04_MAX_DISTANCE (4.00f)
@@ -623,25 +621,6 @@ HC_SR04::start()
(worker_t)&HC_SR04::cycle_trampoline,
this,
USEC2TICK(_cycling_rate));
/* notify about state change */
struct subsystem_info_s info = {};
info.present = true;
info.enabled = true;
info.ok = true;
info.subsystem_type = SUBSYSTEM_TYPE_RANGEFINDER;
static orb_advert_t pub = nullptr;
if (pub != nullptr) {
orb_publish(ORB_ID(subsystem_info), pub, &info);
} else {
pub = orb_advertise(ORB_ID(subsystem_info), &info);
}
}
void
@@ -75,6 +75,9 @@ static constexpr struct ll40ls_bus_option {
#ifdef PX4_I2C_BUS_EXPANSION1
{ LL40LS_BUS_I2C_EXTERNAL, "/dev/ll40ls_ext1", PX4_I2C_BUS_EXPANSION1 },
#endif
#ifdef PX4_I2C_BUS_EXPANSION2
{ LL40LS_BUS_I2C_EXTERNAL, "/dev/ll40ls_ext2", PX4_I2C_BUS_EXPANSION2 },
#endif
#ifdef PX4_I2C_BUS_ONBOARD
{ LL40LS_BUS_I2C_INTERNAL, "/dev/ll40ls_int", PX4_I2C_BUS_ONBOARD },
#endif
+7 -23
View File
@@ -67,7 +67,6 @@
#include <drivers/device/ringbuffer.h>
#include <uORB/uORB.h>
#include <uORB/topics/subsystem_info.h>
#include <uORB/topics/distance_sensor.h>
#include <board_config.h>
@@ -588,24 +587,6 @@ MB12XX::start()
/* schedule a cycle to start things */
work_queue(HPWORK, &_work, (worker_t)&MB12XX::cycle_trampoline, this, 5);
/* notify about state change */
struct subsystem_info_s info = {};
info.present = true;
info.enabled = true;
info.ok = true;
info.subsystem_type = subsystem_info_s::SUBSYSTEM_TYPE_RANGEFINDER;
static orb_advert_t pub = nullptr;
if (pub != nullptr) {
orb_publish(ORB_ID(subsystem_info), pub, &info);
} else {
pub = orb_advertise(ORB_ID(subsystem_info), &info);
}
}
void
@@ -879,25 +860,27 @@ info()
int
mb12xx_main(int argc, char *argv[])
{
// check for optional arguments
int ch;
int myoptind = 1;
const char *myoptarg = nullptr;
uint8_t rotation = distance_sensor_s::ROTATION_DOWNWARD_FACING;
while ((ch = px4_getopt(argc, argv, "R:", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
case 'R':
rotation = (uint8_t)atoi(myoptarg);
PX4_INFO("Setting distance sensor orientation to %d", (int)rotation);
break;
default:
PX4_WARN("Unknown option!");
return -1;
}
}
if (myoptind >= argc) {
goto out_error;
}
/*
* Start/load the driver.
*/
@@ -929,10 +912,11 @@ mb12xx_main(int argc, char *argv[])
/*
* Print driver information.
*/
if (!strcmp(argv[myoptind], "info") || !strcmp(argv[1], "status")) {
if (!strcmp(argv[myoptind], "info") || !strcmp(argv[myoptind], "status")) {
mb12xx::info();
}
out_error:
PX4_ERR("unrecognized command, try 'start', 'test', 'reset' or 'info'");
return PX4_ERROR;
}
+8 -21
View File
@@ -66,7 +66,6 @@
#include <drivers/device/ringbuffer.h>
#include <uORB/uORB.h>
#include <uORB/topics/subsystem_info.h>
#include <uORB/topics/distance_sensor.h>
#include "sf0x_parser.h"
@@ -644,21 +643,6 @@ SF0X::start()
/* schedule a cycle to start things */
work_queue(HPWORK, &_work, (worker_t)&SF0X::cycle_trampoline, this, 1);
// /* notify about state change */
// struct subsystem_info_s info = {
// true,
// true,
// true,
// SUBSYSTEM_TYPE_RANGEFINDER
// };
// static orb_advert_t pub = -1;
// if (pub > 0) {
// orb_publish(ORB_ID(subsystem_info), pub, &info);
// } else {
// pub = orb_advertise(ORB_ID(subsystem_info), &info);
// }
}
void
@@ -947,25 +931,27 @@ info()
int
sf0x_main(int argc, char *argv[])
{
// check for optional arguments
int ch;
uint8_t rotation = distance_sensor_s::ROTATION_DOWNWARD_FACING;
int myoptind = 1;
const char *myoptarg = nullptr;
while ((ch = px4_getopt(argc, argv, "R:", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
case 'R':
rotation = (uint8_t)atoi(myoptarg);
PX4_INFO("Setting distance sensor orientation to %d", (int)rotation);
break;
default:
PX4_WARN("Unknown option!");
return -1;
}
}
if (myoptind >= argc) {
goto out_error;
}
/*
* Start/load the driver.
*/
@@ -1002,10 +988,11 @@ sf0x_main(int argc, char *argv[])
/*
* Print driver information.
*/
if (!strcmp(argv[myoptind], "info") || !strcmp(argv[1], "status")) {
if (!strcmp(argv[myoptind], "info") || !strcmp(argv[myoptind], "status")) {
sf0x::info();
}
out_error:
PX4_ERR("unrecognized command, try 'start', 'test', 'reset' or 'info'");
return PX4_ERROR;
return -1;
}
+7 -4
View File
@@ -816,25 +816,27 @@ info()
int
sf1xx_main(int argc, char *argv[])
{
// check for optional arguments
int ch;
int myoptind = 1;
const char *myoptarg = nullptr;
uint8_t rotation = distance_sensor_s::ROTATION_DOWNWARD_FACING;
while ((ch = px4_getopt(argc, argv, "R:", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
case 'R':
rotation = (uint8_t)atoi(myoptarg);
PX4_INFO("Setting distance sensor orientation to %d", (int)rotation);
break;
default:
PX4_WARN("Unknown option!");
return -1;
}
}
if (myoptind >= argc) {
goto out_error;
}
/*
* Start/load the driver.
*/
@@ -870,6 +872,7 @@ sf1xx_main(int argc, char *argv[])
sf1xx::info();
}
out_error:
PX4_ERR("unrecognized command, try 'start', 'test', 'reset' or 'info'");
return PX4_ERROR;
return -1;
}
+12 -23
View File
@@ -66,7 +66,6 @@
#include <drivers/device/ringbuffer.h>
#include <uORB/uORB.h>
#include <uORB/topics/subsystem_info.h>
#include <uORB/topics/distance_sensor.h>
#include <board_config.h>
@@ -591,24 +590,6 @@ SRF02::start()
/* schedule a cycle to start things */
work_queue(HPWORK, &_work, (worker_t)&SRF02::cycle_trampoline, this, 5);
/* notify about state change */
struct subsystem_info_s info = {};
info.present = true;
info.enabled = true;
info.ok = true;
info.subsystem_type = subsystem_info_s::SUBSYSTEM_TYPE_RANGEFINDER;
static orb_advert_t pub = nullptr;
if (pub != nullptr) {
orb_publish(ORB_ID(subsystem_info), pub, &info);
} else {
pub = orb_advertise(ORB_ID(subsystem_info), &info);
}
}
void
@@ -719,7 +700,7 @@ void info();
void
start(uint8_t rotation)
{
int fd;
int fd = -1;
if (g_dev != nullptr) {
errx(1, "already started");
@@ -747,10 +728,15 @@ start(uint8_t rotation)
goto fail;
}
close(fd);
exit(0);
fail:
if (fd >= 0) {
close(fd);
}
if (g_dev != nullptr) {
delete g_dev;
g_dev = nullptr;
@@ -882,25 +868,27 @@ info()
int
srf02_main(int argc, char *argv[])
{
// check for optional arguments
int ch;
int myoptind = 1;
const char *myoptarg = nullptr;
uint8_t rotation = distance_sensor_s::ROTATION_DOWNWARD_FACING;
while ((ch = px4_getopt(argc, argv, "R:", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
case 'R':
rotation = (uint8_t)atoi(myoptarg);
PX4_INFO("Setting distance sensor orientation to %d", (int)rotation);
break;
default:
PX4_WARN("Unknown option!");
return -1;
}
}
if (myoptind >= argc) {
goto out_error;
}
/*
* Start/load the driver.
*/
@@ -936,6 +924,7 @@ srf02_main(int argc, char *argv[])
srf02::info();
}
out_error:
PX4_ERR("unrecognized command, try 'start', 'test', 'reset' or 'info'");
return PX4_ERROR;
}
@@ -66,7 +66,6 @@
#include <drivers/device/ringbuffer.h>
#include <uORB/uORB.h>
#include <uORB/topics/subsystem_info.h>
#include <uORB/topics/distance_sensor.h>
#include <board_config.h>
@@ -668,22 +667,6 @@ TERARANGER::start()
/* schedule a cycle to start things */
work_queue(HPWORK, &_work, (worker_t)&TERARANGER::cycle_trampoline, this, 1);
/* notify about state change */
struct subsystem_info_s info = {};
info.present = true;
info.enabled = true;
info.ok = true;
info.subsystem_type = subsystem_info_s::SUBSYSTEM_TYPE_RANGEFINDER;
static orb_advert_t pub = nullptr;
if (pub != nullptr) {
orb_publish(ORB_ID(subsystem_info), pub, &info);
} else {
pub = orb_advertise(ORB_ID(subsystem_info), &info);
}
}
void
@@ -950,14 +933,18 @@ teraranger_main(int argc, char *argv[])
switch (ch) {
case 'R':
rotation = (uint8_t)atoi(myoptarg);
PX4_INFO("Setting sensor orientation to %d", (int)rotation);
break;
default:
PX4_WARN("Unknown option!");
return -1;
}
}
if (myoptind >= argc) {
goto out_error;
}
/*
* Start/load the driver.
*/
@@ -989,10 +976,11 @@ teraranger_main(int argc, char *argv[])
/*
* Print driver information.
*/
if (!strcmp(argv[myoptind], "info") || !strcmp(argv[1], "status")) {
if (!strcmp(argv[myoptind], "info") || !strcmp(argv[myoptind], "status")) {
teraranger::info();
}
out_error:
PX4_ERR("unrecognized command, try 'start', 'test', 'reset' or 'info'");
return PX4_ERROR;
return -1;
}
+9 -26
View File
@@ -68,7 +68,6 @@
#include <drivers/device/ringbuffer.h>
#include <uORB/uORB.h>
#include <uORB/topics/subsystem_info.h>
#include <uORB/topics/distance_sensor.h>
#include <board_config.h>
@@ -607,24 +606,6 @@ TFMINI::start()
/* schedule a cycle to start things */
work_queue(HPWORK, &_work, (worker_t)&TFMINI::cycle_trampoline, this, 1);
/* notify about state change */
struct subsystem_info_s info = {};
info.present = true;
info.enabled = true;
info.ok = true;
info.subsystem_type = subsystem_info_s::SUBSYSTEM_TYPE_RANGEFINDER;
static orb_advert_t pub = nullptr;
if (pub != nullptr) {
orb_publish(ORB_ID(subsystem_info), pub, &info);
} else {
pub = orb_advertise(ORB_ID(subsystem_info), &info);
}
}
void
@@ -922,31 +903,32 @@ usage()
int
tfmini_main(int argc, char *argv[])
{
// check for optional arguments
int ch;
uint8_t rotation = distance_sensor_s::ROTATION_DOWNWARD_FACING;
const char *device_path = "";
int myoptind = 1;
const char *myoptarg = nullptr;
while ((ch = px4_getopt(argc, argv, "R:d:", &myoptind, &myoptarg)) != EOF) {
switch (ch) {
case 'R':
rotation = (uint8_t)atoi(myoptarg);
PX4_INFO("Setting distance sensor orientation to %d", (int)rotation);
break;
case 'd':
device_path = myoptarg;
PX4_INFO("Using device path '%s'", device_path);
break;
default:
PX4_WARN("Unknown option!");
return -1;
}
}
if (myoptind >= argc) {
goto out_error;
}
/*
* Start/load the driver.
*/
@@ -957,7 +939,7 @@ tfmini_main(int argc, char *argv[])
} else {
PX4_WARN("Please specify device path!");
tfmini::usage();
return PX4_ERROR;
return -1;
}
}
@@ -985,10 +967,11 @@ tfmini_main(int argc, char *argv[])
/*
* Print driver information.
*/
if (!strcmp(argv[myoptind], "info") || !strcmp(argv[1], "status")) {
if (!strcmp(argv[myoptind], "info") || !strcmp(argv[myoptind], "status")) {
tfmini::info();
}
out_error:
PX4_ERR("unrecognized command, try 'start', 'test', 'reset' or 'info'");
return PX4_ERROR;
return -1;
}
@@ -66,7 +66,6 @@
#include <drivers/device/ringbuffer.h>
#include <uORB/uORB.h>
#include <uORB/topics/subsystem_info.h>
#include <uORB/topics/distance_sensor.h>
#include <uORB/topics/obstacle_distance.h>
@@ -149,7 +148,6 @@ private:
int _orb_class_instance;
orb_advert_t _distance_sensor_topic;
orb_advert_t _subsystem_pub;
perf_counter_t _sample_perf;
perf_counter_t _comms_errors;
@@ -214,9 +212,9 @@ VL53LXX::VL53LXX(uint8_t rotation, int bus, int address) :
_class_instance(-1),
_orb_class_instance(-1),
_distance_sensor_topic(nullptr),
_subsystem_pub(nullptr),
_sample_perf(perf_alloc(PC_ELAPSED, "vl53lxx_read")),
_comms_errors(perf_alloc(PC_COUNT, "vl53lxx_com_err"))
_comms_errors(perf_alloc(PC_COUNT, "vl53lxx_com_err")),
_stop_variable(0)
{
// up the retries since the device misses the first measure attempts
I2C::_retries = 3;
@@ -720,22 +718,6 @@ VL53LXX::start()
/* schedule a cycle to start things */
work_queue(LPWORK, &_work, (worker_t)&VL53LXX::cycle_trampoline, this, USEC2TICK(VL53LXX_US));
/* notify about state change */
struct subsystem_info_s info = {};
info.timestamp = hrt_absolute_time();
info.present = true;
info.enabled = true;
info.ok = true;
info.subsystem_type = subsystem_info_s::SUBSYSTEM_TYPE_RANGEFINDER;
if (_subsystem_pub != nullptr) {
orb_publish(ORB_ID(subsystem_info), _subsystem_pub, &info);
} else {
_subsystem_pub = orb_advertise(ORB_ID(subsystem_info), &info);
}
}
@@ -1008,7 +990,7 @@ void info();
void
start(uint8_t rotation)
{
int fd;
int fd = -1;
if (g_dev != nullptr) {
errx(1, "already started");
@@ -1041,6 +1023,10 @@ start(uint8_t rotation)
fail:
if (fd >= 0) {
close(fd);
}
if (g_dev != nullptr) {
delete g_dev;
g_dev = nullptr;
@@ -1092,6 +1078,8 @@ test()
print_message(report);
close(fd);
errx(0, "PASS");
}
-1
View File
@@ -70,7 +70,6 @@
#include <arch/board/board.h>
#include <drivers/drv_hrt.h>
#include <mathlib/mathlib.h>
#include <systemlib/systemlib.h>
#include <systemlib/err.h>
#include <parameters/param.h>
#include <drivers/drv_gps.h>
+5 -1
View File
@@ -890,9 +890,12 @@ info()
int
bma180_main(int argc, char *argv[])
{
if (argc < 2) {
goto out_error;
}
/*
* Start/load the driver.
*/
if (!strcmp(argv[1], "start")) {
bma180::start();
@@ -919,5 +922,6 @@ bma180_main(int argc, char *argv[])
bma180::info();
}
out_error:
errx(1, "unrecognised command, try 'start', 'test', 'reset' or 'info'");
}

Some files were not shown because too many files have changed in this diff Show More