Cancel the task (#612)

Posted by @drsi7213:

hello.
I found a problem with task cancel.
I’m using openRMF by installing source in ros2 humble.

When I ask cancel task, it doesn’t stop at once and I have to do it several times to stop or not stop at all.

For comparison, when I tested it on the demo docker, I confirmed that it stopped immediately when I canceled the task.

Please let me know which version I need to install for cancel task to work normally like docker demo.

Chosen answer

Answer chosen by @drsi7213 at 2024-06-28T06:45:53Z.
Answered by @aaronchongth:

the error sounds like not all your nodes are running on the same rmw implementation,

Launch your demos with cyclonedds too

source ~/rmf_demos_ws/install/setup.bash
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ros2 launch rmf_demos_gz office.launch.xml

and in the terminal you are using to run and cancel your task as well

export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

ros2 run rmf_demos_tasks dispatch_go_to_place -F tinyRobot -R tinyRobot1 -p hardware_2 --use_sim_time

ros2 run rmf_demos_tasks cancel_task -id

Posted by @aaronchongth:

Hey there @drsi7213 can you provide more information on how you are cancelling the task, and what task is it?

Perhaps more useful pieces of information, just in case it is a communications concern, what is the DDS implementation that you are using? You can attempt to run everything using cyclonedds too, see Working with multiple ROS 2 middleware implementations — ROS 2 Documentation: Humble documentation

Posted by @drsi7213:

thank you for the answer.

I using rmf_demos(version humble -release , 2.0.4).

and launch the demos.

  • source ~/rmf_demos_ws/install/setup.bash
  • ros2 launch rmf_demos_gz office.launch.xml

and using rmf_demos_task,

  • ros2 run rmf_demos_tasks dispatch_go_to_place -F tinyRobot -R tinyRobot1 -p hardware_2 --use_sim_time
  • ros2 run rmf_demos_tasks cancel_task -id

I using rmw_fastrtps_cpp.

I tried to use cyclone dds, I got error like below.

tev: ddsi_udp_conn_write to udp/239.255.0.1:7401 failed with retcode -1

Posted by @aaronchongth:

the error sounds like not all your nodes are running on the same rmw implementation,

Launch your demos with cyclonedds too

source ~/rmf_demos_ws/install/setup.bash
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
ros2 launch rmf_demos_gz office.launch.xml

and in the terminal you are using to run and cancel your task as well

export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

ros2 run rmf_demos_tasks dispatch_go_to_place -F tinyRobot -R tinyRobot1 -p hardware_2 --use_sim_time

ros2 run rmf_demos_tasks cancel_task -id

This is the chosen answer.

Posted by @drsi7213:

thanks a lot !!

I confirmed cancel task is immediately adapted.

Posted by @aaronchongth:

oh and as a side note, you will need to use the same RMW implementation wherever you are running ROS 2 on your system, and that includes rmf-web as well

so run the export line too before you start the api-server,

export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# source your RMF workspace
cd rmf-web/packages/api-server
pnpm start