fratopa / Mid360_simulation_plugin

Plugin for the simulation of the Livox Mid-360
67 stars 11 forks source link

How to link this plugin with PX4 simulation ? #3

Closed SSZ1 closed 5 months ago

SSZ1 commented 1 year ago

I want to test a UAV with PX4 SITL in Gazebo. And I want to add a mid360 on it. But when I build the PX4-Autopilot and your plugin. I couldn't add it to the iris. So how could I link mid360 with iris in PX4-Autopilot? The Compilation mode of PX4-Autopilot is very different. Thanks a lot for your attention!

fratopa commented 1 year ago

Please paste here how you added the plugin to your iris model. I may have misunderstood what you are trying to do, but I had no problem adding this plugin to the sdf model of the Iris. Which version of gazebo are you using? this plugin does not support the newest gazebo ignition, it only works up to gazebo 11

SSZ1 commented 1 year ago

Thanks for your kind reply. My gazebo version is 9 because my OS is ubuntu melodic. Here are my iris model code with adding mid360: iris_livox_mid.sdf:

`<?xml version='1.0'?>

model://iris model://kinect_self 0.1 0 0 0 0 0 kinect_self::link iris::base_link 0 0 1 0 0 model://livox_mid360 0 0 0.1 0 0 0 livox_mid360::link iris::base_link 0 0 1 0 0 model://fpv_cam 0 0 0 0 1.57 0 fpv_cam::link iris::base_link 0 0 1 0 0

`

And I created a livox_mid360 folder in the models of PX4-Autopilot project like this: image

Here is the livox_mid360's code:

livox_mid360.sdf:

image

`<?xml version='1.0'?>

0.0 0.0 0.5 0.0 0.0 0.0 0.1 0.0001 0.0 0.0 0.0001 0.0 0.0001 0.05 0.05 0.05 0.05 0.05 0.05 0 0 0.05 0 0 0 true True 10 100 1 -3.1415926535897931 3.1415926535897931 50 1 -3.1415926535897931 3.1415926535897931 0.1 40 1 gaussian 0.0 0.0 True 20000 1 mid360-real-centr.csv 2 /livox/lidar base_link ` And the launch file is like: ` ` But when I run the launch file. It showed nothing but: ![image](https://github.com/fratopa/Mid360_simulation_plugin/assets/36888758/0731455b-5394-4fad-b605-b5916dbfaa9e)
SSZ1 commented 1 year ago

And I found a solution to add the mid360 plugin to iris. That is I run two launch files in two project separately. First, I run mavros_posix_sitl.launch in PX4-Autopilot project. Then I run test_pattern.launch in this project. It could add the mid360 to iris. It seems to work. But there will be 2 gazebo windows like this: image

Why is this? Thanks for your attention.

SSZ1 commented 1 year ago

And I found a solution to add the mid360 plugin to iris. That is I run two launch files in two project separately. First, I run mavros_posix_sitl.launch in PX4-Autopilot project. Then I run test_pattern.launch in this project. It could add the mid360 to iris. It seems to work. But there will be 2 gazebo windows like this: image

Why is this? Thanks for your attention.

there is a problem this way. After I ran the two launch files separately. I changed the uav mode to offboard. But the point clouds got stuck in rviz.
image

and the terminal windows of PX4-Autopilot shows a error: image

So how to fix this?

And after I changed the mode to manual, it came back to normal.

So how can I make the point cloud data normal with the iris UAV offboard mode?

Thanks a lot!!!

fratopa commented 9 months ago

Hi, I am sorry but I didn't had much time to dedicate to this project.

I don't have an easy way to test the setup on Melodic/Gazebo9. However looking at your most recent screenshots it looks like you might be encountering some hardware constraints problems. Your wall time is around 700 seconds while your ros elapsed time is less than 3 seconds, meaning your workstation is not able to render the pointcloud in real time.

If this is the case i don't have any short term fixes, in the long term I aim to release a GPU accelerated version of this plugin. In the meantime you can increase the downsample factor to 2, this will half the number of points being computed