ROS2 Navigation Rosject - Path Planning - LifecyclePublisher - publisher is not activated

Hi,

I am working on the ROS2 Navigation Rosject, Section 3 Path Planning.

After launching my pathplanner.launch.py launch file, I get the following repeated warnings:

[controller_server-5] [WARN] [1674112988.556317739] [LifecyclePublisher]: Trying to publish message on the topic '/local_costmap/clearing_endpoints', but the publisher is not activated
[controller_server-5] [WARN] [1674112988.756970089] [LifecyclePublisher]: Trying to publish message on the topic '/local_costmap/clearing_endpoints', but the publisher is not activated
[controller_server-5] [WARN] [1674112988.957115772] [LifecyclePublisher]: Trying to publish message on the topic '/local_costmap/clearing_endpoints', but the publisher is not activated
[controller_server-5] [WARN] [1674112989.156317801] [LifecyclePublisher]: Trying to publish message on the topic '/local_costmap/clearing_endpoints', but the publisher is not activated
[controller_server-5] [WARN] [1674112989.356843994] [LifecyclePublisher]: Trying to publish message on the topic '/local_costmap/clearing_endpoints', but the publisher is not activated
[controller_server-5] [WARN] [1674112989.558379535] [LifecyclePublisher]: Trying to publish message on the topic '/local_costmap/clearing_endpoints', but the publisher is not activated
[controller_server-5] [WARN] [1674112989.759332438] [LifecyclePublisher]: Trying to publish message on the topic '/local_costmap/clearing_endpoints', but the publisher is not activated
[controller_server-5] [WARN] [1674112989.956379915] [LifecyclePublisher]: Trying to publish message on the topic '/local_costmap/clearing_endpoints', but the publisher is not activated
[controller_server-5] [WARN] [1674112990.156456703] [LifecyclePublisher]: Trying to publish message on the topic '/local_costmap/clearing_endpoints', but the publisher is not activated
[controller_server-5] [WARN] [1674112990.356406889] [LifecyclePublisher]: Trying to publish message on the topic '/local_costmap/clearing_endpoints', but the publisher is not activated
[controller_server-5] [WARN] [1674112990.556508686] [LifecyclePublisher]: Trying to publish message on the topic '/local_costmap/clearing_endpoints', but the publisher is not activated
[controller_server-5] [WARN] [1674112990.756434723] [LifecyclePublisher]: Trying to publish message on the topic '/local_costmap/clearing_endpoints', but the publisher is not activated

Launch file content highlights:
map_server, amcl, lifecycle_manager_localization for map_server and amcl
planner, controller, recoveries, bt_navigator and lifecycle_manager_pathplanning for the previous 4 nodes.

I have no idea what to do to get rid of this. All I can understand is that /local_costmap/clearing_endpoints should publish something but it is not publishing it, because some process that needs to “activate” the publisher did not happen.

I have not worked on the real robot yet - I am still working on the simulation and getting this error / warning.

Please help / advice.

Thanks,
Girish

Hi @girishkumar.kannan,

it think that this is probably because when you use Lifecycle Nodes, a publisher must be activated in order to enable publishing.

To do so you must call the publishers on_activate() method inside the implementation of the LifecycleNode on_activate() method.

Like this:

rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn
on_activate(const rclcpp_lifecycle::State &)
{

pub_->on_activate();

return rclcpp_lifecycle::node_interfaces::LifecycleNodeInterface::CallbackReturn::SUCCESS;

}

Is this implemented in your code?

Cheers,

Roberto

Hi @rzegers ,

Thanks for your quick reply.

I searched Google and found a similar answer. But the problem is, I have no idea where to make this modification. I do not have any cpp files in any of my ros2 package.
I think this must be done in the library files, which again, I have no idea which file to open and modify.

Thanks,
Girish

Hi @girishkumar.kannan,

yes, my answer applies in the general case when you create your own managed node so that you know that the publisher gets activated when the node transitions to the activated state. I am pretty sure in Nav2 that is already implemented. So now you can find out what the current state of that node is. From the logger I see that the node name must be controller_server (but you can confirm that with ros2 node list) so the command would be:

ros2 lifecycle get controller_server

And also find out what the possible states for that node are:

ros2 lifecycle list controller_server -a

The next step would be to try to execute a state change and get to the activated state, which should activate the publisher and get rid of that message.

Cheers,

Roberto

Hi @rzegers ,

Tried the above two commands, here are my outputs:

user:~$ ros2 lifecycle get
--include-hidden-nodes
--no-daemon
--spin-time
/amcl
/amcl_rclcpp_node
/bt_navigator
/bt_navigator_rclcpp_node
/controller_server
/controller_server_rclcpp_node
/lifecycle_manager_localization
/lifecycle_manager_localization_service_client
/local_costmap/local_costmap
/local_costmap/local_costmap_rclcpp_node
/local_costmap_client
/ros_bridge
/rviz
/transform_listener_impl_559ee276d5e0
/transform_listener_impl_55ef4c4abe50
/transform_listener_impl_564735a0bd30
user:~$ ros2 lifecycle get /controller_server
active [3]
user:~$ ros2 lifecycle get /controller_server_rclcpp_node
Node not found
user:~$ ros2 lifecycle list /controller_server -a
- configure [1]
        Start: unconfigured
        Goal: configuring
- transition_success [10]
        Start: configuring
        Goal: inactive
- transition_failure [11]
        Start: configuring
        Goal: unconfigured
- transition_error [12]
        Start: configuring
        Goal: errorprocessing
- cleanup [2]
        Start: inactive
        Goal: cleaningup
- transition_success [20]
        Start: cleaningup
        Goal: unconfigured
- transition_failure [21]
        Start: cleaningup
        Goal: inactive
- transition_error [22]
        Start: cleaningup
        Goal: errorprocessing
- activate [3]
        Start: inactive
        Goal: activating
- transition_success [30]
        Start: activating
        Goal: active
- transition_failure [31]
        Start: activating
        Goal: inactive
- transition_error [32]
        Start: activating
        Goal: errorprocessing
- deactivate [4]
        Start: active
        Goal: deactivating
- transition_success [40]
        Start: deactivating
        Goal: inactive
- transition_failure [41]
        Start: deactivating
        Goal: active
- transition_error [42]
        Start: deactivating
        Goal: errorprocessing
- shutdown [5]
        Start: unconfigured
        Goal: shuttingdown
- shutdown [6]
        Start: inactive
        Goal: shuttingdown
- shutdown [7]
        Start: active
        Goal: shuttingdown
- transition_success [50]
        Start: shuttingdown
        Goal: finalized
- transition_failure [51]
        Start: shuttingdown
        Goal: finalized
- transition_error [52]
        Start: shuttingdown
        Goal: errorprocessing
- transition_success [60]
        Start: errorprocessing
        Goal: unconfigured
- transition_failure [61]
        Start: errorprocessing
        Goal: finalized
- transition_error [62]
        Start: errorprocessing
        Goal: finalized
user:~$ ros2 lifecycle list /controller_server_rclcpp_node -a
Node not found
user:~$

– Girish

Hi @rzegers ,

Quick Update: I followed this post and got my path planning to work. When I had this warning, my robot never moved. Now it reaches the goal pose.

But I still keep getting this warning continuously printed.
I do not mind this warning, now that my robot moves to the goal pose. But it keeps spamming my terminal, which annoys me a little.

Is there a way to stop the warning?

– Girish

So this happens because the course shows config files for Nav2 for Galactic, but the rosject runs on Nav2 for Foxy? I see, thanks for reporting!

From your output of ros2 lifecycle get /controller_server I see that the state is already active, in that case it is very strange that you have that warnings printed out… at the moment I am out of ideas, this probably requires deeper research …