Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
210910794
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2021
210910794
Commits
4ce1a917
Commit
4ce1a917
authored
5 years ago
by
bpwilcox
Browse files
Options
Downloads
Patches
Plain Diff
use stopRobot and fix rebase issue
parent
d50358b3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nav2_motion_primitives/src/back_up.cpp
+5
-7
5 additions, 7 deletions
nav2_motion_primitives/src/back_up.cpp
nav2_motion_primitives/src/spin.cpp
+2
-3
2 additions, 3 deletions
nav2_motion_primitives/src/spin.cpp
with
7 additions
and
10 deletions
nav2_motion_primitives/src/back_up.cpp
+
5
−
7
View file @
4ce1a917
...
...
@@ -56,14 +56,13 @@ Status BackUp::onRun(const std::shared_ptr<const BackUpAction::Goal> command)
Status
BackUp
::
onCycleUpdate
()
{
geometry_msgs
::
msg
::
Pose
current_pose
;
if
(
!
collision_checker_
->
getRobotPose
(
current_pose
))
{
RCLCPP_ERROR
(
node_
->
get_logger
(),
"
R
obot pose is not available."
);
RCLCPP_ERROR
(
node_
->
get_logger
(),
"
Current r
obot pose is not available."
);
return
Status
::
FAILED
;
}
double
diff_x
=
initial_pose_
->
pose
.
pose
.
position
.
x
-
current_
odom_pose
->
pose
.
pose
.
position
.
x
;
double
diff_y
=
initial_pose_
->
pose
.
pose
.
position
.
y
-
current_
odom_pose
->
pose
.
pose
.
position
.
y
;
double
diff_x
=
initial_pose_
.
position
.
x
-
current_pose
.
position
.
x
;
double
diff_y
=
initial_pose_
.
position
.
y
-
current_pose
.
position
.
y
;
double
distance
=
sqrt
(
diff_x
*
diff_x
+
diff_y
*
diff_y
);
if
(
distance
>=
abs
(
command_x_
))
{
...
...
@@ -82,9 +81,8 @@ Status BackUp::onCycleUpdate()
pose2d
.
theta
=
tf2
::
getYaw
(
current_pose
.
orientation
);
if
(
!
collision_checker_
->
isCollisionFree
(
pose2d
))
{
cmd_vel
.
linear
.
x
=
0
;
robot_
->
sendVelocity
(
cmd_vel
);
RCLCPP_ERROR
(
node_
->
get_logger
(),
"Cannot safely execute back up without collision."
);
stopRobot
();
RCLCPP_INFO
(
node_
->
get_logger
(),
"Collision Ahead - Exiting BackUp"
);
return
Status
::
SUCCEEDED
;
}
...
...
This diff is collapsed.
Click to expand it.
nav2_motion_primitives/src/spin.cpp
+
2
−
3
View file @
4ce1a917
...
...
@@ -101,9 +101,8 @@ Status Spin::timedSpin()
cmd_vel
.
angular
.
z
*
(
1
/
cycle_frequency_
);
if
(
!
collision_checker_
->
isCollisionFree
(
pose2d
))
{
cmd_vel
.
angular
.
z
=
0.0
;
robot_
->
sendVelocity
(
cmd_vel
);
RCLCPP_ERROR
(
node_
->
get_logger
(),
"Cannot safely execute spin without collision."
);
stopRobot
();
RCLCPP_INFO
(
node_
->
get_logger
(),
"Collision Ahead -Exiting Spin "
);
return
Status
::
SUCCEEDED
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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