111 Commits

Author SHA1 Message Date
Matthias Grob
79b46e08a8 Rename manual_lockdown to kill for clarity 2025-07-28 17:07:08 +02:00
Matthias Grob
7fe78e184e Rename force_failsafe to termination for clarity 2025-07-25 13:01:25 -06:00
Jacob Dahl
09ebd21e55 mixer: remove used flag stop_outputs
dshot: fix motor test on CANnode

Also includes fixes for the DShot driver since stop_outputs is removed. The esc info command has been removed because it doesn't work with AM32, can only be used via command line, and complicates the driver
2025-07-11 08:53:52 -06:00
Jacob Dahl
6a1cefd7a6 uavcan: esc: fix uavcan ESC control
This fixes a number of issues with uavcan ESC control.

- Motor Testing when using a CANnode as a PWM expander now works by allowing the FunctionMotors class to perform prearm control

- The esc.RawCommand message is now always published for configured uavcan ESC outputs. Previously prior to arming the message would be published empty, which causes certain ESCs to enter an error state.

- Useless and redundant code has been removed and small name changes have been applied.
2025-07-11 08:53:52 -06:00
Silvan Fuhrer
cff5ecfd88 ICE: allow throttle setpoint to be set to NAN to stop motor without disarming
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2025-06-02 16:50:30 +02:00
Silvan Fuhrer
3c129aefa1
Add IC engine control module (#24055)
Internal combustion engine control module.
New actuator functions and RPM based start/restart logic.
Not enabled by default. 

---------

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
Co-authored-by: Pernilla <pernilla@auterion.com>
2025-02-18 17:15:32 +01:00
Beat Küng
491ee01ac4 rpm_capture: add rpm capture driver, publising pwm_input (for now) 2024-12-19 07:30:25 +01:00
Silvan Fuhrer
4db55cd25f mixer: FunctionMotors: compare against FLT_EPSILON instead of 0.f
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2024-12-13 17:56:46 +01:00
Silvan Fuhrer
d7904b5f2c mixer: FunctionMotors: leave NAN control values at NAN with non-zero THR_MDL_FAC
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2024-12-13 17:56:46 +01:00
Silvan Fuhrer
2f65644aeb mixer module: remove unused functions
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2024-11-21 11:57:50 -05:00
Igor Mišić
b9942ad7e0 lib/mixer_module: remove unused param MOT_SLEW_MAX 2024-10-14 10:03:30 +02:00
LucaS
ca47f6f016
lib/mixer_module: added a constant instance start so that when instance start is changed in actuator yaml files they parameters are able to be used (#23616)
Co-authored-by: Luca Scheuer <luca.scheuer@iq-control.com>
2024-08-26 14:51:09 -04:00
Matthias Grob
a8d54c7fae mixer_module: Reset RC passthrough functions to disarmed value when no stick input 2024-08-07 19:20:51 +02:00
Matthias Grob
b5f6699f2e mixer_module: send a last sample out after all outputs were disabled
This matters for PWM when the last output gets disabled on either FMU or IO
it would just keep on running.

Also when rebooting with a parameters reset or new airframe with no mapped outputs
it would previously keep outputting PWM with the disarmed value of the new airframe
e.g. 1000us which is a safety hazard because servos could break the physical limit of the
model or miscalibrated ESCs spinning motors.
2024-03-25 19:21:54 +01:00
Beat Küng
8b422c5ed6 fix FunctionActuatorSet: if a param is set to NaN, it should be ignored
MAVLink spec: https://mavlink.io/en/messages/common.html#MAV_CMD_DO_SET_ACTUATOR
Previously, a command was overwriting all other indexes.
2024-02-02 09:38:28 -05:00
Matthias Grob
e35380d6ae mixer_module_tests: cover output_limit_calc_single() 2023-12-07 21:35:55 -05:00
Matthias Grob
0a78690356 mixer_module: correct output_limit_calc_single calculation 2023-12-07 21:35:55 -05:00
Beat Küng
2f91102808 mixer_module: rename Offboard_Actuator_Set to Peripheral_via_Actuator_Set
Offboard is a bit too specifically tied to Offboard mode.
2023-11-15 13:18:58 +01:00
Matthias Grob
d2819ca754 FunctionsMotors: include motors instead of servos topic 2023-08-31 16:56:08 -04:00
Matthias Grob
a8bf47e606 Set default minimum and maximum PWM for motors
This allows to consistently define:
Motor stopped - disarmed PWM
Motor idling - minimum PWM
Motor at full thrust - maximum PWM

Any allocation can then distinctly decide if
a motor should be running or not depending
on the context and also explicitly command that.
2023-07-10 18:58:37 +02:00
Matthias Grob
a28ad8e845 mixer_module: consistent PWM/oneshot calibration range 2023-06-16 12:05:47 +02:00
Matthias Grob
1ceca8f2cf actuator_test: condition order refactoring 2023-06-16 12:05:47 +02:00
Matthias Grob
94d2140a4f mixer_module: remove unnecessary init state
That state only delayed the first arming by 50 miliseconds.
Was presumably a workaround for some issue very very early on.
See cc452834c0dabd2689f5f102ce1cbbe714f056dd
2023-06-09 21:15:08 -04:00
Matthias Grob
0f256718d3 mixer_module: correct pwm ramp
Before:
When the mixed throttle for the motor was exactly zero the ramp went
from the disarmed PWM value to the minimum PWM value.

When the throttle was even just slightly different from zero the ramp
made a jump up to the commanded throttle scaled between
disarmed PWM and maximum PWM, then ramped between
disarmed PWM and minimum PWM and at the end jumped up again to
the commanded throttle scaled between minimum PWM and maximum PWM.

After:
The ramp goes from disarmed PWM value to the the
commanded throttle scaled between minimum PWM and maximum PWM.
If the commanded throttle changes during the ramp then the scale and
hence also end value of the ramp changes.
2023-06-09 21:15:08 -04:00
Silvan Fuhrer
a1812dbde0 gimbal: move gimbal controls to new dedicated topic
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2023-03-16 11:55:45 +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
Silvan Fuhrer
a787a326e3 Fixed-wing: split out control of steering wheel into seperate message LandingGearWheel
Completely detach the steering wheel logic from the yaw controller (beside using the
same manual stick input in a manual flight mode).

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2022-11-22 13:46:25 -05:00
Beat Küng
a20c581111 mixer_module: remove unused limit_callbacks_to_primary argument 2022-11-22 13:41:16 -05:00
Daniel Agar
15fece7e14 delete SYS_CTRL_ALLOC 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
Daniel Agar
72efe84b80 delete MOT_ORDERING 2022-09-09 09:14:09 -04:00
Daniel Agar
a7bbcd5b04 delete lib/mixer and mixer_module static mixing 2022-09-09 09:14:09 -04:00
Daniel Agar
0019ffbea6 delete drv_mixer.h 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
Ville Juven
4f6d523c95 mixer_module: Fix linking of mixer_module
The module has a hard dependency on mixer library, so link them together
2022-08-23 21:04:58 -04:00
Beat Küng
e7588d2da0 px4io+pwm_out: set the PWM rate and disarmed value when a channel is first set to a servo
This should simplify the first setup a bit.
2022-07-31 11:20:57 -04:00
Daniel Agar
9ed861e0a3 lib/mixer_module: split functions into separate headers
- this arguably improves visibility/discoverability
2022-07-28 08:08:58 +02:00
Beat Küng
dfd934fbdb esc_report: add actuator_function 2022-05-12 07:58:56 +02:00
Beat Küng
32402f31df control_allocator: increase max num motors to 12 2022-05-10 08:57:39 +02:00
Daniel Agar
5e05d98fe2 output modules simplify locking for mixer reset and load
- fixes the deadlock in px4io ioctl mixer reset
   - px4io Run() locks (CDev semaphore)
   - mixer load goes through px4io ioctl MIXERIOCRESET which calls MixingOutput::resetMixerThreadSafe()
   - MixingOutput::resetMixerThreadSafe() stores a Command::Type::resetMixer command in an atomic variable, schedules a work queue cycle, then sleep spins until the command is cleared
   - the execution of the cycle eventually calls back into PX4IO::updateOutputs(), which tries to lock (and waits forever)
2022-04-19 08:52:17 +02:00
Daniel Agar
f4c3084c26 init adjustments to ensure used topics are advertised early (primarily for logging)
- multi-EKF create each instance as soon as IMU & mag are advertised (before device id populated)
2022-03-23 16:51:16 -04:00
wangwwno1
746c16400a Typo Fix: ChangeWorkQeue
Fix the typo of 'WorkItem::ChangeWorkQeue' to 'WorkItem::ChangeWorkQueue'
2022-03-15 13:31:52 -04:00
Beat Küng
591c95ce2f mixer_module: print actual failsafe value 2022-03-04 08:02:11 -05:00
Daniel Agar
49df00c319
lib/mixer_module: check thrust factor range valid and minor optimization (#19272) 2022-03-03 08:10:09 +01:00
Beat Küng
9ca58f5e97 actuator outputs: always add reverse range param
and remove the possibility to set min > max to reverse.

Initially the idea was to add the checkbox on the UI side, to avoid adding
another param, but I don't think I'll go through the extra effort on the
QGC side.
2022-01-14 12:18:29 -05:00
Daniel Agar
78b3d22471 lib/mixer_module: consume output_limit library 2022-01-10 11:59:55 +01:00
Beat Küng
28c4d0b7df mixer_module: add unit tests 2021-12-24 20:06:13 -05:00
Beat Küng
4c80adfaf1 control_allocator: implement trim + slew rate limits configuration 2021-12-24 20:06:13 -05:00
Beat Küng
d1abdd0f8d output drivers: add option to generate a separate output range reversing param
Makes it a bit easier to configure. Reversing by setting MIN > MAX is still
supported.
2021-12-24 20:06:13 -05:00