Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Baitboat
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
Baitboat
Commits
d3c37dcf
Commit
d3c37dcf
authored
12 years ago
by
Randy Mackay
Browse files
Options
Downloads
Patches
Plain Diff
Circle: allow counter clockwise rotation
parent
c53dca06
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ArduCopter/navigation.pde
+18
-5
18 additions, 5 deletions
ArduCopter/navigation.pde
with
18 additions
and
5 deletions
ArduCopter/navigation.pde
+
18
−
5
View file @
d3c37dcf
...
@@ -223,7 +223,7 @@ circle_set_center(const Vector3f current_position, float heading_in_radians)
...
@@ -223,7 +223,7 @@ circle_set_center(const Vector3f current_position, float heading_in_radians)
circle_center
.
y
=
current_position
.
y
+
(
float
)
g
.
circle_radius
*
100
*
sin_yaw
;
circle_center
.
y
=
current_position
.
y
+
(
float
)
g
.
circle_radius
*
100
*
sin_yaw
;
// if we are doing a panorama set the circle_angle to the current heading
// if we are doing a panorama set the circle_angle to the current heading
if
(
g
.
circle_radius
=
=
0
)
{
if
(
g
.
circle_radius
<
=
0
)
{
circle_angle
=
heading_in_radians
;
circle_angle
=
heading_in_radians
;
circle_angular_velocity_max
=
ToRad
(
g
.
circle_rate
);
circle_angular_velocity_max
=
ToRad
(
g
.
circle_rate
);
circle_angular_acceleration
=
circle_angular_velocity_max
;
// reach maximum yaw velocity in 1 second
circle_angular_acceleration
=
circle_angular_velocity_max
;
// reach maximum yaw velocity in 1 second
...
@@ -235,8 +235,14 @@ circle_set_center(const Vector3f current_position, float heading_in_radians)
...
@@ -235,8 +235,14 @@ circle_set_center(const Vector3f current_position, float heading_in_radians)
max_velocity
=
min
(
wp_nav
.
get_horizontal_velocity
(),
safe_sqrt
(
0.5
f
*
WPNAV_ACCELERATION
*
g
.
circle_radius
*
100.0
f
));
max_velocity
=
min
(
wp_nav
.
get_horizontal_velocity
(),
safe_sqrt
(
0.5
f
*
WPNAV_ACCELERATION
*
g
.
circle_radius
*
100.0
f
));
// angular_velocity in radians per second
// angular_velocity in radians per second
circle_angular_velocity_max
=
min
(
ToRad
(
g
.
circle_rate
),
max_velocity
/
((
float
)
g
.
circle_radius
*
100.0
f
));
circle_angular_velocity_max
=
max_velocity
/
((
float
)
g
.
circle_radius
*
100.0
f
);
circle_angular_velocity_max
=
constrain_float
(
ToRad
(
g
.
circle_rate
),
-
circle_angular_velocity_max
,
circle_angular_velocity_max
);
// angular_velocity in radians per second
circle_angular_acceleration
=
WPNAV_ACCELERATION
/
((
float
)
g
.
circle_radius
*
100
);
circle_angular_acceleration
=
WPNAV_ACCELERATION
/
((
float
)
g
.
circle_radius
*
100
);
if
(
g
.
circle_rate
<
0.0
f
)
{
circle_angular_acceleration
=
-
circle_angular_acceleration
;
}
}
}
// initialise other variables
// initialise other variables
...
@@ -252,9 +258,16 @@ update_circle(float dt)
...
@@ -252,9 +258,16 @@ update_circle(float dt)
Vector3f
circle_target
;
Vector3f
circle_target
;
// ramp up angular velocity to maximum
// ramp up angular velocity to maximum
if
(
circle_angular_velocity
<
circle_angular_velocity_max
){
if
(
g
.
circle_rate
>=
0
)
{
circle_angular_velocity
+=
circle_angular_acceleration
*
dt
;
if
(
circle_angular_velocity
<
circle_angular_velocity_max
)
{
circle_angular_velocity
=
constrain_float
(
circle_angular_velocity
,
0
,
circle_angular_velocity_max
);
circle_angular_velocity
+=
circle_angular_acceleration
*
dt
;
circle_angular_velocity
=
constrain_float
(
circle_angular_velocity
,
0
,
circle_angular_velocity_max
);
}
}
else
{
if
(
circle_angular_velocity
>
circle_angular_velocity_max
)
{
circle_angular_velocity
+=
circle_angular_acceleration
*
dt
;
circle_angular_velocity
=
constrain_float
(
circle_angular_velocity
,
circle_angular_velocity_max
,
0
);
}
}
}
// update the target angle
// update the target angle
...
...
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