learning_robotics_2nd_ed icon indicating copy to clipboard operation
learning_robotics_2nd_ed copied to clipboard

sonar sensor ?

Open Arvrairobo opened this issue 4 years ago • 28 comments

First of all great book and learnt many concepts from it but still somethings are confusing which i have listed below, if you can give me insights on it, that would be great.

i have seen the code and i am not getting some things in the code, if you could shed some lights that would be great.

  1. i do see the sonar sensor that we are reading from arduino and receiving that in launch_node.py file and also publishing the sonar data on topic, but i dont see where it is subscribed and where that reading is been used?

  2. there are 3 cliff sensor joint used in the xacro file which is left, right and front joint, what is that used for and how it is used in the real robot? also i dont see sonar sensor used in the xacro or urdf.

  3. when i tried to run the the code on gazebo simulator with hotel map and viewed that on rviz, robot was able to move to the goal but it was taking lots of time and sometimes its just stuck on its place, spinning many times and then find new goal and then it goes to end goal but it was not that great, what is wrong with it?

Looking forward to hear from you.

Arvrairobo avatar Jun 07 '20 03:06 Arvrairobo

Hi @Arvrairobo

Sorry for the trouble. Here are the answers to your questions.

  1. The sonar sensor is not using at this moment, but you can subscribe to that topic and you can use it for a range sensor layer [http://wiki.ros.org/range_sensor_layer]. This is an optional feature, that's why I didn't mention it.

  2. The thing is, we are using turtlebot plugin for simulation, it is having the cliff sensor by default. That's why we have to define cliff sensors in the URDF too. There is no use of that sensor in our case. You can ignore it.

  3. The software is working fine, but I think you have to tune the gmapping and navigation move_base parameters mentioned in the config folder. By changing the parameters, you can make it work.

Regards

qboticslabs avatar Jun 07 '20 06:06 qboticslabs

Thank you very much for quick answer

The sonar sensor is not using at this moment, but you can subscribe to that topic and you can use it for a range sensor layer [http://wiki.ros.org/range_sensor_layer]. This is an optional feature, that's why I didn't mention it. ==> is it work with kinect sensor? how it will combine with point cloud cause kinect will send Laserscan msg while sonar sensor will send rangescan msg, so how they both will work together? not able to figure that out. if you can write how to use it, that will help me to finalise my product.

Arvrairobo avatar Jun 07 '20 06:06 Arvrairobo

Hello, still waiting for the answer

Arvrairobo avatar Jun 19 '20 07:06 Arvrairobo

Hi @Arvrairobo

It will work with Kinect. Currently, the depth to the laser scanner package will convert the point cloud from Kinect to laser scan messages. If we want more accuracy, we can add a sonar sensor in the robot which will improve the accuracy of the map building. The following link may help to add the sonar topic to the navigation stack

https://medium.com/teamarimac/range-sensor-layer-abdb18a0ff2e

qboticslabs avatar Jun 19 '20 07:06 qboticslabs

ok so that means sonar sensor is used only for accurate map building or it has actual use on detecting obstacles too while robot is moving? if it has any use in detecting obstacles while moving then what changes i need to do in move base or in the code?

Arvrairobo avatar Jun 19 '20 08:06 Arvrairobo

i am about to buy ros robotics projects book of yours :) thank you very much for all those knowledge sharing

Arvrairobo avatar Jun 19 '20 08:06 Arvrairobo

@Arvrairobo The building of the map is done by finding obstacles by the laser scanner. The laser scanner is the main sensor for map building, if you add sonar, the thing is, it can also short-range obstacles while moving and it can update the map according to that. The laser scanner is fine enough for mapping and dynamic obstacle detection, but there is a provision in navigation stack to add a sonar sensor to add an extra layer of obstacle detection. I have mentioned a link in the above command. You can follow that to add sonar sensors.

qboticslabs avatar Jun 19 '20 08:06 qboticslabs

i am about to buy ros robotics projects book of yours :) thank you very much for all those knowledge sharing

Thanks :)

qboticslabs avatar Jun 19 '20 08:06 qboticslabs

ok cool got it, so that means all i need to do is add that thing in the costmap, local map and other configuration and read the sonar sensor values and publish it using /range_data topic, correct?

final question for today, so if i dont use kinect sensor and just use range of sonar sensors and use that range_sonar_layer plugin those to create a map and then obstacle avoidance only with sonar sensors, is it possible?

Arvrairobo avatar Jun 19 '20 08:06 Arvrairobo

also for better robot navigation and obstacle avoidance, how many sonar sensors we should use and at what distance if robot radius is round, about 50 cm ?

Arvrairobo avatar Jun 19 '20 08:06 Arvrairobo

ok cool got it, so that means all i need to do is add that thing in the costmap, local map and other configuration and read the sonar sensor values and publish it using /range_data topic, correct?

Yes, this is correct

final question for today, so if i dont use kinect sensor and just use range of sonar sensors and use that range_sonar_layer plugin those to create a map and then obstacle avoidance only with sonar sensors, is it possible?

You can do it, but the thing is, the sonar resolution and range is very less right, so map building and obstacle avoidance using only sonar will not be sufficient.

qboticslabs avatar Jun 19 '20 09:06 qboticslabs

also for better robot navigation and obstacle avoidance, how many sonar sensors we should use and at what distance if robot radius is round, about 50 cm ?

Using only sonar is not recommended but still, you can try , it will be better if you can have sonar in 360 degree. More sonar, more better will be the resolution.

qboticslabs avatar Jun 19 '20 09:06 qboticslabs

ok so i have purchased that ros project robotics books, it is great, thank you very much, reading it but so far good

ok now i am doing chefbot bring up and i am getting the data using miniterm.py fine but it seems serial transmision is so fast from arduino so that rosserial python or launchpad_node.py is unable to cope up with it, so it is sync issue and it is closing down the serial connection, how to solve this issue? i am stuck in there

Arvrairobo avatar Jun 23 '20 08:06 Arvrairobo

Hi @Arvrairobo , If there are syncing issues, please reduce the baud rate. Can you check with 9600 baud? Change baud in both Arduino code and launchpad node

qboticslabs avatar Jun 23 '20 09:06 qboticslabs

ok let me check and confirm

Arvrairobo avatar Jun 23 '20 09:06 Arvrairobo

ok i have done 9600 baud rate it is better but still the problem.

so rostopic echo /serial shows the data very fast and when i press ctrl + C to stop the data and then i see terminal window where i did launchpad.py it shows this warning

[WARN] [1592904208.510559]: Inbound TCP/IP connection failed: connection from sender terminated before handshake header received. 0 bytes were received. Please check sender for additional details.

and then i again go to rostopic echo /serial

no data i see just blinking, so it seems it is breaking the connection after some time?

Arvrairobo avatar Jun 23 '20 09:06 Arvrairobo

but then if i again start launchpad_node py, it automatically shows data in rostopic echo /serial but after sometime it just stuck and no new data it shows.

Arvrairobo avatar Jun 23 '20 09:06 Arvrairobo

@Arvrairobo Make sure the coming data is correct first, and when the data is stuck, just close the launchpad and test it with miniterm.py for checking data is still coming from arduino

qboticslabs avatar Jun 23 '20 09:06 qboticslabs

yes,i have confirmed, data is coming correct and now it is coming without any probem.

but as soon as i press ctrl + c on rostopic echo /serial. it stops the launchpad and end with that warning that i pasted above and then if i run launchpad again then it automatically shows data on echo.

so now the question is why rostopic echo /serial ctrl + c is ending the launchpad_node.py?

so far working great

Arvrairobo avatar Jun 23 '20 09:06 Arvrairobo

ok i confirmed, even if i do ctrl + c and above scenerio happens, miniterm.py is showing the data

Arvrairobo avatar Jun 23 '20 09:06 Arvrairobo

so just to confirm again after pressing ctrl + c on rostopic echo /serial terminal

roslaunch launchpad_node.py shows below error

[WARN] [1592905218.257550]: Inbound TCP/IP connection failed: connection from sender terminated before handshake header received. 0 bytes were received. Please check sender for additional details.

and then if i open another terminal with rostopic echo /serial it shows nothing just blinking the cursor.

but miniterm.py shows the data

and as soon as i ctrl + c launchpad_node.py and again run launchpad_node.py, it shows data on rostopic echo /serial

any suggestion?

Arvrairobo avatar Jun 23 '20 09:06 Arvrairobo

ok so far it is working fine,

now the next problem i am facing

roslaunch ChefBot_bringup robot_standalone.launch

i did above, everything is launching fine

then i did this

roslaunch ChefBot_bringup keyboard_teleop.launch

but real robot is not moving? it is publishing a twist message fine but robot is not moving.

Arvrairobo avatar Jun 23 '20 10:06 Arvrairobo

sorry to bother you, ignore all the above messages, they all are sorted.

but i have a strange issue that is

  1. python is sending and receiving data fine using serial
  2. but aruduino is only detecting/reading serial data of python, if i open serial monitor and then robot is moving. as soon as i close serial monitor of aruduino IDE, Arduino code is not reading those serial data, hence robot is not moving, any clue?

Arvrairobo avatar Jun 23 '20 13:06 Arvrairobo

what is the use of reset pin and green LED pin? if you shed some lights on it, that can help?

Arvrairobo avatar Jun 23 '20 13:06 Arvrairobo

what is the use of reset pin and green LED pin? if you shed some lights on it, that can help?

You can reset the board by sending a reset command from the launchpad.py. One of the GPIO pin is connected to reset pin and when the GPIO pin is activated by the reset command, it will reset the board, it will help to reset the board from the command line itself. If any odometry error, then you can reset the board using this

qboticslabs avatar Jun 23 '20 18:06 qboticslabs

ok that makes sense, thank you for your help, but i am still stuck on this issue, may be i need to power the micro controllers with dedicated power suppy, right now i am powering up with USB from computer, so micro controller is getting power from computer as well as using the same USB to send or receive serial data, may be that is the case. i am talking about this for below issue:

  1. python is sending and receiving data fine using serial
  2. but aruduino is only detecting/reading serial data of python, if i open serial monitor and then robot is moving. as soon as i close serial monitor of aruduino IDE, Arduino code is not reading those serial data, hence robot is not moving, any clue?

also on some forum, they says that when you open serial monitor it resets the Arduino and thats why it is accepting serial values from python, is that possible?

also some suggested that we need to wait on python side until we get the data and then only we write the serial data?

i am not sure what solution could be?

Arvrairobo avatar Jun 24 '20 05:06 Arvrairobo

i am not finding any solution for that, if you could help me on that, that would be great

Arvrairobo avatar Jun 25 '20 12:06 Arvrairobo

Hi @Arvrairobo. Can you send a mail to [email protected]? I can share my contact number and we can have a voice interaction so that it can fix it early.

Regards

qboticslabs avatar Jun 25 '20 13:06 qboticslabs