Hello again LMRians!
I want to accomplish a course correction for my robot. I have written the code for the course correction and one for the object avoidance (without course correction). Now I need to somehow merge both loops so the robot detects the objects in it's way but also goes in a straight line.
The code can be found here: GitHub
I know after every turn I have to get the new heading (which is not a problem) and then get the headings over and over again until I notice a change in the heading and then go into the other direction to make sure that I go in a reasonably straight line.
The problem is I have no clue how to efficently do both of this in one step. Another problem is that the robot sometimes gets stuck in the SRF05 getDistance() routine, and I have no clue why. It can be found on GitHub as well in lib/SRF05.c
I would appreciate your help!