BasicNavigator Spin action

Hello,

I am trying to use the Spin action for the BasicNavigator. I am able to successfully use the followWaypoints method. But, when I try using the Spin action (either in python script or commandline):

ros2 action send_goal /spin nav2_msgs/action/Spin “{target_yaw: 1.57, time_allowance: {sec: 5, nanosec: 0}}”

I get this response:
Waiting for an action server to become available…
Sending goal:
target_yaw: 1.57
time_allowance:
sec: 5
nanosec: 0

Goal accepted with ID: 0f157208fac64821a3b4d6239f6d6f87

Result:
total_elapsed_time:
sec: 5
nanosec: 590416

Goal finished with status: ABORTED

It does nothing and aborts. The nav2 output shows this when it receives the action:

[behavior_server-13] [INFO] [1778109796.137415310] [behavior_server]: Running spin
[behavior_server-13] [INFO] [1778109796.137525628] [behavior_server]: Turning 1.57 for spin behavior.
[behavior_server-13] [WARN] [1778109801.137882122] [behavior_server]: Exceeded time allowance before reaching the Spin goal - Exiting Spin
[behavior_server-13] [WARN] [1778109801.138104695] [behavior_server]: spin failed
[behavior_server-13] [WARN] [1778109801.138151815] [behavior_server]: [spin] [ActionServer] Aborting handle.

It seems to be unable to turn 90 degrees regardless of how long I have the Stretch3 to spin.

Hi @gregory_sin,

Thanks for flagging this, we were able to reproduce this issue. The problem appears to be that Nav2’s behavior_server , which handles actions like /spin , was publishing velocity commands to /cmd_vel , while Stretch expects those commands on /stretch/cmd_vel .

Because of that, the Spin action was accepted by Nav2, but the robot never received the actual rotation command. Nav2 then timed out and aborted the goal.

We have a small fix for this now: remapping /cmd_vel to /stretch/cmd_vel for the behavior_server.

After applying that change, you can test this with:

ros2 action send_goal /spin nav2_msgs/action/Spin "{target_yaw: 1.57, time_allowance: {sec: 20, nanosec: 0}}"

We are currently working on getting this merged. In the meantime, you can either apply the change from this PR, or try out the branch with:

cd ~/ament_ws/src/stretch_ros2
git fetch 
git checkout fix/nav2-behavior-server-cmd-vel-remap

Then rebuild the workspace:

cd ~/ament_ws
colcon build --packages-select stretch_ros2
source install/setup.bash

Best,
Jason

1 Like

Hi @gregory_sin,

Just following up here. Were you able to test this out after applying the /cmd_vel to /stretch/cmd_vel remap for the Nav2 behavior_server ?

Best,
Jason

Hello, @Jason_Koubi .

Yes, I was. It is working as expected now. Thank you for the quick fix and reply.

Great, thanks for confirming! Glad to hear it’s working now.

Best,
Jason