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
e037edd2
Commit
e037edd2
authored
5 years ago
by
Martina Rivizzigno
Committed by
Lorenz Meier
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ObstacleAvoidance: once the commadand loiter has been sent, keep using
the first position when the oa fails as setpoint to avoid jumps
parent
0f346af2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/lib/FlightTasks/tasks/Utility/ObstacleAvoidance.cpp
+18
-2
18 additions, 2 deletions
src/lib/FlightTasks/tasks/Utility/ObstacleAvoidance.cpp
src/lib/FlightTasks/tasks/Utility/ObstacleAvoidance.hpp
+2
-0
2 additions, 0 deletions
src/lib/FlightTasks/tasks/Utility/ObstacleAvoidance.hpp
with
20 additions
and
2 deletions
src/lib/FlightTasks/tasks/Utility/ObstacleAvoidance.cpp
+
18
−
2
View file @
e037edd2
...
...
@@ -56,6 +56,7 @@ ObstacleAvoidance::ObstacleAvoidance(ModuleParams *parent) :
ModuleParams
(
parent
)
{
_desired_waypoint
=
empty_trajectory_waypoint
;
_failsafe_position
.
setNaN
();
}
ObstacleAvoidance
::~
ObstacleAvoidance
()
...
...
@@ -101,7 +102,21 @@ void ObstacleAvoidance::injectAvoidanceSetpoints(Vector3f &pos_sp, Vector3f &vel
if
(
avoidance_data_timeout
||
!
avoidance_point_valid
)
{
PX4_WARN
(
"Obstacle Avoidance system failed, loitering"
);
_publishVehicleCmdDoLoiter
();
if
(
!
PX4_ISFINITE
(
_failsafe_position
(
0
))
&&
!
PX4_ISFINITE
(
_failsafe_position
(
1
))
&&
!
PX4_ISFINITE
(
_failsafe_position
(
2
)))
{
// save vehicle position when entering failsafe
_failsafe_position
=
_position
;
}
pos_sp
=
_failsafe_position
;
vel_sp
.
setNaN
();
yaw_sp
=
NAN
;
yaw_speed_sp
=
NAN
;
return
;
}
else
{
_failsafe_position
.
setNaN
();
}
pos_sp
=
_sub_vehicle_trajectory_waypoint
->
get
().
waypoints
[
vehicle_trajectory_waypoint_s
::
POINT_0
].
position
;
...
...
@@ -149,6 +164,7 @@ void ObstacleAvoidance::updateAvoidanceDesiredSetpoints(const Vector3f &pos_sp,
void
ObstacleAvoidance
::
checkAvoidanceProgress
(
const
Vector3f
&
pos
,
const
Vector3f
&
prev_wp
,
float
target_acceptance_radius
,
const
Vector2f
&
closest_pt
)
{
_position
=
pos
;
position_controller_status_s
pos_control_status
=
{};
pos_control_status
.
timestamp
=
hrt_absolute_time
();
...
...
@@ -159,7 +175,7 @@ void ObstacleAvoidance::checkAvoidanceProgress(const Vector3f &pos, const Vector
// fraction of the previous-tagerget line that has been flown
const
float
prev_curr_travelled
=
prev_to_closest_pt
.
length
()
/
prev_to_target
.
length
();
Vector2f
pos_to_target
=
Vector2f
(
_curr_wp
-
pos
);
Vector2f
pos_to_target
=
Vector2f
(
_curr_wp
-
_
pos
ition
);
if
(
prev_curr_travelled
>
1.0
f
)
{
// if the vehicle projected position on the line previous-target is past the target waypoint,
...
...
@@ -167,7 +183,7 @@ void ObstacleAvoidance::checkAvoidanceProgress(const Vector3f &pos, const Vector
pos_control_status
.
acceptance_radius
=
pos_to_target
.
length
()
+
0.5
f
;
}
const
float
pos_to_target_z
=
fabsf
(
_curr_wp
(
2
)
-
pos
(
2
));
const
float
pos_to_target_z
=
fabsf
(
_curr_wp
(
2
)
-
_
pos
ition
(
2
));
if
(
pos_to_target
.
length
()
<
target_acceptance_radius
&&
pos_to_target_z
>
NAV_MC_ALT_RAD
.
get
())
{
// vehicle above or below the target waypoint
...
...
This diff is collapsed.
Click to expand it.
src/lib/FlightTasks/tasks/Utility/ObstacleAvoidance.hpp
+
2
−
0
View file @
e037edd2
...
...
@@ -116,6 +116,8 @@ private:
orb_advert_t
_pub_vehicle_command
{
nullptr
};
/**< vehicle command do publication */
matrix
::
Vector3f
_curr_wp
=
{};
/**< current position triplet */
matrix
::
Vector3f
_position
=
{};
/**< current position triplet */
matrix
::
Vector3f
_failsafe_position
=
{};
/**< vehicle position when entered in failsafe */
/**
* Publishes vehicle trajectory waypoint desired.
...
...
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