It is likely that for whatever reason some other code running on your system has decided to use that port number then you cannot use it.
Before you start your lidar run an incantation of netstat to show ports and the process/pid that is using the port.
Example: netstat -p
netstat can tell a great many things about open ports so look at it’s help menu for other ideas.
Find a port number near the one in the launch file and use that port number instead perhaps is one thought to think about if it would help.
The port is generally preceeded with a : so this will maybe help:
netstat -a | grep :2368
Also, first time after a reboot try it because maybe some instance is hung up on very first time so then 2368 in use shows for all future process starts.
I used port number 46898 and adjusted the launch files to use this port number. However, after trying this as well as port number 2366 I get the following warning error:
process[lidar_n301_driver_node-1]: started with pid [2276]
process[lidar_n301_decoder_node-2]: started with pid [2277]
[ INFO] [1612796424.195910067]: Opening UDP socket: address 192.168.1.222
[ INFO] [1612796424.196075321]: Opening UDP socket: port 46898
[ INFO] [1612796424.196146582]: expected frequency: 888.889 (Hz)
[ INFO] [1612796424.207801183]: Opening UDP socket: port 46898
[ INFO] [1612796424.207992154]: Initialised lidar n301 without error
[ WARN] [1612796424.232993950]: Using GPS timestamp or not 0
[ WARN] [1612796426.208538383]: lidar poll() timeout
[ WARN] [1612796428.209801356]: lidar poll() timeout
[ WARN] [1612796430.211876218]: lidar poll() timeout
[ WARN] [1612796432.214122258]: lidar poll() timeout
I am able to ping the IP address of the Lidar though. So I’m thinking the fault lies with my choice of port number.
The port number usage can have odd rules.
What I meant to say is use a number very near that number that is busy.
Don’t use some really way off number or you may hit some odd rule.
So you have the right idea but there may be some other hard coded port number in some config file or even some source file of the lidar driver. That may have to agree or your driver may not find the lidar.
I am sorry, I don’t have that setup so it’s just me guessing things.
Try to search for other persons who had to use a different port and see if they found some other thing that has to change in the lidar driver so it too uses this new port you have semi-arbitrarilly chosen.
Also there should be some option of netstat that can in some way tell you WHAT process and even the location of the executable that is using the port you wanted to use. I know I have used that before I just don’t remember the magical incantation. Look at the netstat help. BUT be aware that the way netstat works on differrent operating system varies in option names so be sure you are looking at the proper help for the operating system you are using which in our case is Ubuntu Linux 16.04 There is also a ‘netstat --help’ but that sort of help is a bit short on words so finding some help on a web search may offer more practical help.
So it may be that other port can be changed as something to try as well.
Try to be sure you are NOT starting the driver twice because THAT would explain everything too.
Can you please tell us if you are using the lidar with the power box or the one with only the split cable?
We have our lidar provider change the IPs of the lidar to 192.168.42.222 by default but there may recently been some logistical mixup. Can you also try the same with 192.168.1.222 in the launch file and with 192.168.42.125 in the /etc/network/interfaces then reboot the robot.
lidar. launch is started on boot, so this time please test by
It has been confirmed at least in one case that the problem that could be causing this this is a wrong factory-set IP of the lidar. Please anyone struggling with this, try changing the IP of the lidar to the required 192.168.42.x by following the IP change README and video found here: https://workdrive.zohoexternal.com/folder/n8tw78f134753b3c34bda9fe0d84053496871
For doing this you will need a windows computer and lidar plugged into it. Please report back if this works for you