Setup Hokuyo LiDar in ROS and remote access

Hi, I am setting up Hokuyo UST 10LX LiDar under ROS on my Jetson TX2. The Hokuyo ip address is factory default: 192.168.0.10 and was linked to the Ethernet port of the TX2 to feed the data. I followed the instructions in this https://www.jetsonhacks.com/2018/02/21/racecar-j-hokuyo-ust-10lx-configuration/ and set my TX2 eth0 to 192.168.0.15 in /etc/network/interfaces. The LiDar works fine.

My jetson connects to internet through WIFI and its ip address for wlan0 is 192.168.0.28. However, I found that I could not ping from Tx2 to other computers, which are on the same WIFI network. The output is like this:

nvidia@tegra-ubuntu:~$ ping 192.168.0.29
PING 192.168.0.29 (192.168.0.29) 56(84) bytes of data.
From 192.168.0.15 icmp_seq=1 Destination Host Unreachable
From 192.168.0.15 icmp_seq=2 Destination Host Unreachable
From 192.168.0.15 icmp_seq=3 Destination Host Unreachable
From 192.168.0.15 icmp_seq=4 Destination Host Unreachable
From 192.168.0.15 icmp_seq=5 Destination Host Unreachable
From 192.168.0.15 icmp_seq=6 Destination Host Unreachable

Connecting to other computer is important to me since my TX2 is attached to a robot and I need to use other computer to run my TX2 through ssh.

Seems that once the eth0 is used for non-internet purpose, I could not use WIFI to connect to other computers.

How can I fix this problem?

Thank you very much.

I’m not a “WiFi guy”, and don’t use it. However, you’re probably running into NetworkManager getting its fingers in the system and assuming that if you found WiFi you don’t want wired. Someone else here will be better able to help, but take a look at this first:
https://help.ubuntu.com/stable/ubuntu-help/net-wireless-connect.html.en

Then post the output of:

ifconfig
iwconfig
route

These will be able to see if both interfaces are up, and if so, what the default route will choose.

Be aware that on Ubuntu logging in to the GUI might trigger some user preferences which alters network setup via NetworkManager. So logging in on command line without the GUI could change results.

Here is the output

nvidia@tegra-ubuntu:~$ route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.1 0.0.0.0 UG 600 0 0 wlan0
default 192.168.0.1 0.0.0.0 UG 800 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
192.168.0.0 * 255.255.255.0 U 600 0 0 wlan0
192.168.55.0 * 255.255.255.0 U 0 0 0 l4tbr0

nvidia@tegra-ubuntu:~$ iwconfig
usb0 no wireless extensions.

lo no wireless extensions.

dummy0 no wireless extensions.

wlan0 no wireless extensions.

l4tbr0 no wireless extensions.

usb1 no wireless extensions.

tunl0 no wireless extensions.

eth0 no wireless extensions.

nvidia@tegra-ubuntu:~$ ifconfig
eth0 Link encap:Ethernet HWaddr
inet addr:192.168.0.15 Bcast:192.168.0.255 Mask:255.255.255.0

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0

wlan0 Link encap:Ethernet HWaddr
inet addr:192.168.0.28 Bcast:192.168.0.255 Mask:255.255.255.0

It is odd to see two default routes to the same address (one is a higher metric than the other, but there should be only one default to that address over a single interface…metrics are designed to choose among routes of different cost when there is more than one device…and not to have each route point to the same device).

Your WiFi is completely missing. When wired doesn’t provide something, then networking is basically being told there is no reason to try any other interface, and that there is no WiFi. Someone knowing more about WiFi will have to help you configure that, but I suspect one of those default routes was intended to have a different address which is bound to the non-existent WiFi. Once WiFi is up and has a valid route it might work.

When you said “WiFi is completely missing”, were you referring to the output of “wifconfig”? Please note I had not problem to use web browser on my TX2 through WiFi.

It seems that both: wired eth0 and wireless wlan0 belong to the same 192.168.0.0/24 network.
Normally you will use either eth0 or the wlan0. If you want a custom use of both of them simultaneously, you will need to implement a custom config for the purpose, in my opinion.
For example I used to get WAN from ISP to wireless and distribute it to a device connected to ethernet wired port. That can be implemented vice versa as well.
You can either route internet and network to eth0, as it seems to me, or route the internet and router requests to pass through the wlan0.
The first can be achieved via enabling ipforwarding, I believe.

echo 1 > /proc/sys/net/ipv4/ip_forward

However, that wont survive the reboot. But you can test with it. If you decide to enable forwarding permanently you will have to add to /etc/sysctl.conf

net.ipv4.ip_forward = 1

Otherwise you may implement basic routing.

I personally don’t use WiFi and never set it up. I can’t help with that, but the iwconfig does say there is no WiFi, I mean “iwconfig” sees no working interfaces…as currently configured there is probably something disabled via rfkill (I don’t know). This command should give more information, but I can’t personally help much on WiFi:

sudo rfkill list

Something like this would unblock the WiFi:

sudo rfkill unblock <whatever number from list>

…unfortunately I don’t know where to go from there for WiFi (though you probably want to post your “rfkill list” output).

Here is the output of “sudo rfkill list”:

0: bluedroid_pm: Bluetooth
Soft blocked: no
Hard blocked: no
1: phy0: Wireless LAN
Soft blocked: no
Hard blocked: no
2: brcmfmac-wifi: Wireless LAN
Soft blocked: no
Hard blocked: no
3: hci0: Bluetooth
Soft blocked: no
Hard blocked: no

Hi @Andrey1984, my eth0 is connect to a LiDAR to get data from the device. At the same time, TX2 is connected via WiFi. I would like to do Ping, ssh from other computers to this TX2.

I am not sure I understand what you said about routing and forwarding. Could you please deliberate? I know very little about networking…

Hi everyone, one thing I forgot the mention is that I can change the IP address of LiDAR and eth0. If I change them to, for example, LiDAR=192.168.100.10 eth0=192.168.100.15, WiFi stays the same 192.168.0.28. Is that going to solve my problem?

Did you try enabling ipfw?

I can’t answer, I don’t know enough about WiFi. For general information based on what I’ve seen, you are looking for having two separate subnets and the default route going through WiFi. I’ll try to explain…

When you get an address like 192.168.100.0, and combine it with a subnet mask of 255.255.255.0, then any address from 192.168.100.0 through 192.168.100.255 are considered the same subnet. Typically two separate network cards will live on separate subnets. So 192.168.101.15 would be a different subnet from 192.168.100.15 when netmask is 255.255.255.0. The “on” bits of a netmask belong to the interface device. The “off” bits of netmask belong to different destination addresses this specific network interface card should be used for talking to. Addresses outside of the network/netmask combination must be re-routed.

If you try to contact an address on the same subnet, then you do not need a default route because that network interface should handle everything within that subnet. There will usually be one address within that subnet which is a gateway, and another which is broadcast, but unless those addresses are requested by forwarding from a different subnet they are no different than anything else which is in the same subnet…those are just addresses despite them having a special purpose.

As soon as you have a request for an address not within your subnet a gateway is required. The default route should point at the gateway for cases where an address request is outside of the local subnet. There can be more than one default route if there is more than one gateway, but those will not be to the same address…multiple defaults will go to different gateways. You don’t have two internet connections, thus it is incorrect to have two default routes, and it is especially incorrect that both defaults use the same gateway.

I don’t know enough about the different WiFi modes (e.g., I know there is an “ad hoc” mode, but I don’t know much about that), but if the WiFi is acting as a general ethernet device (having its own subnet) and not bound to one specific device, then it probably needs its own subnet (separate from wired). The default route would be an address to a gateway on the WiFi’s subnet. The default route of the wired would be the WiFi’s gateway since wired doesn’t have any way to talk to the outside world. Any address within the wired would go to its distinct subnet…any address not on wired would go to WiFi’s gateway…any address not on WiFi’s subnet would route through the gateway (default route) as well.

Sorry, I don’t know how to set that up for WiFi. I just don’t know enough about WiFi to not be confusing in my explanation. But a summary is:

  • WiFi needs to be on a different subnet than ethernet.
  • Ethernet subnet would need to be where the LiDar is configured.
  • A gateway needs to be available somewhere on WiFi.
  • There should be a single default route since ethernet is not on the internet and WiFi is.
  • That default route would name the gateway's address as known within the WiFi's subnet.
  • Having two default routes and having two interfaces on the same subnet is an error.
    • The different metrics ("cost") prevents this from being an issue, but it still won't work right.
    • The two interfaces may be fighting for which controls.

Hopefully someone can suggest how to set up WiFi when ethernet is to remain active for its own private subnet. If a DHCP server or router (wired or WiFi) does things correctly, then it will tell your system what the default route is over WiFi. You’d have to somehow tell wired to use WiFi’s default route and to not try to add its own.