Configure ROS_MASTER_URI & ROS_HOSTNAME - ros

I am not able to clearly understand the concept of ROS_MASTER_URI. Can someone kindly help me with the below?
I have two systems. One robot which runs on ESP32 and connects via WiFi. I want this to be the slave device. On the other hand, I have a laptop which I want to be the master. I have followed a lot of tutorials and finally able to get it working, but the issue is if I change the network, what will happen?
On the ESP32, I have below code:
IPAddress server(192, 168, 0, 110); // ip of ROS server -> the laptop
On the laptop, there is still no ROS_MASTER_URI setup in bashrc file. I have manually checked the IP of the laptop and added that in ESP32. Now, how is this done? Every time the IP address of ROS changes in master, the same IP should be given on the slave device? This means, I need to reprogram it every time I go to a new location?
Secondly, what are Host names and ROS_IP used for? Will they help if creating an alias which I can give to robot?
In simple words, I do not want to open and reprogram the robot slave device every time I take my laptop to a new location. I should be able to change the IP on the laptop and somehow (magically :) work on the robot. Any help is extremely appreciated as I am struggling to get a solution from a week.
-Praveen

This page has the details for the environment variables that you ask.
As far as I know, you need to update the ROS_MASTER_URI in both devices to the IP used by your machine, otherwise, none of the systems will be able to find the master.
The ROS2 might have a better solution for what you want, as it already has that network thought for distributed systems.

Related

How to print (to a printer) from Docker

I am using Docker Compose, which will run on a Linux tablet in production. I have a container serving up a web GUI. The user will click a "print" button in the GUI, which will result in some kind of request (probably HTTP to Flask in another container, which will maybe forward it to some other container), and that request will result in some data being sent to the printer.
My first step, I can only imagine, is to be able to send data to the printer from inside a Docker container. Any Docker container. I can then use that knowledge, of how to send something to the printer from Docker, to incorporate the printing into my system.
So, that's the infrastructure I'm working with. It can be simplified as simply "I want to print to a printer from a Docker container." I'm working on a Mac, and I can print from the Mac using lp. So I know the connection to the printer is working.
I've tried a few containers, including olbat/cupsd. lpstat -r pretty much always says the Scheduler is running, but lpstat -v always shows that no destinations are set up.
My DevOps guy and I have been banging our heads against the wall all day on this. There are various articles and repos about setting of CUPS in Docker, but they all have holes somewhere, where they say "Use the fooglesplatter to connect to the printer" without telling you what a fooglesplatter is. Or (for a more concrete example) they'll talk about how you set up the CUPS dashboard to add your printer on your local machine, and then say "Voila! You can print!" without telling you what to do in the container. Or they'll refer to a conf file that doesn't exist on my machine. Or something else that leaves us completely baffled.
Can someone who has accomplished this please post (or direct me to) a step-by-step guide that basically treats me like I've never touched a computer before? That assumes no knowledge whatsoever and spells out every step? We are wise Docker users, and my DevOps guy is a much smarter guy than I am, but we are both at a loss.
I know this is a crazy request. Maybe it's not an SO appropriate question. Close it if you must. But we are incredibly stuck and I really hope someone can help us.

Find out if a device is turned on in LAN using its MAC address without an IP

On a local network I'm sending a WOL (Wake-On-LAN) packet using sendto to the target MAC address. The code for that works without any problems and the target machine is turned on correctly. The problem is, that I don't know if the target machine has a LAN cable attached or not. If it's not attached, then the whole process fails. Unfortunately, sendto is unidirectional, so I don't know if my magic packet arrived.
I'm wondering about the best and fastest way to find out if WOL succeeded or not. Waiting for the device to boot up completely so I find out get and ping its IP address takes way too long.
Is there a way to "ping" a MAC address, i.e. get some sort of Layer-2-reply?
I need this solution for a Delphi application, but if you have a solution for a different language at hand you're welcome to post that as well. Thank you!

Is there a way to remote update files on a usb stick?

I have looked on the internet but unable to find a solution that would fit my requirements and was wondering if someone could either direct me to a solution or guide me towards making a customized solution.
So here is the scenario, we have a machine that runs a screensaver. Occasionally we are required to update the file on the machine, the trouble is that a person has to go there physically to update the usb. is there a way to allow remote access (via the internet) to a usb storage device to update files?
It depends on the operating-system and network-conditions, but you should be able to connect to the machine via SSH and remotely access the USB-drive.
https://askubuntu.com/questions/50104/how-do-i-access-an-external-drive-mounted-on-a-machine-on-my-own-network
I hope that's enough to throw at Google combined with your specific environment.

Transferring incoming communication to another computer

I have two computers, A and B.
On computer A, I want to be able to specify for certain ports that incoming traffic from computers will be automatically routed to a different port on computer B as if it was originally sent to B from .
I'm not really sure what I need here. I thought it might be port forwarding, bridge, ip routing or ip forwarding but was unable to come to a conclusion.
I'm trying to do this on a Windows 2008 machine, in order to shift traffic from an older software on one server to a newer software on a different server. I tested my trials using http://joncraton.org/blog/46/netcat-for-windows, trying to send stuff from my computer to another computer which was supposed to route it back to me, but nothing was received.
I have tried:
http://www.simpleportforwarding.com
but that didn't work for me.
I've also tried:
http://www.quantumg.net/portforward.php
but my Anti-virus blocks it (though it's not a malware, as far as I know).
I know Windows has the command "route" on the shell but I'm not really sure what to do with it as it requires a mask for the IP and doesn't seem to allow choosing ports (and it might not be what I need anyway).
I've also come across this:
http://www.windowsnetworking.com/articles_tutorials/NAT_Windows_2003_Setup_Configuration.html
and though I'm pretty sure NAT is not what I need, maybe that "Roles" configuration has something relevant.
Had anyone come across a similar situation and knows how to solve this? I'm pretty sure there's something ready which can do this and no software needs to be written.
EDIT:
I've discovered that netsh can do the above by:
C:\>netsh interface portproxy add v4tov4 listenport=12345 listenaddress=192.168.1.1 connectport=443 connectaddress=192.168.1.1
which is a command I found here:
http://www.rickwargo.com/2011/01/08/port-forwarding-port-mapping-on-windows-server-2008-r2/
But the problem is, and I forgot to mention this, I also need to be able to do this routing only for specific source IP addresses. I'm not sure if netsh can do this (maybe it can?) so is there any other way?

How To SSH From IPhone App

So I have been looking every where, and so far i haven't been able to find anything that allows me to ssh from an iPhone app, and have finally resorted to posting a new pos.
So I am trying to make an app to manage servers and part of the tasks that I need to be able to do it to be able to some how remotely connect over the internet to a server with either an ip address or a DNS name.
The connection to the server does not necessarily need to be a SSH connection, it could be a telnet although because of the security issues i would prefer SSH (if it is a lot less code I would accept telnet), but on the other hand it could be some other type of connection.
The application just needs to be able to run a script on the server end and if a SSH or telnet I would not need any help but if some other type of connection i may need a bit of help. Also the server on the other end is intended to be linux server (either ubuntu or gentoo, but not sure which yet but all i can say is will almost certainly be a linux server operating system).
I have already looked at the libssh/2 and would welcome any other similar demos as have not been able to work out how get the frameworks to work as well as licensing issues with using the frameworks in it.
PS. I am relatively new to programming and although i have some basic knowledge of coding some type of tutorial or sample code would be greatly appreciated.
Many Thanks For Any Help
Thomas
SSH is a hugely complicated beast. As long as you only need to execute one command without interactivity, it sounds like you could achieve the same thing by running a web server on the server and posting the commands via HTTP from the device. You can use SSL to achieve security. You'll need a mechanism that allows you to authenticate the device (you'd need something with ssh, too). And you'll have to have something in the web server on the server that figures out and runs the desired script. But all that is still hugely easier than dealing with libssh.

Resources