Search code examples
roslidarsametime

Two Lslidar(Leishen) connected with One Embedded Board(Jetson Xavier)`s possible?


Running one of the Lslidar(16 Channels) on the Embeded board(ROS development environments) is not a problem. This is because you can use the default IP and ports. But I plan to run two at the same time, and I want to use values other than the default values of ports and IP..

For example, you can use ports like 2368 and 2369. I need a reference to refer to how to change the port value and IP value... Help Plz...


Solution

  • Here is code from lsLidar driver from ROS Wiki:

    bool LslidarC16Driver::loadParameters() {
      //pnh.param("frame_id", frame_id, std::string("lslidar"));
      pnh.param("lidar_ip", lidar_ip_string, std::string("192.168.1.222"));
      pnh.param<int>("device_port", UDP_PORT_NUMBER,2368);
      pnh.param<bool>("add_multicast", add_multicast, false);
      pnh.param("group_ip", group_ip_string, std::string("234.2.3.2"));
      inet_aton(lidar_ip_string.c_str(), &lidar_ip);
      ROS_INFO_STREAM("Opening UDP socket: address " << lidar_ip_string);
      if(add_multicast) ROS_INFO_STREAM("Opening UDP socket: group_address " << group_ip_string);
      ROS_INFO_STREAM("Opening UDP socket: port " << UDP_PORT_NUMBER);
      return true;
    }
    

    As you can see there is a place where you can change port and IP. For two devices I'd advise you to modify the original driver. All source code is available on https://github.com/tongsky723/lslidar_C16 Clone it to you workspace and create additional functionality for two LiDARs.