Certain topics take a long time before publishing

Hi all,

I noticed that when starting the Magni, certain topics such as /battery_state take a rather long time ( say 3 to 5 minutes? ) before being published. Is this expected? As a result, certain actions like joystick teleop do not work, until the topics start publishing.

If there are any pointers on what logs to give, or what direction I can look in, I would much appreciate it and report what I find.

I am currently using the RPI4 image as mentioned in ROS image on Raspberry Pi 4?.

Apologies if this was asked before, I did a brief search but did not find anything, though I might have put the wrong keywords.

I believe what you will find is that it is the motor node can take a very long time to come up. Take a look using rosnode list to see if once the motor node shows up the topics are present. I have not looked into why the motor node can take so long to come up but have noticed it frequently can take 30 seconds to a minute.

This is worth looking into so thank you for the reminder.

As far as holding off your own node, I would suggest you do so in your node with a dependency on the motor node. ROS has some runtime dependencies for nodes although I am not familiar enough with the specifics offhand. There is a <run_depend> at the package level that my be of value.

A holdoff in your node would be of value even if we resolve long startup delays as it will always take a while (in terms of program run time) to initialize the motor node.

Hello there,

Apologies for the late response. You are absolutely right, the motor node is taking a long time. In my case, it is taking quite much longer than 1 minute: perhaps in the range of 5 minutes. I will look into this rather long delay, and post if I find anything. And thank you for the reminder about holding off the node for for your pointer.

Is your robot connected to a wifi network? Does it have an RTC battery installed?

One possible issue could be that it is taking a long time to obtain a time sync over NTP, delaying the launch.

The best solution for this is installing an RTC battery so the robot can keep consistent time even when it is turned off. See the bottom of this page for details. https://learn.ubiquityrobotics.com/unboxing

Yes in fact you are indeed correct, testing the robot as of right now. I am connected to wifi, set to automatically connect on boot.

I disabled the base:
sudo systemctl disable magni-base
Then launched the nodes manually:
roslaunch magni_bringup base.launch
And i get an error:
“we are connected to network, wait for time”
Which loops for a few minutes (20 tries) before resuming launch.

I will check the battery. I recall putting one in, but we have a few Magnis so one of them might have been left out. Thank you!

A greatly improved ‘unboxing’ page on our learn site has at the end of the page a very nice picture. We have in the past seen users bend the dual pins that must be under the battery. Check for that issue if you do see a battery.

That is a good point. I have removed the battery, checked it and replaced it, making sure the pins stay underneath. The battery does not seem to be defective.

I am now suspecting that perhaps connectivity to the internet is the issue: I am in fact connected to a WiFi network but I do not have internet access due to certain restrictions on my end. To be specific, this particular network has internet access only if I modify the routing table, which the Magni does not do at startup. :thinking: I will try to set default routes at startup and see if this helps.

Another option might be to modify launch_core.py where it calls chronyc waitsync 20, but im hoping to tackle the root cause.

Hello there,

The issue indeed seemed to be a lack of internet access while connected to a wifi network. This causes chronyc waitsync 20, which is run on boot, to loop 20 times waiting for chronyc to sync.

For me, I am able to get internet access by setting etc/network/interfaces in order for internet connectivity to be established on boot. This reduced to wait time to less than 20 seconds. For setups with no internet access whatsoever, perhaps the solution is to set up a local chrony time server.

A wait of 20 seconds is very common even with everything configured. Sometimes I can see a 12-15 second startup but never faster is my experience. This sort of startup time is very realistic because this is a ‘real’ linux platform and not just some embedded ‘bare metal’ firmware system.

Yes of course, it’s been pretty great so far, especially with the Pi4. Cheers for your assistance! :grin:

A local chrony time server is highly recommended, especially if you have multiple machines with ROS or other time-sensitive messages going between them.

Do you think it would be useful to have an option in /etc/ubiquity/robot.yaml to disable waiting for a time sync? Open an issue on https://github.com/UbiquityRobotics/magni_robot if you think so.


Yes, that is a good idea, I have posted here. :boom: