0

I have designed a robot with ROS2 installed on a Ubuntu os, all running on a raspberry pi 4. Another esp32 is used to control the motors. The robot is water tight and sealed. Everytime I take it to a new place, i need to open it up all and reconfigure wifi credentials to connect to wifi. I have only one USB out connection from the robot and no Network port access.

How do I make the robot connect to a new network if existing network is not working? I am looking something in the line of captive portal if possible. Even if there is a way to create a setup in esp32 and read the credentials from there, that is also fine. Any different suggestions will also be useful. Kindly help.

3
  • Welcome to Robotics Praveen, but I'm afraid that Unbounded Design Questions are off-topic because there are many ways to solve any given design problem. We prefer practical, answerable questions based on actual problems that you face, so questions which ask for a list of approaches or a subjective recommendation on a method (for how to build something, how to accomplish something, what something is capable of, etc.) are off-topic. Please take a look at How to Ask & tour for more information on how stack exchange works. Commented Aug 15, 2023 at 15:09
  • I found related questions on Unix & LInux so moved the question here: Commented Aug 15, 2023 at 15:18
  • Thank you. Hope I get related information here. Commented Aug 18, 2023 at 11:48

2 Answers 2

0

Well, I have two thoughts...


If you can safely assume that there is some device that you should be able to reach (for example, your control PC), then this becomes a bit easier: you can implement a loop that tries to ping the control computer a few times, if it succeeds then great, if not then it's time to try a new network. You could do this with a script that:

  1. Using the -c flag on the ping command, which will allow you to set a 'count' (so it doesn't ping infinitely). Point ping at something you should be able to reach.
  2. Observing the exit value of the ping command: ping will exit with an error value if the device can't be reached.
  3. If you get an error value, try a new network. You can use something like nmtui for this, and you may already have it installed on Ubuntu.
  4. GOTO 1.

Then you wrap that functionality into a bash script, and write a systemctl service to launch that script when your system starts.


So that would work, but I personally don't love the idea of my robot being super dynamic when it comes to how I connect to it, and I don't love the fact that this is really a hardware problem that we're trying to work around with a software solution. The hardware problem here is that it's not possible to interface with the robot once it's sealed up for waterproofing.

To address this, you should consider adding a waterproof data port. You could do this by purchasing a waterproof cable assembly, and cutting a USB cable in half. You then solder that USB cable to either side of the waterproof connection, so you now have one side of a USB cable that can live inside your enclosure to plug into your on-board PC, and another side that can plug into a USB-to-ethernet adapter on your control PC. I would recommend using USB over ethernet only for ease-of-soldering purposes. This approach provides you with a port that you can always SSH over, even if the robot is not otherwise connected, which is always valuable.

2
  • I guess your second suggestion makes sense. Can you confirm if this setup directly works on Ubuntu on Raspberry Pi? Before making a purchase, I thought I will confirm if it works. There is already a waterproof connector connected to USB port of Raspberry Pi, which I am planning to use for LiDar. If I can use the same port to configure WiFi and then remove and use that for LiDar, that would seem a best solution. Any thoughts? Commented Aug 18, 2023 at 11:47
  • @Praveen I have used this approach with a handful of underwater robots in the past, and have done something similar for on-surface robots. The OS's I've done this with have been Ubuntu or Debian, ROS Kinetic, Melodic, and Noetic, and SOCs like the Pi and others. Commented Aug 18, 2023 at 13:52
0

My suggestion for this would be to have a known wifi access information that you can provide from your laptop as a temporary/fallback/special network that the system will automatically connect to any time that it detects it. Such that you can configure the wifi settings for the infrastructure network from the special network. Then turn off the special configuration network and the sensor connects to the configured infrastructure network.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.