Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
945dda04
Commit
945dda04
authored
9 years ago
by
davidvor
Committed by
tumbili
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
comments
parent
76c47917
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/modules/vtol_att_control/tailsitter.cpp
+17
-18
17 additions, 18 deletions
src/modules/vtol_att_control/tailsitter.cpp
with
17 additions
and
18 deletions
src/modules/vtol_att_control/tailsitter.cpp
+
17
−
18
View file @
945dda04
...
...
@@ -127,15 +127,15 @@ void Tailsitter::update_vtol_state()
parameters_update
();
/* simple logic using a two way switch to perform transitions.
* after flipping the switch the vehicle will start tilting
rotors
, picking up
* forward speed. After the vehicle has picked up enough
speed the rotors are tilted
*
forward completely.
For the backtransition the
motors simply rotate back
.
* after flipping the switch the vehicle will start tilting
in MC control mode
, picking up
* forward speed. After the vehicle has picked up enough
and sufficient pitch angle the uav will go into FW mode.
* For the backtransition the
pitch is controlled in MC mode again and switches to full MC control reaching the sufficient pitch angle
.
*/
if
(
_manual_control_sp
->
aux1
<
0.0
f
)
{
// user switchig to MC mode
if
(
_manual_control_sp
->
aux1
<
0.0
f
)
{
// plane is in multicopter mode
switch
(
_vtol_schedule
.
flight_mode
)
{
switch
(
_vtol_schedule
.
flight_mode
)
{
// user switchig to MC mode
case
MC_MODE
:
break
;
case
FW_MODE
:
...
...
@@ -147,8 +147,9 @@ void Tailsitter::update_vtol_state()
_vtol_schedule
.
flight_mode
=
MC_MODE
;
break
;
case
TRANSITION_FRONT_P2
:
// NOT USED
// failsafe into multicopter mode
_vtol_schedule
.
flight_mode
=
MC_MODE
;
//
_vtol_schedule.flight_mode = MC_MODE;
break
;
case
TRANSITION_BACK
:
// check if we have reached pitch angle to switch to MC mode
...
...
@@ -175,10 +176,11 @@ void Tailsitter::update_vtol_state()
}
break
;
case
TRANSITION_FRONT_P2
:
// NOT USED
// check if we have reached pitch angle to switch to FW mode
if
(
_v_att
->
pitch
<=
PITCH_TRANSITION_FRONT_P2
)
{
_vtol_schedule
.
flight_mode
=
FW_MODE
;
}
//
if (_v_att->pitch <= PITCH_TRANSITION_FRONT_P2) {
//
_vtol_schedule.flight_mode = FW_MODE;
//
}
break
;
case
TRANSITION_BACK
:
// failsafe into fixed wing mode
...
...
@@ -316,10 +318,10 @@ void Tailsitter::update_transition_state()
}
/** create time dependant pitch angle set point stating at -pi/2 + 0.2 rad overlap over the switch value*/
_v_att_sp
->
pitch_body
=
-
1.57
f
+
_pitch_transition_start
+
fabsf
(
PITCH_TRANSITION_BACK
+
1.57
f
)
*
(
float
)
hrt_elapsed_time
(
&
_vtol_schedule
.
transition_start
)
/
(
_params_tailsitter
.
back_trans_dur
*
1000000.0
f
);
_v_att_sp
->
pitch_body
=
M_PI_2_F
+
_pitch_transition_start
+
fabsf
(
PITCH_TRANSITION_BACK
+
1.57
f
)
*
(
float
)
hrt_elapsed_time
(
&
_vtol_schedule
.
transition_start
)
/
(
_params_tailsitter
.
back_trans_dur
*
1000000.0
f
);
_v_att_sp
->
pitch_body
=
math
::
constrain
(
_v_att_sp
->
pitch_body
,
-
2.0
f
,
PITCH_TRANSITION_BACK
+
0.2
f
);
// throttle value is decreesed
_v_att_sp
->
thrust
=
_throttle_transition
*
0.9
f
;
/** keep yaw disabled */
...
...
@@ -329,9 +331,6 @@ void Tailsitter::update_transition_state()
_mc_roll_weight
=
1.0
f
*
(
float
)
hrt_elapsed_time
(
&
_vtol_schedule
.
transition_start
)
/
(
_params_tailsitter
.
back_trans_dur
*
1000000.0
f
);
_mc_pitch_weight
=
1.0
f
*
(
float
)
hrt_elapsed_time
(
&
_vtol_schedule
.
transition_start
)
/
(
_params_tailsitter
.
back_trans_dur
*
1000000.0
f
);
// throttle value is the same as started
}
...
...
@@ -449,7 +448,7 @@ void Tailsitter::fill_actuator_outputs()
_actuators_out_1
->
control
[
actuator_controls_s
::
INDEX_THROTTLE
]
=
_actuators_fw_in
->
control
[
actuator_controls_s
::
INDEX_THROTTLE
];
// throttle
break
;
case
TRANSITION
:
// in transition engines are mixed by weight (
FRONT_P2 , BACK
)
// in transition engines are mixed by weight (
BACK TRANSITION ONLY
)
_actuators_out_0
->
control
[
actuator_controls_s
::
INDEX_ROLL
]
=
_actuators_mc_in
->
control
[
actuator_controls_s
::
INDEX_ROLL
]
*
_mc_roll_weight
;
_actuators_out_0
->
control
[
actuator_controls_s
::
INDEX_PITCH
]
=
_actuators_mc_in
->
control
[
actuator_controls_s
::
INDEX_PITCH
]
*
_mc_pitch_weight
;
_actuators_out_0
->
control
[
actuator_controls_s
::
INDEX_YAW
]
=
_actuators_mc_in
->
control
[
actuator_controls_s
::
INDEX_YAW
]
*
_mc_yaw_weight
;
...
...
@@ -457,8 +456,8 @@ void Tailsitter::fill_actuator_outputs()
// NOTE: There is no mistake in the line below, multicopter yaw axis is controlled by elevon roll actuation!
_actuators_out_1
->
control
[
actuator_controls_s
::
INDEX_ROLL
]
=
-
_actuators_fw_in
->
control
[
actuator_controls_s
::
INDEX_ROLL
]
*
(
1
-
_mc_roll_weight
);
_actuators_out_1
->
control
[
actuator_controls_s
::
INDEX_PITCH
]
=
_actuators_mc_in
->
control
[
actuator_controls_s
::
INDEX_PITCH
]
*
_mc_pitch_weight
+
(
_actuators_fw_in
->
control
[
actuator_controls_s
::
INDEX_PITCH
]
+
_params
->
fw_pitch_trim
)
*
(
1
-
_mc_pitch_weight
);
_actuators_out_1
->
control
[
actuator_controls_s
::
INDEX_PITCH
]
=
_actuators_mc_in
->
control
[
actuator_controls_s
::
INDEX_PITCH
]
*
_mc_pitch_weight
;
// **LATER**
+ (_actuators_fw_in->control[actuator_controls_s::INDEX_PITCH] + _params->fw_pitch_trim) *(1 - _mc_pitch_weight);
_actuators_out_1
->
control
[
actuator_controls_s
::
INDEX_THROTTLE
]
=
_actuators_fw_in
->
control
[
actuator_controls_s
::
INDEX_THROTTLE
];
break
;
case
EXTERNAL
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment