Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Ardupilot
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenSource
Ardupilot
Commits
b7b5fe7a
Commit
b7b5fe7a
authored
12 years ago
by
Randy Mackay
Browse files
Options
Downloads
Patches
Plain Diff
Copter: project stopping point for loiter command
parent
fff56c47
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
ArduCopter/commands_logic.pde
+24
-24
24 additions, 24 deletions
ArduCopter/commands_logic.pde
with
24 additions
and
24 deletions
ArduCopter/commands_logic.pde
+
24
−
24
View file @
b7b5fe7a
...
@@ -351,6 +351,8 @@ static void do_land(const struct Location *cmd)
...
@@ -351,6 +351,8 @@ static void do_land(const struct Location *cmd)
// note: caller should set yaw_mode
// note: caller should set yaw_mode
static
void
do_loiter_unlimited
()
static
void
do_loiter_unlimited
()
{
{
Vector3f
target_pos
;
// set roll-pitch mode (no pilot input)
// set roll-pitch mode (no pilot input)
set_roll_pitch_mode
(
AUTO_RP
);
set_roll_pitch_mode
(
AUTO_RP
);
...
@@ -361,26 +363,24 @@ static void do_loiter_unlimited()
...
@@ -361,26 +363,24 @@ static void do_loiter_unlimited()
set_yaw_mode
(
YAW_HOLD
);
set_yaw_mode
(
YAW_HOLD
);
// get current position
// get current position
// To-Do: change this to projection based on current location and velocity
Vector3f
curr_pos
=
inertial_nav
.
get_position
();
Vector3f
curr
=
inertial_nav
.
get_position
();
// default to use position provided
// use current location if not provided
Vector3f
pos
=
pv_location_to_vector
(
command_nav_queue
);
if
(
command_nav_queue
.
lat
==
0
&&
command_nav_queue
.
lng
==
0
)
{
wp_nav
.
get_stopping_point
(
curr_pos
,
inertial_nav
.
get_velocity
(),
target_pos
);
}
else
{
// default to use position provided
target_pos
=
pv_location_to_vector
(
command_nav_queue
);
}
// use current altitude if not provided
// use current altitude if not provided
if
(
command_nav_queue
.
alt
==
0
)
{
if
(
command_nav_queue
.
alt
==
0
)
{
pos
.
z
=
curr
.
z
;
target_pos
.
z
=
curr_pos
.
z
;
}
// use current location if not provided
if
(
command_nav_queue
.
lat
==
0
&&
command_nav_queue
.
lng
==
0
)
{
pos
.
x
=
curr
.
x
;
pos
.
y
=
curr
.
y
;
}
}
// start way point navigator and provide it the desired location
// start way point navigator and provide it the desired location
set_nav_mode
(
NAV_WP
);
set_nav_mode
(
NAV_WP
);
wp_nav
.
set_destination
(
pos
);
wp_nav
.
set_destination
(
target_
pos
);
}
}
// do_circle - initiate moving in a circle
// do_circle - initiate moving in a circle
...
@@ -419,6 +419,8 @@ static void do_circle()
...
@@ -419,6 +419,8 @@ static void do_circle()
// note: caller should set yaw_mode
// note: caller should set yaw_mode
static
void
do_loiter_time
()
static
void
do_loiter_time
()
{
{
Vector3f
target_pos
;
// set roll-pitch mode (no pilot input)
// set roll-pitch mode (no pilot input)
set_roll_pitch_mode
(
AUTO_RP
);
set_roll_pitch_mode
(
AUTO_RP
);
...
@@ -429,26 +431,24 @@ static void do_loiter_time()
...
@@ -429,26 +431,24 @@ static void do_loiter_time()
set_yaw_mode
(
YAW_HOLD
);
set_yaw_mode
(
YAW_HOLD
);
// get current position
// get current position
// To-Do: change this to projection based on current location and velocity
Vector3f
curr_pos
=
inertial_nav
.
get_position
();
Vector3f
curr
=
inertial_nav
.
get_position
();
// default to use position provided
// use current location if not provided
Vector3f
pos
=
pv_location_to_vector
(
command_nav_queue
);
if
(
command_nav_queue
.
lat
==
0
&&
command_nav_queue
.
lng
==
0
)
{
wp_nav
.
get_stopping_point
(
curr_pos
,
inertial_nav
.
get_velocity
(),
target_pos
);
}
else
{
// default to use position provided
target_pos
=
pv_location_to_vector
(
command_nav_queue
);
}
// use current altitude if not provided
// use current altitude if not provided
if
(
command_nav_queue
.
alt
==
0
)
{
if
(
command_nav_queue
.
alt
==
0
)
{
pos
.
z
=
curr
.
z
;
target_pos
.
z
=
curr_pos
.
z
;
}
// use current location if not provided
if
(
command_nav_queue
.
lat
==
0
&&
command_nav_queue
.
lng
==
0
)
{
pos
.
x
=
curr
.
x
;
pos
.
y
=
curr
.
y
;
}
}
// start way point navigator and provide it the desired location
// start way point navigator and provide it the desired location
set_nav_mode
(
NAV_WP
);
set_nav_mode
(
NAV_WP
);
wp_nav
.
set_destination
(
pos
);
wp_nav
.
set_destination
(
target_
pos
);
// setup loiter timer
// setup loiter timer
loiter_time
=
0
;
loiter_time
=
0
;
...
...
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