Project

General

Profile

Revision 1115

Added by Rich Hong about 15 years ago

Smart run around mostly works!!!

Thanks to Brian for fixing a bug in motion code
divide by 0 zero error in motion.c

Makefile cleans .csim and copy it over

GUI no longer fill the robot

View differences:

motion.c
62 62
		}
63 63
	  return 0;
64 64
	}
65
	radius = ROBOT_WIDTH * speed1 / (speed1 - speed2);
66
	
67
	double t = speed1 / radius / MOTOR_CONVERSION_FACTOR;
68 65

  
66
	double t;
67
	if (speed1 != 0)
68
	{
69
		radius = ROBOT_WIDTH * speed1 / (speed1 - speed2);
70
		t = speed1 / radius / MOTOR_CONVERSION_FACTOR;
71
	}
72
	else
73
	{
74
		radius = ROBOT_WIDTH * speed2 / (speed2 - speed1);
75
		t = speed2 / radius / MOTOR_CONVERSION_FACTOR;
76
	}
77

  
69 78
	double newx = (radius * sin(t)) / MOTOR_CONVERSION_FACTOR;
70 79
	double newy = (radius - radius * cos(t)) / MOTOR_CONVERSION_FACTOR;
71 80
	

Also available in: Unified diff