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 all 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
15 changes: 15 additions & 0 deletions ROMFS/px4fmu_common/init.d-posix/2507_cloudship
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
#
# @name Cloudship
# @type Airship
# @class Airship
#
# @output MAIN1 thrust tilt
# @output MAIN2 starboard thruster
# @output MAIN3 port thruster
# @output MAIN4 tail thruster

sh /etc/init.d/rc.airship_defaults

set MIXER cloudship
set PWM_OUT 1234
21 changes: 21 additions & 0 deletions ROMFS/px4fmu_common/init.d/airframes/2507_cloudship
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh
#
# @name Cloudship
# @type Airship
# @class Airship
#
# @output MAIN1 starboard thruster
# @output MAIN2 port thruster
# @output MAIN3 thrust tilt
# @output MAIN4 tail thruster

sh /etc/init.d/rc.airship_defaults

if [ $AUTOCNF = yes ]
then
param set COM_PREARM_MODE 2
param set CBRK_IO_SAFETY 22027
fi

set MIXER cloudship
set PWM_OUT 1234
59 changes: 59 additions & 0 deletions ROMFS/px4fmu_common/init.d/rc.airship_apps
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/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 Land Detector.
#
land_detector start airship
14 changes: 14 additions & 0 deletions ROMFS/px4fmu_common/init.d/rc.airship_defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
#
# Airship default parameters.
#
# NOTE: Script variables are declared/initialized/unset in the rcS script.
#

set VEHICLE_TYPE airship

#
# 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 = 7 if not defined.
set MAV_TYPE 7
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
47 changes: 47 additions & 0 deletions ROMFS/px4fmu_common/mixers/cloudship.main.mix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Thrust tilt/ Starboard Thrust / Port Thrust / Tail Thrust mixer for PX4FMU
=======================================================

This file defines mixers suitable for controlling an airship with
a thrust tilt, starboard and port thruster and a tail thruster using PX4FMU.
The configuration assumes the starboard thruster is connected to PX4FMU
output 1, port thruster to output 2, tilt servo to output 3, and the
tail thruster to output 4.

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

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

By default mixer output is normalized. The input is in the (0 - 1) range.

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

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

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

This mixer assumes that the tilt 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

Tail thruster mixer
------------
Two scalers total (output, yaw).

This mixer assumes that the tail thruster 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
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 @@ -53,6 +53,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 @@ -80,7 +80,7 @@ set(models none shell
if750a iris iris_dual_gps 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 windy)
set(all_posix_vmd_make_targets)
Expand Down
43 changes: 43 additions & 0 deletions src/modules/airship_att_control/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
############################################################################
#
# 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
px4_work_queue
)
97 changes: 97 additions & 0 deletions src/modules/airship_att_control/airship_att_control.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/****************************************************************************
*
* Copyright (c) 2013-2018 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.
*
****************************************************************************/

#include <px4_platform_common/module.h>
#include <px4_platform_common/module_params.h>
#include <uORB/Publication.hpp>
#include <uORB/Subscription.hpp>
#include <uORB/SubscriptionCallback.hpp>
#include <uORB/topics/vehicle_status.h>
#include <uORB/topics/actuator_controls.h>
#include <uORB/topics/manual_control_setpoint.h>
#include <uORB/topics/parameter_update.h>
#include <uORB/topics/vehicle_angular_velocity.h>

/**
* Airship attitude control app start / stop handling function
*/
extern "C" __EXPORT int airship_att_control_main(int argc, char *argv[]);

class AirshipAttitudeControl : public ModuleBase<AirshipAttitudeControl>, public ModuleParams,
public px4::WorkItem
{
public:
AirshipAttitudeControl();

virtual ~AirshipAttitudeControl();

/** @see ModuleBase */
static int task_spawn(int argc, char *argv[]);

/** @see ModuleBase */
static int custom_command(int argc, char *argv[]);

/** @see ModuleBase */
static int print_usage(const char *reason = nullptr);

/** @see ModuleBase::print_status() */
int print_status() override;

void Run() override;

bool init();

private:

/**
* Check for parameter update and handle it.
*/
void parameter_update_poll();

void publish_actuator_controls();

uORB::Subscription _parameter_update_sub{ORB_ID(parameter_update)}; /**< parameter updates subscription */
uORB::Subscription _vehicle_status_sub{ORB_ID(vehicle_status)}; /**< vehicle status subscription */
uORB::Subscription _manual_control_sp_sub{ORB_ID(manual_control_setpoint)}; /**< manual control setpoint subscription */

uORB::SubscriptionCallbackWorkItem _vehicle_angular_velocity_sub{this, ORB_ID(vehicle_angular_velocity)};

uORB::Publication<actuator_controls_s> _actuators_0_pub;

struct manual_control_setpoint_s _manual_control_sp {}; /**< manual control setpoint */
struct vehicle_status_s _vehicle_status {}; /**< vehicle status */
struct actuator_controls_s _actuators {}; /**< actuator controls */

perf_counter_t _loop_perf; /**< loop performance counter */

};
Loading