ultrasonic sensor does not match with URDF
Hi guys,
I have a real robot with 4 diffrent ultrasonic sensors publishing on 4 different topics. I used the same name in my URDF file as publishers however when i want to display it on RVIZ the location is wrong. is there any guidline that i can refer to ? or anyone has idea what i am doing wrong ?
This is the topic echo
ubuntu@ubuntu:~$ rostopic echo /lSonic
header:
seq: 4023
stamp:
secs: 1615356239
nsecs: 343081474
frame_id: "/base_footprint"
radiation_type: 0
field_of_view: 0.25999999046325684
min_range: 0.0
max_range: 7.0
range: 5.357534885406494
---
This is the topic info
ubuntu@ubuntu:~$ rostopic info /lSonic
Type: sensor_msgs/Range
Publishers:
* /ultrasonic (http://ubuntu:42959/)
Subscribers:
* /rviz_1615277321083748871 (http://vm-ubuntu-20:42115/)
This is ultrasonic publisher code
r = Range()
r.header.stamp = rospy.Time.now()
r.header.frame_id = "/base_footprint"
r.radiation_type = 0
r.field_of_view = 0.26
r.min_range = 0.0
r.max_range = 7.0
r.range = measurementInCM(GPIO_SIGPIN)/100
publisher.publish(r)
rospy.sleep(1.0)
I'm sorry to have to do this for something so seemingly unimportant, but please don't post screenshots of terminal text in question on ROS Answers. It's all text, so there is no need. Just copy-paste the text from the terminal into your question text. Do make sure to format it properly by selecting the text and pressing
ctrl+k
(or clicking the Preformatted Text button (the one with101010
on it)).You don't need to post a new question, just edit your curent one. You can use the
edit
button/link for this.After you replace the screenshot with the error message itself, we can re-open your question.
As to your problem: as stated in the sensor_msgs/Range documentation,
min_range
,max_range
andrange
use units of metres.Does your sensor really have a max range of 350 metres?
It's likely you're populating the fields with data in centimetres.
@gvdhoom I converted t he values to meter and now i can not see anything on RVIZ
The
max_range
of your sensor is7.5
cm? That seems really small. Previously (in the screenshots) it was350
metres (or centimetres, if it was centimetres). Wouldn't that be3.5
m after conversion instead?Comparing the screenshots with the
rostopic echo
output you show now, perhaps you divided by1e3
instead of1e2
?And
field_of_view
is0.10000000149011612
radians? That's only approx5.7
degrees. Possible of course, but also seems small.Thank you for your answer, I already modify the code accordingly now it become better however the location is still wrong. look at the first picture the range should be start from leftside of the robot and look at left not right