Menu

How to change IP address of UST-10/20LX

2014-07-10
2023-04-06
  • Yohei Kakiuchi

    Yohei Kakiuchi - 2014-07-10

    How to change IP address of UST-10/20LX ?
    Can I use ip address changer for UTM-30LX-EW ?

     
  • Mehrez Kristou

    Mehrez Kristou - 2014-07-10

    You can use UrgBenri for that. It is also possible to use ip address changer. However once you change the default IP address, it is not possible to use ip address changer to change it back to default. For that you can use UrgBenri or hard IP reset.

     

    Last edit: Mehrez Kristou 2014-07-10
  • Anonymous

    Anonymous - 2015-05-04

    Could you please explain how to use URGberni to change the IP addres??

     
  • miyamoto musashi

    Hello there,

    There are a few points regarding changing the UST-10LX/20LX IP address. If you are familiar with IP addresses goto to number 2.

    1). Your computer network configuration matches that of the sensor
    Sorry to start with the obvious first but as you may already know, in order to connect to the sensor there must be a route between the computer and the sensor. Either the computer is in the same local network as the sensor (there are no routers) or the computer is behind some router which is correctly configured. I will explain here only the local network situation.

    Your computer has to be configured to be in the same network address of your sensor and cannot have the same IP address of the sensor. The sensor's default (factory) IP settings are:
    IP address: 192.168.0.10
    Network mask: 255.255.255.0
    Gateway: 192.168.0.1

    Remember that the network address is the AND operation between the IP address and the network mask

     192.168.0.10 AND 255.255.255.0 = 192.168.0.0
    

    If your computer is configured to be in the same network address, with the same network mask and host part is not 0, not 255 and not equal to the sensor IP address, you will be able to connect without any problems.

    If the sensor is currently configured with 192.168.0.10/255.255.255.0 and you want to configured with 10.0.0.22/255.0.0.0, your computer has to be prepared beforehand so to be in the network address 192.168.0.0 (for example 192.168.0.15). After you change the IP address and to test the new setting you must have a computer (maybe the same one) prepared in the new network address 10.0.0.0 (for example 10.0.0.123). Several OS (Windows Linux, MACOS) allow you to configure several IP addresses for the same network device. You can test your settings all in the same computer.



    2). You know the current IP address of the sensor
    Provided that you can connect to the sensor, you can use URGBenri Standard (not the lite version), go to the Ethernet tab and to the bottom you'll find the "Change IP Address" button. See the attached picture.

    You just need to type the new IP address, network mask and gateway address, and press the change button. URGBenri will ask you if you want to reconnect to the sensor with the new IP address, if your computer is already configured to match the new network address of the sensor then reconnection will work correctly.



    3). You don't know/forgot the current IP address of the sensor
    The sensor has an external input signal to reset the sensor's IP address to the factory default (192.168.0.10, mask 255.255.255.0, gateway 192.168.0.1). Please consult the hardware manual of the sensor for details.
    If you cannot use the external input signal there are two options to recover the current IP address.
    a. Use the same URGBenri Standard to find the IP address, use the "IP Address lookup" tool to discover the IP address. Please be aware this process can take a potential long time.
    b. Use Wireshark: with the sensor powered on and its Ethernet cable disconnected from the computer, use the Wireshark "arp.isgratuitous" filter, then plug the Ethernet cable into the computer. The sensor sends an Gratuitous ARP broadcast message with its current IP address and Wireshark with record it. If this fails, try unplugging and plugging again the Ethernet cable.



    4). You can connect to the sensor OK but fail to configure the IP address.
    There is an issue with the firmware of UST-10LX/20LX up to version 2.19 with does not allow configuring subnetting/supernetting. Just in case explaining is necessary, for example for Class C network address 192.168.0.0/255.255.255.0, subnetting means a mask modified so to have less bits for the host part (for example 255.255.255.192 to have 6 bits for host); supernetting on the other hand means a mask modified to have more bits for the host part (for example 255.255.240.0 to have 12 bits for host).
    To solve this issue, please update the UST-10LX/20LX firmware, the latest version is 2.21 and you can find it here:
    http://www.hokuyo-aut.jp/02sensor/07scanner/download/products/ust-10lx_20lx/
    You will need to download the "Update Tool" first and then the corresponding firmware file for your sensor. Please read the README-en.txt file of the update tool for details how to change the sensor firmware.

    Hope this long explanation sheds some light.

     

    Last edit: miyamoto musashi 2015-05-05
  • Anonymous

    Anonymous - 2017-11-28

    Is there any way to do this from code? I would not like to run an extra tool. Sending an "$IP" message as shown in: https://github.com/ros-drivers/urg_node/blob/indigo-devel/scripts/set_urg_ip.py
    does not work for me. Laser echoes the message and communication works fine, but IP address is not modified.

     
  • j-fujimoto

    j-fujimoto - 2017-11-29

    You have to reboot sensor to apply new IP Address.
    So, you have to send reboot command ("RB\nRB\n") after sending "$IP" command.
    (or power off and power on.)

    this is modified python code.
    (on python2)

    msg = "$IP" + ip + nm + gw + "\x0a"
    #rebootMsg = "$RB\x0a$RB\x0a"
    rebootMsg = "RB\x0aRB\x0a"
    
    sock = socket.socket()
    sock.connect((args.ip, 10940))
    
    print("Updating settings")
    sock.send(msg)
    sock.send(rebootMsg)
    

    (on python3)

    msg = "$IP" + ip + nm + gw + "\x0a"
    #rebootMsg = "$RB\x0a$RB\x0a"
    rebootMsg = "RB\x0aRB\x0a"
    
    sock = socket.socket()
    sock.connect((args.ip, 10940))
    
    print("Updating settings")
    sock.send(msg.encode('utf-8'))
    sock.send(rebootMsg.encode('utf-8'))
    
     

    Last edit: j-fujimoto 2023-04-06
  • Anonymous

    Anonymous - 2023-04-06

    Hi I used your advice , but still not working ..
    The python version I used is Python 3.7 .
    I found the python3 code you provided, the rebootMsg must be "RB\x0aRB\x0a" ,it didn't need to add "$" in the command . If I use "$RB\x0a$RB\x0a" ,it couldn't reboot it.

    Is the same way to do in IP msg ?

    Here's my code , Could you try it or review it to help me deal with this problem ?

    #!/usr/bin/env python
    
    
    """
    Change the IP address of a Hokuyo URG Laser
    """
    
    import argparse
    import socket
    import ipaddress
    from codecs import encode, decode
    
    def parse_and_validate_ipv4(argument, name):
        """
        Each address must have 4 
        """
        if len(argument.split(".")) != 4:
            print("Invalid %s, must be of the form xxx.yyy.zzz.www" % name)
            exit(-1)
        parsed = ""
        for x in argument.split("."):
            if len(x) > 3:
                print("Invalid %s, must be of the form xxx.yyy.zzz.www" % name)
                exit(-1)
            while len(x) < 3:
                x = "0" + x
            parsed += x
    
    
        return parsed
    
    
    if __name__ == "__main__":
        parser = argparse.ArgumentParser(description=__doc__)
        parser.add_argument('--new_ip', help='The desired IP address for the laser', default="169.254.254.112")
        parser.add_argument('--new_gw', help='The desired gateway for the laser', default="169.254.254.21")
        parser.add_argument('--nm', help='The desired netmask for the laser', default="255.255.255.252")
        parser.add_argument('--ip', help='The current IP address of the laser', default="169.254.254.22")
        args = parser.parse_args()
    
        # Packet starts with $IP, ends with \x0a, contains:
        #   12 character IP
        #   12 character netmask
        #   12 character gateway
        ip = parse_and_validate_ipv4(args.new_ip, "IP address")
        gw = parse_and_validate_ipv4(args.new_gw, "gateway address")
        nm = parse_and_validate_ipv4(args.nm, "netmask")
        msg = "$IP" + ip + nm + gw + "\x0a"
        rebootMsg = "RB\x0aRB\x0a"
    
        print("Connecting to %s" % args.ip)
        sock = socket.socket()
        sock.connect((args.ip, 10940))
    
        print("Updating settings")
        sock.send(msg.encode('utf-8'))
        try:
            sock.settimeout(5)
            returned = sock.recv(40)
        except socket.timeout:
            print("Laser did not return any packet, is probably not updated.")
            exit(-1)
    
        if msg != returned.decode("utf-8"):
            print("not matched")
            exit(-1)
    
        sock.send(rebootMsg.encode('utf-8'))
        print("Done updating, cycle power on laser")
    

    Thanks for your reading!!

     
    • j-fujimoto

      j-fujimoto - 2023-04-06

      Hi.
      I noticed my mistake by your pointing out. Thank you.
      I modified my past reply message.
      The rebootMsg must be "RB\x0aRB\x0a".
      So your code is correct.

       
  • Anonymous

    Anonymous - 2023-04-06

    Hi,
    Sorry to bother you , the problem was the network setting I set was wrong .
    When I fixed it , the problem was solved !! Thanks

    By the way , I have two questions to ask. Could you help if you have time ?

    (1) Is there any method to read the lidar IP with code ? Just like "IPDiscovery".
    Choose the specific interface,then I would know the lidar ip info which connected the interface card .

    (2) As the code above, I already knew the reboot command is "RB\x0aRB\x0a" .
    If I want to reset the lidar IP setting , Is there any way to do this from code?

    Thanks for your help !!
    Have a nice day.

     
    • j-fujimoto

      j-fujimoto - 2023-04-06

      Hi,

      This is my answer to your two question.

      (1) IPDiscovery protocol is not opened now.
      So, you can't read the lidar IP address.
      And there is no way to read it without IPDiscovery.

      (2) IPDiscovery can reset the lidar IP setting.
      But IPDiscovery protocol is not opened now.
      So, you can't reset the lidar IP setting from code.

       

Anonymous
Anonymous

Add attachments
Cancel