Software > Software

Help with algorithm for grid solving

(1/3) > >>

Ankit Virdi:
I am using 5 sensors and 2 dc motors. I want to turn my bot by 90deg at a node. I am doing that using delay, the problem i am facing with it is as my battery goes a bit down my delay changes. Is there any other algorithm for 90deg turn as I am not using stepper motors.
here's the code
#include"sensor.h"
#define S3 (PINA&(1<<3))
#define S2 (PINA&(1<<2))
#define S4 (PINA&(1<<4))
#define S5 (PINA&(1<<5))
#define S1 (PINA&(1<<1))
void main()
   {
   motor_init();
sensor_init();
while(1)
{
if(!(S1&&S5))
{
motor_forward();
}
if(S1&&S2&&S4&&S5&&S3)
{
motor_right();
_delay_ms(1000);
motor_forward();
_delay_ms(500);
}
}
)

jkerns:
If you need to continue to do this open loop you would need two things - an input to measure your battery voltage (voltage divider into an A/D) and some data that lets you write a function to determine how long to delay for the 90 degree turn.

Other options would be rotation sensors on the wheels, compass sensor or gyro sensors.

Ankit Virdi:
Can I not do it with just the sensors I have? How is this guy doing it?
https://www.youtube.com/watch?v=0BXxfHZzw2Y

robonerd137:
That guy is using infrared sensors to track the black lines on the ground.

Ankit Virdi:
How is he turning his bot 90deg and 180deg?
By giving specific delays? or is there any other method?

Navigation

[0] Message Index

[#] Next page

Go to full version