Ask Your Question
0

hector sonar

asked 2012-09-04 22:22:59 -0600

pmarinplaza gravatar image

updated 2014-01-28 17:13:34 -0600

ngrennan gravatar image

I want to know if libhector_gazebo_sonar works with only one array of Ray data in it field of view. I am testing the sonar right now but the lectures are very bad. If the object is inside the range and inside the field of view, over the mid of the field of view the range becomes the max range without detecting any object. I need detect all objects in the field of view because I want to know where I have to put my sensors.

I upload some images to explain better the case.

http://s15.postimage.org/k1gsg4k6j/sonarwrong_c.png

http://postimage.org/image/p04aunnzb/

4 images:

The first the sonar sensor works very well. The second: only a little up the sensor doesn't detect anything. The third and forth the same case but another perspective.

The field of view in libhector_gazebo_ros_sonar is calculate in this line of code:

range_.field_of_view = std::min(fabs((sensor_->GetAngleMax() - sensor_->GetAngleMin()).GetAsRadian()), fabs((sensor_->GetVerticalAngleMax() - sensor_->GetVerticalAngleMin().GetAsRadian()).GetAsRadian()));

I notice GetVerticalAngleMax() don't have the method .GetAsRadian() as angle min has. I don't know if this is the bug.

range_.field_of_view = std::min(fabs((sensor_->GetAngleMax() - sensor_->GetAngleMin()).GetAsRadian()), fabs((sensor_->GetVerticalAngleMax() - sensor_->GetVerticalAngleMin()).GetAsRadian()));

Any Ideas?

edit retag flag offensive close merge delete

Comments

Which ROS distribution and version of Gazebo do you use? There was a bug in ray sensor simulation in the released simulator_gazebo stack for fuerte prior to 1.6.13, which caused the simulated rays to be shot towards the x-axis instead of downwards.

Johannes Meyer gravatar imageJohannes Meyer ( 2012-09-05 01:29:21 -0600 )edit

I am working in Fuerte with Gazebo 1.0.2 (release version last update 5 Sept 2012) How Could I fix this bug? If I roll pi/2 the sensor, works very well only with horizontal sensors. The vertical sensors don't work.

pmarinplaza gravatar imagepmarinplaza ( 2012-09-05 22:17:12 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
5

answered 2012-09-06 06:04:00 -0600

updated 2012-10-03 03:52:12 -0600

I fixed the calculation of the field_of_view in gazebo_ros_sonar.cpp. Thanks for reporting. Unfortunatly this is not the source of your problem.

The start and end points of each ray are calculated in gazebo's MultiRayShape.cc. I did a quick test with debug outputs to verify that the calculated directional vectors for each ray are as expected.

The gazebo_ros_sonar plugin uses Gazebo's ray sensor and gives you the minimum distance out of all rays. With the default parameters from hector_quadrotor three samples are used for both the horizontal and the vertical axis equally distributed from min_angle to max_angle. So the simulated ultrasound cone is more like a pyramid than a geometric cone. Small obstacles at larger distances might be missed. You can increase the sample count if you need higher accuracy. The calculated field_of_view for the sensor_msgs/Range message is only a very coarse approximation and the visualization in rviz might lead to the impression that the distance readings are faulty.

Although these explanations are not really a solution to your problem, they might help to solve it.

UPDATE: Thanks to the video you have posted I could reproduce the problem and traced it down to the wrong usage of gazebo's RaySensor::getRangeCount() method. Seems that it only returns the number of horizontal samples and therefore only the first three rays out of nine are considered for the calculation of the minimal distance. Thanks for your efforts to point that out! The problem should be fixed now in r631 of tu-darmstadt-ros-pkg and in the upcoming 0.1.2 release of the hector_gazebo stack.

edit flag offensive delete link more

Comments

Works very well. Thanks a lot

pmarinplaza gravatar imagepmarinplaza ( 2012-10-09 00:26:16 -0600 )edit
1

answered 2012-10-02 22:15:52 -0600

pmarinplaza gravatar image

Thanks for the answer but the problem is not about the display of Rviz because the topic give me the maximum distance of the sensors even in front of the wall. I know it is not a perfect cone but a pyramid must works very well in my case too. The return of value was wrong in the lower mid of the "cone" in the simulation. If I turn the sensor 90 degrees roll, the lecture in the vertical axis becomes good but not in the horizontal axis. Maybe the follow video let me explain better:

http://youtu.be/TFzbeP9kOv4

edit flag offensive delete link more

Comments

Thanks for the illustrative video. I now have understood what you mean and found the problem in gazebo_ros_sonar plugin. See updated answer above.

Johannes Meyer gravatar imageJohannes Meyer ( 2012-10-03 03:53:15 -0600 )edit
0

answered 2014-05-27 01:55:52 -0600

keshav_sarraf gravatar image

Whenever I turn on the visualization of the sonar sensor in sdf, I find the observed rays in gazebo to be kind of odd. They cover only half of the horizontal range and sometimes are irregular (I don't have enough points to upload the picture). But in Rviz, a neat cone is observed. Is there some way to correct this? If not a complete cone, I would really appreciate even if I get a complete and uniform horizontal arc.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-09-04 22:22:59 -0600

Seen: 1,924 times

Last updated: May 27 '14