Commit Graph

29320 Commits

Author SHA1 Message Date
Beat Küng b076cfd4ed uorb: do not open a node exclusively for an advertiser
Exclusive open is not required, but we now need to ensure the queue size
is set atomically.

It avoids a race condition between 2 single-instance advertisers,
where one of them would fail to open the node with -EBUSY.
2019-12-03 14:30:25 -05:00
Beat Küng 6de6235fa9 uorb: fix several race conditions during topic initialization
Possible race conditions (they all happen between the check of existence
of a topic and trying to create the node):
- single instance, with multiple advertisers during the first advertise:
  both advertisers see the topic as non-existent and try to advertise it.
  One of them will fail, leading to an error message.
  This is the cause for telemetry_status advert failure seen in SITL in
  rare cases.
- multi-instance: subscription to non-existing instance -> px4_open fails,
  and the subscriber tries to create the node. If during that time a
  publisher publishes that instance, the subscriber will get (instance+1)
  (or fails if the max number of instances is exceeded).
  This is a race that goes pretty much unnoticed.
- multi-instance: 2 publishers can get the same instance (if is_published()
  is false in case both have not published data yet).
  This can also go unnoticed.
  Therefore the patch changes where _advertised is set: it is now set
  directly during the advertisement instead of during publication.
2019-12-03 14:30:25 -05:00
Beat Küng c5ec557a38 refactor uorb: rename published to advertised
No semantic change (yet)
2019-12-03 14:30:25 -05:00
Fabian Schilling 106905871d Use bc to support floating point PX4_SIM_SPEED_FACTOR 2019-07-03 13:59:06 -04:00
Beat Küng c92c90d4d9
logger: handle 'char' type in messages
Fixes errors like:
ERROR [logger] No definition for topic char[10] key;uint8_t[2] _padding0; found
when the Debug logging profile is selected.
2019-07-03 10:28:21 -04:00
dlwalter 7ab48dae57
px4_fmu-v5: rc.board_sensors start lis3mdl optional external magnetometer 2019-07-01 14:53:01 -04:00
RomanBapst 1fe70b2d6a
ekf2: fixed calculation of static pressure error
Signed-off-by: RomanBapst <bapstroman@gmail.com>
2019-06-27 12:38:05 -04:00
Mathieu Bresciani 220f5cc565
mc_pos_control: Explicitly convert tilt variables to radians during check and assignments 2019-06-27 12:38:00 -04:00
Lorenz Meier 4a1d16a06b
MAVLink module: Add additional IMUs as default outputs
This simplifies setup and verification of systems, as all three sensors can be looked at in a graph view.
2019-06-26 10:25:00 -04:00
Angel 92e9228fcd
Missed conversion to radians in AutoMapper and AutoMapper2 2019-06-26 09:23:55 -04:00
Matthias Grob f8db8650d0
Testing: hotfix to recover test coverage CI
CMAKE_TESTING should automatically be enabled
but I hoped to do that in the test.cmake
target specific options and not in the main
CMakeLists. I have to see if I can make that
order work. Here the hotfix to make CI work
again.
2019-06-24 16:56:12 -04:00
Matthias Grob 415b366c54
mc_att_control: Increase default rate integral gain
@bkueang and me realized that on every frame we tune the integral gain for
the roll and pitch rate controller is much too low. Usually it needs to be
increased to 0.3 or even 0.4 to have better "locked in" flight performance
and 0.2 seems like a good compromise for a safe default.
2019-06-24 12:36:34 -04:00
Matthias Grob 40e804d393
Airframes: rename normal S500 to generic and remove PX4 defaults 2019-06-24 12:36:31 -04:00
Matthias Grob 7195ae9ebb
Airframes: add Holybro S500 Kit which was tested at dev summit 2019-06-24 12:36:26 -04:00
Beat Küng 6956d85e10
mc rate controller: add I term reduction factor
Reduce the I gain for high rate errors to reduce bounce-back effects after
flips. Up to 200 degrees the gain is almost not reduced (<25%), so this
will only take noticeable effects for large errors (setpoint changes),
where we actually want to have an effect.

This allows to increase the MC_*RATE_I parameters w/o negative effects
when doing flips (i.e. bounce-back after flips).

The 400 degrees limit and the x^2 are empirical.

The better the rate tracking in general (high P gain), the less this is
required (because of the lower tracking error). At the same time it also
does not harm, as the i_factor will always be close to 1.
2019-06-24 11:56:57 -04:00
David Sidrane 011f4990ff Add CUAV 5+ and Nano to fmu-v5 manifest
* rcS: Set SYS_USE_IO for Nano
2019-06-22 18:30:54 +02:00
Martina Rivizzigno 413acc57be
reset the position lock only if current triplet latitude and longitude
are valid
2019-06-12 14:21:16 -04:00
Matthias Grob 0c110a4443
vtol_att_control: apply multicopter takeoff hotfix also for vtol (#12250)
Please see reference:
https://github.com/PX4/Firmware/issues/12171
2019-06-12 14:16:06 -04:00
Matthias Grob ea48cd4970 Takeoff: address @RomanBapst's review comments 2019-05-22 22:05:38 +02:00
Matthias Grob 1c776f16ec mc_att_control: fix applying not updated thrust setpoint 2019-05-22 22:05:38 +02:00
Matthias Grob 953e5e5019 Revert "mc_att_control: fix having high thrust when disarmed"
This reverts commit 0c81a19dec.
2019-05-22 22:05:38 +02:00
Matthias Grob fac3e1c3f9 mc_pos_control: switch back to velocity ramp
But fix the two crucial problems:
- When to begin the ramp?
There's a calculation now for the velocity ramp initial value
such that the resulting thrust is zero at the beginning.
- When to end the ramp?
The ramp is applied to the upwards velocity constraint and it
just ramps from the initial value to the velocity constraint
which is applied during flight. Slower/going down is always possible.
2019-05-22 22:05:38 +02:00
Matthias Grob 90c6fea408 mc_pos_control_params: user friendly default spool/rampup times 2019-05-22 22:05:38 +02:00
Matthias Grob 856d129bf8 mc_pos_control: fix updating takeoff state when no flight task is running
Without always updating the takeoff state it will not get skipped when
the takeoff happened manually and when you switch from manual to position
mode the drone goes to idle and falls.
2019-05-22 22:05:38 +02:00
Matthias Grob a9f0981aaf mc_pos_control: fix adjusting the wrong setpoint
There are two local_position_setpoint in the position controller.
One describing the setpoint the task gives to the position controller
and a second one with the output of the position controller. I corrected
the wrong one during takeoff because the new takeoff thrust ramp runs after
the controller and not before.
2019-05-22 22:05:38 +02:00
Matthias Grob ad6eb19f09 Add a Takeoff class to handle multicopter takeoff
In a deterministic way with clear states to go through.
2019-05-22 22:05:38 +02:00
Matthias Grob da533a7b1d mc_pos_control: replace takeoff velocity ramp with thrust ramp
The velocity ramp had problems with:
- different vehicle tunings resulted in the start value of the resulting
thrust ramp staring either higher and lower than zero thrust.
lower -> delay of beginning
higher -> small jump at beginning
- when a task set position and velocity at the same time during takeoff
(which AutoSmoothVel does) it resulted in a velocity setpoint
jump at the end of the ramp because the additional velocity
setpoint correction from the position controller was not considered.

The thrust ramp should now be very deterministic:
- always start at zero
- always end at the curreant thrust setpoint output
of the complete position controller
2019-05-22 22:05:38 +02:00
bresch bb055fdaf3 AutoSmoothVel - Override checkTakeoff with task-specific logic and reactivate z axis with downward velocity to takeoff smoothly 2019-05-22 22:05:38 +02:00
Matthias Grob 7c7d980cf0 FlightTasks: fix takeoff trigger for offboard 2019-05-22 22:05:38 +02:00
Matthias Grob e73218d665 mc_pos_control/FlightTasks: trigger takeoff based on task
The initial idea of the flight task architecture was that
a task can freely set it's setpoints and doesn't have to
worry about takeoff and landing. It would just takeoff
when it's landed and there's a setpoint to go up and
land when it puts a setpoint that pushes into the ground.
With the takeoff logic there are some significant interface
problems depending on the way a task is implemented:
From the setpoint is not high enough to trigger to
an unexpected takeoff because of some estimator
fluctuation affecting the setpoint. It's easiest to solve this
by allowing the task to determine when a takeoff is triggered.
If no condition is implemented by default a task is not
allowing a takeoff  and cannot be used to get the vehicle
off the ground.
2019-05-22 22:05:38 +02:00
Matthias Grob 9ba748e67e mc_att_control: fix having high thrust when disarmed
After boot the user is in manual mode and if he has an RC
but doesn't switch out the thrust gets set to the throttle stick
position. When he then starts a takeoff from tablet the thrust is still
high while arming and the land detector immediately sees a takeoff
skiping smooth takeoff from the position controller.
2019-05-22 22:05:38 +02:00
Matthias Grob ae96e16c73 mc_pos_control: initialize takeoff altitude reference
according to @dagar's review comment.
2019-05-22 22:05:38 +02:00
Matthias Grob 8036efd7f2 mc_pos_control: refactor takeoff trigger conditions to be positive 2019-05-22 22:05:38 +02:00
Matthias Grob 5e23883376 mc_pos_control: fix smooth takeoff ramp
- start from a velocity setpoint pushing into the ground
to ramp from idle thrust up.
- start with a bit higher velocity setpoint threshold to make
sure the vehicle has a chance to really get off the ground.
- calculate ramp slope from initialization setpoint to the desired one
instead from zero to the desired. this ramps up quicker when you demand
a very small upwards velocity like the AutoLineSmoothVel and
ManualPositionSmoothVel tasks do at the beginning.
- don't stay in the takeoff ramp depending on the land detector, this
is unnecessary.
2019-05-22 22:05:38 +02:00
Matthias Grob bc77302fc9 mc_pos_control: refactor smooth takeoff names
The comments and variable names were partly misleading.
I grouped all members, hopefully gave them more
understandable names and adjusted the comments.
2019-05-22 22:05:38 +02:00
Matthias Grob 6d5d09c231 mc_pos_control: refactor smooth takeoff call
There were two rather confusing function calls one to check
if smooth takeoff needs to be ran and one that updates it.
I combined them and documented the interface correctly
making the parameters non-reference const floats.
2019-05-22 22:05:38 +02:00
TSC21 3413df19e8 astyle: add microRTPS related code for format check and fix 2019-05-22 11:49:02 +02:00
TSC21 b3435dd1f5 microRTPS_transport: use preprocessor declarations to setup different build contexts for client and agent code 2019-05-22 11:49:02 +02:00
TSC21 f0447e0009 microRTPS_agent_CMakeLists.txt.template: add header files to micrortps_agent executable build 2019-05-22 11:49:02 +02:00
TSC21 95f144dfb7 msg.idl.template: do not generate typdefs for builtin types (not required) 2019-05-22 11:49:02 +02:00
TSC21 110a7931e4 microRTPS bridge generation: improve fastrtpsgen verbosity 2019-05-22 11:49:02 +02:00
TSC21 3536c9dddc RTPS IDL: fix const names; make IDL template similar to rosidl_generator_dds_idl/resource/msg.idl.em 2019-05-22 11:49:02 +02:00
Daniel Agar f0cd79953f create PX4Barometer class 2019-05-20 13:12:49 -04:00
Daniel Agar a883d8eff9 PX4Magnetometer now functional 2019-05-20 13:12:49 -04:00
Julian Oes 12374490cb visibility.h: clean up includes, add comments
This tries to make the visibility.h header clearer and better
structured. We don't actually need the ifdef for lockstep enabled or
disabled because that's now handled elsewhere.
2019-05-20 12:39:02 -04:00
Julian Oes 84537921e9 visibility.h: fix missing headers 2019-05-20 12:39:02 -04:00
Julian Oes 7a768dbab3 lockstep_scheduler: always use the same code
This define was not set anyway, and in my opinion we should
not use different code for tests anyway.
2019-05-20 12:39:02 -04:00
Julian Oes 52099f5792 cmake: include lockstep_scheduler test
This makes sure we add the lockstep_scheduler_test even if the
ENABLE_LOCKSTEP_SCHEDULER is not set to yes. This means the
lockstep_scheduler is not used for SITL but the CMakeLists.txt file
still used and the test added.
2019-05-20 12:39:02 -04:00
Julian Oes 8d8799097d lockstep_scheduler: convert test to gtest 2019-05-20 12:39:02 -04:00
Daniel Agar 162405479b
device drivers lib add linux spi support 2019-05-20 12:18:56 -04:00