Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New vehicle type: Airship #14862

Merged
merged 34 commits into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
e2d9bad
Update CONTRIBUTING.md
dan-leo Apr 29, 2020
e3f1229
Merge branch 'master' of https://github.com/PX4/Firmware
dan-leo May 6, 2020
f63a446
Merge branch 'master' of https://github.com/PX4/Firmware
dan-leo May 7, 2020
cc3e36a
added cloudship
dan-leo May 7, 2020
fca67cd
mixer update
dan-leo May 7, 2020
b00888c
revert astyle check
dan-leo May 9, 2020
d04899a
revert i2c_spi_buses.h
dan-leo May 9, 2020
da5f504
space
dan-leo May 9, 2020
b6a2223
renamed lta -> airship
dan-leo May 9, 2020
6a2b4ee
Merge branch 'master' of https://github.com/flycloudline/Firmware
dan-leo May 9, 2020
b30acd3
edits, cleaned up
dan-leo Jun 1, 2020
9921453
pr: further edits
dan-leo Jun 4, 2020
76b77e4
Merge branch 'master' of https://github.com/PX4/Firmware
dan-leo Jun 4, 2020
4bd3f4f
Merge branch 'master' of https://github.com/PX4/Firmware into revert_…
dan-leo Jun 6, 2020
e3ec272
Merge branch 'revert_submodules'
dan-leo Jun 6, 2020
7bd6474
added cloudship
dan-leo May 7, 2020
64bd184
mixer update
dan-leo May 7, 2020
8cbebee
revert i2c_spi_buses.h
dan-leo May 9, 2020
e46ca85
space
dan-leo May 9, 2020
6ad0172
renamed lta -> airship
dan-leo May 9, 2020
b60a32d
edits, cleaned up
dan-leo Jun 1, 2020
08129ab
pr: further edits
dan-leo Jun 4, 2020
c1c859c
Merge diverged branch 'master' of https://github.com/flycloudline/Fir…
dan-leo Jun 7, 2020
06677f7
revert submodules {sitl_gazebo, mavlink, nuttx, ecl}
dan-leo Jun 7, 2020
b4c6675
CI successful, astyle check
dan-leo Jun 7, 2020
669e227
uorb graph fix
dan-leo Jun 9, 2020
384662e
Change actuator scales for simulator, refactor airship code
antonerasm Jun 20, 2020
9855b09
Merge remote-tracking branch 'upstream/master'
antonerasm Jun 20, 2020
1e53880
Add airship land detector and handle airship arming state
antonerasm Jun 28, 2020
fa46136
Merge remote-tracking branch 'upstream/master'
antonerasm Jun 28, 2020
9b9832e
Add documentation for airship land detector
antonerasm Jun 28, 2020
fcaa8b3
Update state definition for readability
antonerasm Aug 7, 2020
1be3b55
Merge remote-tracking branch 'upstream/master'
antonerasm Aug 8, 2020
ab7cbb3
Update land detector arm variables
antonerasm Aug 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions ROMFS/px4fmu_common/init.d-posix/2507_cloudship
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh
#
# @name Cloudship
# @type Airship
# @class Airship
#
# @output MAIN1 stabilator
# @output MAIN2 motor 1 starboard
# @output MAIN3 motor 2 port
# @output MAIN4 rudder motor

sh /etc/init.d/rc.airship_defaults

param set PWM_MAX 2000
dan-leo marked this conversation as resolved.
Show resolved Hide resolved
param set PWM_MIN 1000

param set MPC_MANTHR_MIN 0.00
param set MPC_THR_MIN 0.00
param set MPC_THR_CURVE 1
param set MPC_THR_HOVER 0.0
dan-leo marked this conversation as resolved.
Show resolved Hide resolved

param set NAV_DLL_ACT 0
param set NAV_RCL_ACT 0

param set MC_ACRO_Y_MAX 360.0
param set MPC_MAN_Y_MAX 360.0

param set LNDMC_Z_VEL_MAX 0.01
param set LNDMC_XY_VEL_MAX 0.01
param set LNDMC_LOW_T_THR 0.01
param set LNDMC_ROT_MAX 1.0

set MIXER cloudship

# Configure this as airship.
# set MAV_TYPE 7
dan-leo marked this conversation as resolved.
Show resolved Hide resolved
38 changes: 38 additions & 0 deletions ROMFS/px4fmu_common/init.d/airframes/2507_cloudship
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh
#
# @name Cloudship
# @type Airship
# @class Airship
#
# @output MAIN1 stabilator
# @output MAIN2 motor 1 starboard
# @output MAIN3 motor 2 port
# @output MAIN4 rudder motor

sh /etc/init.d/rc.airship_defaults

param set PWM_MAX 2000
param set PWM_MIN 1000

param set MPC_MANTHR_MIN 0.00
param set MPC_THR_MIN 0.00
param set MPC_THR_CURVE 1
param set MPC_THR_HOVER 0.0

param set NAV_DLL_ACT 0
param set NAV_RCL_ACT 0

param set MC_ACRO_Y_MAX 360.0
param set MPC_MAN_Y_MAX 360.0

param set LNDMC_Z_VEL_MAX 0.01
param set LNDMC_XY_VEL_MAX 0.01
param set LNDMC_LOW_T_THR 0.01
param set LNDMC_ROT_MAX 1.0

set MIXER cloudship

# Configure this as airship.
# set MAV_TYPE 7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is currently using MAV_TYPE 2. It would be ideal to use MAV_TYPE 7, but the implementation seems non-trivial at the moment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be set to MAV_TYPE 7 and may be specify n=0 at https://github.com/PX4/Firmware/blob/master/src/modules/simulator/simulator_mavlink.cpp#L104. This way you are explicitly stating that the control inputs range from -1 ~ 1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this helps.


set PWM_OUT 1234
64 changes: 64 additions & 0 deletions ROMFS/px4fmu_common/init.d/rc.airship_apps
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/sh
#
# Standard apps for airships. Attitude/Position estimator, Attitude/Position control.
#
# NOTE: Script variables are declared/initialized/unset in the rcS script.
#

###############################################################################
# Begin Estimator Group Selection #
###############################################################################

#
# LPE
#
if param compare SYS_MC_EST_GROUP 1
then
#
# Try to start LPE. If it fails, start EKF2 as a default.
# Unfortunately we do not build it on px4_fmu-v2 due to a limited flash.
#
if attitude_estimator_q start
then
echo "WARN [init] Estimator LPE unsupported, EKF2 recommended."
local_position_estimator start
else
echo "ERROR [init] Estimator LPE not available. Using EKF2"
param set SYS_MC_EST_GROUP 2
param save
reboot
fi
else
#
# Q estimator (attitude estimation only)
#
if param compare SYS_MC_EST_GROUP 3
then
attitude_estimator_q start
else
#
# EKF2
#
param set SYS_MC_EST_GROUP 2
ekf2 start
fi
fi

###############################################################################
# End Estimator Group Selection #
###############################################################################

#
# Start Airship Attitude Controller.
#
airship_att_control start

#
# Start Position Controller.
#
mc_pos_control start

#
# Start Land Detector.
#
land_detector start multicopter
28 changes: 28 additions & 0 deletions ROMFS/px4fmu_common/init.d/rc.airship_defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh
#
# Airship default parameters.
#
# NOTE: Script variables are declared/initialized/unset in the rcS script.
#

set VEHICLE_TYPE airship

if [ $AUTOCNF = yes ]
then
param set NAV_ACC_RAD 2

param set RTL_RETURN_ALT 30
param set RTL_DESCEND_ALT 10
param set RTL_LAND_DELAY 1

param set PWM_MAX 2000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the default already, so no need to have them here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dan-leo why did you mark this as resolved? I don't see this being addressed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bkueng I didn't realize that when defined as a pwm parameter they already have those exact defaults. Updated, thanks!

param set PWM_MIN 1000
param set PWM_RATE 400
fi

#
# This is the gimbal pass mixer.
#
set MIXER_AUX pass

set PWM_AUX_OUT 1234
26 changes: 26 additions & 0 deletions ROMFS/px4fmu_common/init.d/rc.vehicle_setup
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,32 @@ then
sh /etc/init.d/rc.vtol_apps
fi

#
# Airship setup.
#
if [ $VEHICLE_TYPE = airship ]
then
if [ $MIXER = none ]
then
echo "Airship mixer undefined"
fi

if [ $MAV_TYPE = none ]
then
# Set a default MAV_TYPE = 2 if not defined.
set MAV_TYPE 2
fi

# Set the mav type parameter.
param set MAV_TYPE ${MAV_TYPE}

# Load mixer and configure outputs.
sh /etc/init.d/rc.interface

# Start airship apps.
sh /etc/init.d/rc.airship_apps
fi

#
# UUV setup
#
Expand Down
51 changes: 51 additions & 0 deletions ROMFS/px4fmu_common/mixers/cloudship.main.mix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
Stabilator/thruster/rudder mixer for PX4FMU
=======================================================

This file defines mixers suitable for controlling an airship with
stabilator, rudder rotor, starboard and port thruster using PX4FMU.
The configuration assumes the stabilator servo is connected to PX4FMU servo
output 0, starboard thruster to output 1, port thruster to output 2, and the
rudder rotor to output 3.

Inputs to the mixer come from channel group 0 (vehicle attitude), channels 0
(roll), 1 (pitch), 2 (yaw) and 3 (thrust) 4 (flaps).

Servo controlling stabilator mixer
------------
Two scalers total (output, thrust angle).

This mixer assumes that the stabilator servo is set up correctly mechanically;
depending on the actual configuration it may be necessary to reverse the scaling
factors (to reverse the servo movement) and adjust the offset, scaling and
endpoints to suit.

M: 1
S: 0 1 10000 10000 0 -10000 10000

Starboard and port thruster mixer
-----------------
Two scalers total (output, thrust).

By default mixer output is normalized. In the case of certain input controllers
the commented lines generate a full-range output (-1 to 1) from an input in the
(0 - 1) range. Inputs below zero are treated as zero.

M: 1
S: 0 3 10000 10000 0 -10000 10000
#S: 0 3 20000 20000 -10000 -10000 10000

M: 1
S: 0 3 10000 10000 0 -10000 10000
#S: 0 3 20000 20000 -10000 -10000 10000

Rudder rotor mixer
------------
Two scalers total (output, yaw).

This mixer assumes that the rudder rotor is set up correctly mechanically;
depending on the actual configuration it may be necessary to reverse the scaling
factors (to reverse the motor movement) and adjust the offset, scaling and
endpoints to suit.

M: 1
S: 0 2 10000 10000 0 -10000 10000
2 changes: 2 additions & 0 deletions Tools/px4airframes/srcparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def GetImageName(self):
return "YPlus"
elif (self.name == "Autogyro"):
return "Autogyro"
elif (self.name == "Airship"):
return "Airship"
elif (self.name == "Rover"):
return "Rover"
elif (self.name == "Boat"):
Expand Down
2 changes: 1 addition & 1 deletion Tools/sitl_gazebo
1 change: 1 addition & 0 deletions boards/px4/sitl/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ px4_add_board(
tone_alarm
#uavcan
MODULES
airship_att_control
airspeed_selector
attitude_estimator_q
camera_feedback
Expand Down
1 change: 1 addition & 0 deletions msg/vehicle_status.msg
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ uint8 VEHICLE_TYPE_UNKNOWN = 0
uint8 VEHICLE_TYPE_ROTARY_WING = 1
uint8 VEHICLE_TYPE_FIXED_WING = 2
uint8 VEHICLE_TYPE_ROVER = 3
uint8 VEHICLE_TYPE_AIRSHIP = 4

# state machine / state of vehicle.
# Encodes the complete system state and is set by the commander app.
Expand Down
2 changes: 1 addition & 1 deletion platforms/posix/cmake/sitl_target.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ set(models none shell
if750a iris iris_opt_flow iris_opt_flow_mockup iris_vision iris_rplidar iris_irlock iris_obs_avoid iris_rtps px4vision solo typhoon_h480
plane plane_cam plane_catapult plane_lidar
standard_vtol tailsitter tiltrotor
rover r1_rover boat
rover r1_rover boat cloudship
uuv_hippocampus)
set(worlds none empty baylands ksql_airport mcmillan_airfield sonoma_raceway warehouse)
set(all_posix_vmd_make_targets)
Expand Down
46 changes: 46 additions & 0 deletions src/modules/airship_att_control/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
############################################################################
#
# Copyright (c) 2015 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name PX4 nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################

px4_add_module(
MODULE modules__airship_att_control
MAIN airship_att_control
STACK_MAX 3500
COMPILE_FLAGS
SRCS
airship_att_control_main.cpp
DEPENDS
circuit_breaker
conversion
mathlib
px4_work_queue
)
Loading