Saturday, March 29, 2014

So I did some testing today and the ultrasonic reads are not working properly, and when testing with static distance values I found some errors with my if else statements.  Once I get those worked out, hopefully tomorrow, I will post the changes to the code.  Meanwhile I need to find a better way of reading the ultrasonic ranges in without breaking the hardware interrupts.   A really good library called NewPing will not work because the timed interrupts take a higher priority than my hardware interrupts.  This is why I tried using the mod function with multiple ping reads for each sensor.  This may still be the way I need to proceed but I need to nail down whats causing it to break the code right now.
Changes upcoming are removing the initial check for the distances out of range.   This was not working at all for some reason.  I will add a final condition for being further than 8 ft or 245 cm to give full control back to the user.  
Under tests today I found that there is a possible problem with how the if statements react to multiple conditions on the same channel.  Example in a hallway if the left and right distances should trigger events at the same time.  The way I have it written now, it will only adjust for the shortest distance.  This could allow for issues like if the wall is closer on the right side you can pull away from that wall at full speed towards the left wall until the distance is less for the left vs the right one.  In theory this shouldn't matter, but I can see a problem if you try to operate within a tight area.  This will all depend on the reaction time of the controller and code.

No comments:

Post a Comment