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
4847023c
Commit
4847023c
authored
9 years ago
by
Andreas Antener
Committed by
Lorenz Meier
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
reset current setpoint when entering RTL
parent
f3f01ad9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/modules/navigator/mission_block.cpp
+18
-0
18 additions, 0 deletions
src/modules/navigator/mission_block.cpp
src/modules/navigator/mission_block.h
+2
-0
2 additions, 0 deletions
src/modules/navigator/mission_block.h
src/modules/navigator/rtl.cpp
+6
-2
6 additions, 2 deletions
src/modules/navigator/rtl.cpp
with
26 additions
and
2 deletions
src/modules/navigator/mission_block.cpp
+
18
−
0
View file @
4847023c
...
...
@@ -503,6 +503,24 @@ MissionBlock::set_land_item(struct mission_item_s *item, bool at_current_locatio
item
->
origin
=
ORIGIN_ONBOARD
;
}
void
MissionBlock
::
set_current_position_item
(
struct
mission_item_s
*
item
)
{
item
->
nav_cmd
=
NAV_CMD_WAYPOINT
;
item
->
lat
=
_navigator
->
get_global_position
()
->
lat
;
item
->
lon
=
_navigator
->
get_global_position
()
->
lon
;
item
->
altitude_is_relative
=
false
;
item
->
altitude
=
_navigator
->
get_global_position
()
->
alt
;
item
->
yaw
=
NAN
;
item
->
loiter_radius
=
_navigator
->
get_loiter_radius
();
item
->
loiter_direction
=
1
;
item
->
acceptance_radius
=
_navigator
->
get_acceptance_radius
();
item
->
time_inside
=
0.0
f
;
item
->
pitch_min
=
0.0
f
;
item
->
autocontinue
=
true
;
item
->
origin
=
ORIGIN_ONBOARD
;
}
void
MissionBlock
::
set_idle_item
(
struct
mission_item_s
*
item
)
{
...
...
This diff is collapsed.
Click to expand it.
src/modules/navigator/mission_block.h
+
2
−
0
View file @
4847023c
...
...
@@ -108,6 +108,8 @@ protected:
*/
void
set_land_item
(
struct
mission_item_s
*
item
,
bool
at_current_location
);
void
set_current_position_item
(
struct
mission_item_s
*
item
);
/**
* Set idle mission item
*/
...
...
This diff is collapsed.
Click to expand it.
src/modules/navigator/rtl.cpp
+
6
−
2
View file @
4847023c
...
...
@@ -85,6 +85,12 @@ RTL::on_inactive()
void
RTL
::
on_activation
()
{
/* reset starting point so we override what the triplet contained from the previous navigation state */
_rtl_start_lock
=
false
;
set_current_position_item
(
&
_mission_item
);
struct
position_setpoint_triplet_s
*
pos_sp_triplet
=
_navigator
->
get_position_setpoint_triplet
();
mission_item_to_position_setpoint
(
&
_mission_item
,
&
pos_sp_triplet
->
current
);
/* decide where to enter the RTL procedure when we switch into it */
if
(
_rtl_state
==
RTL_STATE_NONE
)
{
/* for safety reasons don't go into RTL if landed */
...
...
@@ -96,7 +102,6 @@ RTL::on_activation()
}
else
if
(
_navigator
->
get_global_position
()
->
alt
<
_navigator
->
get_home_position
()
->
alt
+
_param_return_alt
.
get
())
{
_rtl_state
=
RTL_STATE_CLIMB
;
_rtl_start_lock
=
false
;
/* otherwise go straight to return */
}
else
{
...
...
@@ -104,7 +109,6 @@ RTL::on_activation()
_rtl_state
=
RTL_STATE_RETURN
;
_mission_item
.
altitude_is_relative
=
false
;
_mission_item
.
altitude
=
_navigator
->
get_global_position
()
->
alt
;
_rtl_start_lock
=
false
;
}
}
...
...
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