Hey everyone!
This is my first project ever and I have an issue.
I still need an intuition where to write the main function of my code. The project is simple just avoid the sphere with the help of laser scan and cmd vel.
I created the subscriber and publisher required and I can move forward and read the laser provided in the right left and center direction.
The only problem that I still have is writing the main function for the following logic:
- If the laser reading in front of the robot is higher than one meter (there is no obstacle closer than one meter in front of the robot), the robot will move forward.
- If the laser reading in front of the robot is lower than one meter (there is an obstacle closer than one meter in front of the robot), the robot will turn left.
- If the laser reading on the right side of the robot is lower than one meter (there is an obstacle closer than one meter on the right side of the robot), the robot will turn left.
- If the laser reading on the left side of the robot is lower than one meter (there is an obstacle closer than one meter on the left side of the robot), the robot will turn right.
I need your assistance in guiding me for having an intuition and understanding how to build my package and use the nodes that I created to perform this logic.
Thanks in advance!