Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i access Livox Horizon? #123

Open
Oh-JongJin opened this issue Apr 25, 2024 · 1 comment
Open

How can i access Livox Horizon? #123

Oh-JongJin opened this issue Apr 25, 2024 · 1 comment

Comments

@Oh-JongJin
Copy link

Livox Horizon ip: 172.16.1.30
Host PC ip: 172.16.1.245

HORIZON_config.json

{
  "lidar_summary_info" : {
    "lidar_type": 1
  },
  "HORIZON": {
    "lidar_net_info" : {
      "cmd_data_port": 56100,
      "push_msg_port": 56200,
      "point_data_port": 56300,
      "imu_data_port": 56400,
      "log_data_port": 56500
    },
    "host_net_info" : {
      "cmd_data_ip" : "172.16.1.245",
      "cmd_data_port": 56101,
      "push_msg_ip": "172.16.1.245",
      "push_msg_port": 56201,
      "point_data_ip": "172.16.1.245",
      "point_data_port": 56301,
      "imu_data_ip" : "172.16.1.245",
      "imu_data_port": 56401,
      "log_data_ip" : "172.16.1.245",
      "log_data_port": 56501
    }
  },
  "lidar_configs" : [
    {
      "ip" : "172.16.1.30",
      "pcl_data_type" : 1,
      "pattern_mode" : 0,
      "extrinsic_parameter" : {
        "roll": 0.0,
        "pitch": 0.0,
        "yaw": 0.0,
        "x": 0,
        "y": 0,
        "z": 0
      }
    }
  ]
}

msg_HORIZON_launch.py

import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
import launch

################### user configure parameters for ros2 start ###################
xfer_format   = 1    # 0-Pointcloud2(PointXYZRTL), 1-customized pointcloud format
multi_topic   = 0    # 0-All LiDARs share the same topic, 1-One LiDAR one topic
data_src      = 0    # 0-lidar, others-Invalid data src
publish_freq  = 10.0 # freqency of publish, 5.0, 10.0, 20.0, 50.0, etc.
output_type   = 0
frame_id      = 'livox_frame'
lvx_file_path = '/home/livox/livox_test.lvx'
cmdline_bd_code = '<bd_code>'

cur_path = os.path.split(os.path.realpath(__file__))[0] + '/'
cur_config_path = cur_path + '../config'
user_config_path = os.path.join(cur_config_path, 'HORIZON_config.json')
################### user configure parameters for ros2 end #####################

livox_ros2_params = [
    {"xfer_format": xfer_format},
    {"multi_topic": multi_topic},
    {"data_src": data_src},
    {"publish_freq": publish_freq},
    {"output_data_type": output_type},
    {"frame_id": frame_id},
    {"lvx_file_path": lvx_file_path},
    {"user_config_path": user_config_path},
    {"cmdline_input_bd_code": cmdline_bd_code}
]


def generate_launch_description():
    livox_driver = Node(
        package='livox_ros_driver2',
        executable='livox_ros_driver2_node',
        name='livox_lidar_publisher',
        output='screen',
        parameters=livox_ros2_params
        )

    return LaunchDescription([
        livox_driver,
    ])

result:

$ ros2 launch livox_ros_driver2 msg_HORIZON_launch.py
[INFO] [launch]: All log files can be found below /home/user/.ros/log/2024-04-25-17-22-54-400569-ansan-ppl-vueron-141435
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [livox_ros_driver2_node-1]: process started with pid [141437]
[livox_ros_driver2_node-1] [INFO] [1714033374.457089543] [livox_lidar_publisher]: Livox Ros Driver2 Version: 1.0.0
[livox_ros_driver2_node-1] [INFO] [1714033374.457433843] [livox_lidar_publisher]: Data Source is raw lidar.
[livox_ros_driver2_node-1] [INFO] [1714033374.457447643] [livox_lidar_publisher]: Config file : /home/user/Workspace/ws_livox2/install/livox_ros_driver2/share/livox_ros_driver2/launch_ROS2/../config/HORIZON_config.json
[livox_ros_driver2_node-1] LdsLidar *GetInstance
[livox_ros_driver2_node-1] config lidar type: 1
[livox_ros_driver2_node-1] [INFO] [1714033374.458125043] [livox_lidar_publisher]: Init lds lidar success!
$ ros2 node list
/livox_lidar_publisher

$ ros2 topic list
/parameter_events
/rosout

After the message "Init lds lidar success!" is displayed, no further messages appear, and although the node is confirmed in the node list, nothing can be found in the topic list.
I need your help.

@siliblue
Copy link

I hope my reply can help u

  1. As far as I can remember, Horizon doesn't need a complex config file
  2. If you are using ROS2, the static library of SDK1 needs to be changed to a dynamic library
    Workaround: Delete or rename liblivox_sdk_static.a under /usr/local/lib (for example, liblivox_sdk_static.a.ak) and then run colcon build
    The ros2 driver will automatically compile the dynamic library and pass the compilation.
  3. Your host needs to be in the same static network segment as the LiDAR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants