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
[gz-sim] x500_lidar for testing CollisionPrevention #22418
base: main
Are you sure you want to change the base?
Conversation
Nice, I definitely want to use this to fix |
gz_collision_prevention_test.tar.gz Run this command: |
Index 0 in the array corresponds to the first distance measurement which starts at the edit: check |
If it is mapped correctly the something else is wrong but with the gz sim collision model itself? Collision prevention did not stop me from hitting the box that was shown in the screenshot and params are matching with what I had for the depth cam model. The depth cam model did work to stop from collision but the array showed some strange range bin values. I’ll check the fused array. |
Since we know now that the depth cam model is publishing the distances array in reverse order and CP still works it's probably an issue with the CP code itself. |
I’m copying your files into my local branch. I tried building the PR branch on a cloned local of your fork and had issues, so I can’t rule out build issues on my end. I did notice depth cam obstacle map was flipped but thought it was QGC visual only, that makes sense that the array itself was flipped and why I’m seeing large bin values where it should be shorter distances…. CP would still reliably reduce velocity in the forward direction even if the array is flipped. |
@dirksavage88 I just tested it and it works for me but it's just really shitty. The velocity contraints will kick in too slowly and you'll hit the obstacle if you're moving towards it too fast. Try increasing CP_DIST and reduce the max horizontal speed and tilt angle. The tilt angle and tilt rates needs to be reduced or the lidar will be looking at the ground |
I did play with the settings and it's a bit better. My concern is that if I turn the CP go_no_go parameter on I'm not able to roll to the right, which means something may be off with the obstacle distance map message. I pulled the lidar specs and it looks like there's a 90 degree gap, so that may explain why I'm seeing a gap in coverage but it should be directly aft of the vehicle and not the sectors to the right. |
obs.sensor_type = obstacle_distance_s::MAV_DISTANCE_SENSOR_LASER; | ||
obs.min_distance = static_cast<uint16_t>(scan.range_min() * 100.); | ||
obs.max_distance = static_cast<uint16_t>(scan.range_max() * 100.); | ||
obs.angle_offset = static_cast<float>(-angle_min_deg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I think this large angle offset is the reason for the right side lacking coverage, it shifts the entire array counter clockwise so the obstacle map leaves the right side exposed. Recommend changing it to -5. I’ve used -2.5 here on another rotating LiDAR: https://github.com/PX4/PX4-Autopilot/blob/6a34b63b60251aa15703a66ad9f4479943868f16/src/drivers/distance_sensor/lightware_sf45_serial/lightware_sf45_serial.cpp#L78C11-L78C11
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh the issue is that this value is already negative
so it should be
obs.angle_offset = static_cast<float>(-angle_min_deg); | |
obs.angle_offset = static_cast<float>(angle_min_deg); |
this gives me the correct internal map array representation
TOPIC: obstacle_distance_fused
obstacle_distance_fused
timestamp: 101680000 (0.040000 seconds ago)
increment: 10.00000
angle_offset: 0.00000
distances: [149, 156, 169, 184, 221, 296, 378, 412, 404, 409, 425, 460, 517, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 470, 438, 428, 424, 437, 405, 287, 228, 190, 166, 152, 145, 151, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535, 65535]
min_distance: 10
max_distance: 3000
frame: 12
sensor_type: 0
Although this now (correctly?) produces the 90 degree issue in QGC 😅 So I think QGC needs a fix.
Hello everyone, I have one simple question... |
@OgnjenX With a vehicle connected go to the Safety page and check the "show obstacle distance overlay" box |
For some reason, it does not show data on the map with this configuration: But when I run 'listener obstacle_distance' in MAVLink Console, I get: |
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: https://discuss.px4.io/t/using-obstacle-distance-uorb-msgs-for-collision-prevention/37524/8 |
Added another x500 model with a lidar attached.
https://app.gazebosim.org/OpenRobotics/fuel/models/Lidar%202d%20v2
Subscribes to gz::msgs::LaserScan and publishes to ObstacleDistance.