518 Commits

Author SHA1 Message Date
Konrad
2779a00ac8 VTOL TAKEOFF: Add Config to deactivate, and deactivate on all boards except fmu_v5x and sitl.
QGC does not support VTOL takeoff and thus this is used to safe flash space.
2023-09-29 14:25:03 +02:00
Thomas Stastny
a1cd4fd5df Commander: make sure unsupported do reposition command result is published
todo: need to consolidate the command ack strategy in this function
2023-09-13 15:29:31 -04:00
Thomas Stastny
bec0d83cf4 Commander: dont accept reposition commands without the mode switch bit
avoids erroneous (unexpected) position setpoints when switching into hold from another mode
2023-09-13 15:29:31 -04:00
Daniel Agar
88e7452492
commander: collapse ArmStateMachine and simplify
- simplify vehicle_status.arming_state down to just armed and disarmed
    - ARMING_STATE_INIT doesn't matter
    - ARMING_STATE_STANDBY is effectively pre_flight_checks_pass
    - ARMING_STATE_STANDBY_ERROR not needed
    - ARMING_STATE_SHUTDOWN effectively not used (all the poweroff/shutdown calls loop forever in place)
    - ARMING_STATE_IN_AIR_RESTORE doesn't exist anymore
 - collapse ArmStateMachine into commander
     - all requests already go through Commander::arm() and Commander::dismarm()
 - other minor changes
     - VEHICLE_CMD_DO_FLIGHTTERMINATION undocumented (unused?) test command (param1 > 1.5f) removed
     - switching to NAVIGATION_STATE_TERMINATION triggers parachute command centrally (only if armed)

---------

Co-authored-by: Matthias Grob <maetugr@gmail.com>
2023-07-28 17:12:01 -04:00
Jukka Laitinen
deb6053d56 Update status leds every time when prearm check status changes
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-02-07 08:02:32 +01:00
Beat Küng
a8628c9d9c fix commander: clear takeoff_time only on disarm
Otherwise the flight time restriction flag gets cleared too early, before
disarming (which puts the vehicle into the previous mode and it might
take off again).
2023-02-01 08:48:09 +01:00
Silvan Fuhrer
a210c96aa9 Commander: ssimplify error messages for LOITER rejection
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-01-25 16:40:27 +01:00
Silvan Fuhrer
148ffe4e25 add support for DO_CHANGE_ALTITUDE
Do the same as DO_REPOSITION wit only the altitude field populated
and MAV_DO_REPOSITION_FLAGS set, which means:
- switch to Loiter mode if not already in it
- set the current altitude to what is specified in the altitdue field,
keep current altitude setpoint otherwise
- keep current position setpoint
- fall back to current estimated position in case a position setpoint
is not finite

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-01-25 16:40:27 +01:00
Silvan Fuhrer
bc9abf8c36 Commander: always update parameters, not just if disarmed
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-01-11 10:01:08 +01:00
Matthias Grob
331cb21dee manual_control_setpoint: change stick axes naming
In review it was requested to have a different name for
manual_control_setpoint.z because of the adjusted range.

I started to investigate what naming is most intuitive and found
that most people recognize the stick axes as roll, pitch, yaw, throttle.
It comes at no surprise because other autopilots
and APIs seem to share this convention.

While changing the code I realized that even within the code base
the axes are usually assigned to a variable with that name or
have comments next to the assignment clarifying the axes
using these names.
2022-11-28 19:25:55 +01:00
Matthias Grob
83246c84cf Switch manual_control_setpoint.z scaling from [0,1] to [-1,1]
To be consistent with all other axes of stick input and avoid future
rescaling confusion.

Note: for the MAVLink message 69 MANUAL_CONTROL it's using the full range
according to the message specs now [-1000,1000].
2022-11-28 19:25:55 +01:00
Thomas Stastny
6b9d86680b commander: fix hold after mission logic
previous change in logic to hold after mission clear also broke rtl, as non-mission takeoff still published a mission result which allowed entering the mission finished condition and always changing state to loiter (ignoring rtl). new logic only switches navigation states if mission is finish and the nav state is explicitly in takeoff state, or in mission state
2022-11-10 16:17:18 +01:00
Thomas Stastny
6dad3a5150 commander: hold after mission clear 2022-11-10 12:08:05 +01:00
JaeyoungLim
3f5d7f38cd
Handle waypoint altitude acceptance radius for boats (#20508)
This corrects the waypoint handling logic to include boat type vehicles
2022-10-31 09:13:13 +01:00
Daniel Agar
fe80e7aa46
commander: respect COM_CPU_MAX for overload and adjust default threshold 2022-10-19 20:25:06 -04:00
Daniel Agar
309465858a
commander: elapsed time checks avoid subtracting unsigned integers
- avoid the possibility of unsigned underflow from subtracting two HRT timestamps (uint64_t)
 - most of these aren't problematic, but people tend to replicate the pattern, so it's better to be safe
 - likely wasn't a problem when people were using hrt_absolute_time() in place, but if using an existing timestamp there's the possibility it's older than a more recent topic update
2022-10-19 20:21:36 -04:00
Beat Küng
3c290d812d commander: use printRejectMode() also for rtl, takeoff, land & mission commands 2022-10-13 16:05:25 -04:00
Beat Küng
d542ffc10c refactor vehicle_status_flags: rename to failsafe_flags 2022-10-13 16:05:25 -04:00
Beat Küng
f7819f5dba commander: reorder update calls
Moves the arming checks before the command handling.
This reduces the chance of race conditions. However it does not prevent
them! The SDK will need to check when offboard is ready to run/arm to fix
this.
Specifically this is for sitl offboard tests, where offboard_control_mode
is updated and immediately after a mode switch into offboard is commanded.
2022-10-11 22:31:20 -04:00
Beat Küng
38d3739b6d refactor commander: rename rc_signal_lost -> manual_control_signal_lost, data_link_lost -> gcs_connection_lost 2022-10-11 22:31:20 -04:00
Beat Küng
3d1da597dd commander: run arming checks on _offboard_control_mode_sub update 2022-10-11 22:31:20 -04:00
mcsauder
ebc88afe46 Apply Google Style to Commander Private methods, rename geofence message geofence_violation to primary_geofence_breached. 2022-10-11 22:31:20 -04:00
Beat Küng
c72c580a0b commander: run arming checks @ 10Hz
Required for things like RC loss.
2022-10-11 22:31:20 -04:00
Beat Küng
6fda555cba commander: move ownership of vehicle_status_flags_s to HealthAndArmingChecks 2022-10-11 22:31:20 -04:00
Beat Küng
500a896a56 commander: print reason for mode rejection & report for GCS switches as well 2022-10-11 22:31:20 -04:00
Beat Küng
e4bb219d10 vehicle_status_flags: cleanup message, move non-failsafe flags to vehicle_status 2022-10-11 22:31:20 -04:00
Beat Küng
ae6377dfa0 mission_result: remove unused fields 2022-10-11 22:31:20 -04:00
Beat Küng
455b885f86 commander: use new failsafe state machine and add user intention class 2022-10-11 22:31:20 -04:00
Beat Küng
e9387cac1d mavlink: move get_px4_custom_mode to px4_custom_mode.h 2022-10-11 22:31:20 -04:00
Matthias Grob
46e6e83e14 Commander: allow disarmin not-landed boat like rover
This is a hotfix and a boat should never even detect a takeoff
in normal operation.
2022-10-05 09:07:18 -04:00
Thomas Debrunner
0af87ec745 mavlink: initial OPEN_DRONE_ID_BASIC_ID/OPEN_DRONE_ID_LOCATION support 2022-10-04 14:40:59 -04:00
Daniel Agar
4ec9e2f216 uavcan: delete unused ESC idle and soft_stop 2022-09-09 09:14:09 -04:00
Daniel Agar
bcdd2203d3 delete systemcmds/motor_test and msg/test_motor.msg 2022-09-09 09:14:09 -04:00
Junwoo Hwang
2542b1bb26 Implement Pacakge delivery via Gripper during mission
This feature allows user to use a Gripper type pacakge delivery
mechanism on a drone to trigger the delivery during a mission via the
mission item `DO_GRIPPER`.

This is a minimal change that is intended to have simplest pacakge
delivery feature on PX4, however the future scope would extend this
feature out of Navigator, and rather move towards a federated PX4
(flight-mode flexibility) architecture. But until then, this will serve
the purpose.

Update Tools/sitl_gazebo submodule to remove sdf file overwrite error

- There was an error happening due to .sdf file being overwritten, it
was caused by a wrongfully added. sdf file.
- This update pulls in the PR commit: https://github.com/Auterion/sitl_gazebo/pull/147

Initial cut on supporing PAYLOAD_PLACE mission item

Tidy and comment on navigation.h to clarify mission item definition

- Convert vehicle command ack subscription data type to
SubscriptionData, to not care about having a dedicated struct for
copying the latest data
- Tidy and comment on navigation.h to clarify the definition of
mission_item_s, which is confusing as it is an intergration of MAVLink
Standard into PX4's internal Mission Item structure

Rename mission_block's mission item reached function & cleanup navigator

- Isolated Handle Vehicle Commands function inside the Navigator
- Rename mission_block's mission item reached function to 'reached or
completed', as the navigation command can also be an action (e.g.
DO_SET_SERVO, which doesn't make sense to refer to as 'reached' when we
have successfully done executed the command)

Include MAVLink PR commit to include payload_drop message

More changes to add payload_drop MAVLink message support

- Comitting for testing purposes

Add mission item payload_drop to vehicle command payload drop link

- Now with a mission item with the nav_cmd set to 'payload drop', the
appropriate 'payload drop' vehicle command will be issued

Make Payload drop executable via Mission Plan

Implement payload_drop module to simulate payload delivery

- Simple module that acknowledges the payload drop vehicle command after
certain time, to simulate a successful delivery

Additional changes - payload drop module not working yet

- Need to do more thread stuff to make it work :(

Fix Payload Drop enum mismatch in vehicle_command enums

- First functional Payload Drop Implementation MVP
- Simple Ack & resuming mission from Navigator tested successfully

Hold the position while executing payload drop mission item

- Still the position hold is not solid, maybe I am missing something in
the position setpoint part and all the internal implications of
Navigator :(

Add DO_WINCH command support

Some fixes after rebase on develop branch

- Some missed brackets
- Some comment edits, etc

Add DO_WINCH command support

- Still has a problem of flying away from the waypoint while the
DO_WINCH is being executed, probably position setpoint related stuff :(

Apply braking of the vehicle for DO_WINCH command

- Copies the behavior of NAV_CMD_DELAY, which executes a smooth, braking
behavior when executing the delay because of the braking condition in
`set_mission_items` function
- This will not apply to Fixed wings
- The payload deploy getting triggered may be too early, as right now as
soon as the vehicle approaches the waypoint within the acceptance
threshold, the payload gets deployed

Add DO_GRIPPER support

Implement Gripper actual Hardware triggering support

- Currently not working, possibly in the mixer there's a bug
- Implemented the publishing of actuator_controls_1 uORB topic
- Implemented the test command for the payload_drop module, to test the
grpiper functionality
- Edited px4board file to include the payload_drop module
- Added Holybro X500 V2 airframe file, to enable testing on X500 V2
- Created new Quad X Payload Delivery mixer, which maps the actuator
controls 1 topic's data into the MAIN pin 5 output

Make Payload Drop Gripper Work

- Initialization of the Gripper position to CLOSED on Constructor of the
payload_drop module
- Setting the OPEN and CLOSED value to the appropriate actuator controls
input

Set vehicle_command_ack message's timestamp correctly

- By not setting the timestamp, the ack commands were not correctly
graphed in PlotJuggler!

Rename payload drop module to payload deliverer

- I think it's a more complex name (harder to type), but more generic

Add Gripper class (WIP)

Add Gripper class functionalities

- Add gripper uORB message
- Add gripper state machine

Use Gripper class as main interface in payload_deliverer

- Utilizes Gripper class functions for doing Gripper functionality

Remove mixer based package delivery trigger logic

- Remove custom mixer files that mapped actuator controls to outputs
statically

Additional improvements of the payload_deliverer

Fix payload_deliverer module not starting

- _task_id wasn't geting set appropriately in task_spawn function, which
led to runtime failure

Add Gripper Function to mixer_module

- Still not showing up as function mapping in QGC, needs fix

Add parameters to control gripper behavior

- Now user can enable / disable gripper
- Also select which type of gripper to use

Applying review from nuno

Remove timeout fetching from mission item and use gripper's timeout

- Previously, it was planned to use a custom DO_GRIPPER and DO_WINCH
MAVLink message definitions with information on timeout, but since now
we are using original message definition, only relevant timeout
information is defined in the payload_deliverer class

- This change brings in the timeout parameter to the Navigator, which
then sets the timeout in the mission_block class level, which then
processes the timeout logic

Make payload deployment work for Allmend test :P

Support gripper open/close test commands in payload_deliverer

Move enum definition for GRIPPER_ACTION to vehicle_command.msg

Remove double call for ` ${R}etc/init.d/rc.vehicle_setup`

- Was introduced during the rebase
- Was causing module already running & uORB topic can't be advertised
errors

Fix format via `make format` command

Modify S500 airframe file to use for control allocation usage

- Added Control allocation related parameters as default to not have it
reset every time the airframe is selected

Implement mission specific payload deploy timeout and more changes

Switch payload_deliverer to run on work queue

Remove unnecessary files

- Airframe changes from enabling control allocation are removed

Address review comments

- Remove debug messages
- Remove unnecessary or verbose comments & code
- Properly call parameter_update() function

Switch payload_deliverer to scheduled interval work item & refactor

- Switch to Schedeuled on Interval Work Item, as previous vehicle
command subscription callback based behavior led to vehicle comamnd ack
not being sent accordingly (since the Run() wouldn't be called unless
there's a new vehicle command), leading to ack command not being sent
out
- Also, old vehicle commands were getting fetched due to the
subscription callback as well, which was removed with this patch
- Fix the wrong population of floating point param2 field of vehicle
command by int8_t type gripper action by creating dedicated function
- Refactor and add comments to increase readability

Add gripper::grabbing() method and handle this in parameter update

- Previously, the intermediate state 'grabbing' was not considered, and
when the parameter update was called after the first initialization of
the gripper, the grab() function was being called again, which would
produce unnecessary duplicate vehicle command.
- Also replaced direct .grab() access to sending vehicle comamnd, which
unifies the gripper actuation mechanism through vehicle commands.

Navigator: Change SubscriptionData to Subscription to reduce memory usage

- Also removed unused vehicle command ack sub

PayloadDeliverer: Remove unnecessary changes & Bring back vehicle_command sub cb
2022-09-07 08:11:52 +02:00
Beat Küng
0e130eac83 refactor commander: move code inside run() into separate methods 2022-09-01 17:07:23 -04:00
Beat Küng
dcb9b712bb refactor commander: move vehicle control mode to ModeUtil 2022-09-01 17:07:23 -04:00
Beat Küng
f197c8884d commander: move esc checks to arming check 2022-09-01 17:07:23 -04:00
Beat Küng
c9037f115b refactor commander: split out home position 2022-09-01 17:07:23 -04:00
Beat Küng
f17f38197d commander: move estimator checks to arming check 2022-09-01 17:07:23 -04:00
Beat Küng
cfe3d793bf commander: move battery handling into arming checks 2022-09-01 17:07:23 -04:00
Ben Berry
734d3e4aa0 Reverted changes that broke Level Horizon calibration 2022-08-29 09:54:36 +02:00
Beat Küng
1c89b0c9c8 commander: use actuator_function for ESC reporting 2022-08-25 22:02:15 -04:00
Beat Küng
13c93db11a commander: use circuit breaker params directly in arming checks 2022-08-25 22:02:15 -04:00
Beat Küng
4230eee24f commander: print 'ready for takeoff' to console for sitl after startup 2022-08-25 22:02:15 -04:00
Beat Küng
2fccb576ad commander: remove unused includes and variables 2022-08-25 22:02:15 -04:00
Beat Küng
b2cb164c12 commander: replace health flags with health_report from arming checks 2022-08-25 22:02:15 -04:00
Beat Küng
6d1fb92eb7 commander: rework arming checks to use the events interface 2022-08-25 22:02:15 -04:00
Beat Küng
c7b64e3c01 commander: check for ack when calling 'commander takeoff' 2022-08-25 22:02:15 -04:00
Beat Küng
406b0bbc86 commander: handle VEHICLE_CMD_RUN_PREARM_CHECKS 2022-08-25 22:02:15 -04:00
Daniel Agar
e99da22cbe delete CBRK_VELPOSERR circuit breaker 2022-07-12 13:51:13 -04:00