|
Autonomous With Camera
So, weve gotten tracking working just like everyone else here. I am trying to figure out how to move what we have in the normal mode to autonomous. Below are things I have to consider:
1. Setting which color we should use for tracking
2. Which functions must be called on in order for tracking to work properly
Has anyone gotten this to work properly? It seems to me that If i copy all the stuff in Default_Routine() function to the Default_Routine_Fast() function it should work. This means the following code:
camera_find_color(color) // Tells is what color to start tracking
and
if (p1_sw_trig > 0 && tracking > 0) { //If vision active and tracking use camera data
p1_y = speed_control; //set forward speed
p1_x = pan_position; //set turning rate
p1_x = 255 - p1_x; //invert turn direction
// Steering Compensation
if (p1_x > 135 && p1_x < 225 && steering_comp > 0)
p1_x = p1_x + steering_comp;
if (p1_x < 120 && p1_x > steering_comp && steering_comp > 0)
p1_x = p1_x - steering_comp;
pwm11 = Limit_Mix(2000 + ramp_y() + ramp_x() - 127); //uses our ramp
pwm12 = Limit_Mix(2000 + ramp_y() - ramp_x() + 127); //uses our ramp
Had anyone done this? I just wanted to share my thoughts.
--Sam
--Team 486
--Positronic Panthers
--Gotrobot.org
EDIT:
I just had a thought. Since the code to pick your color isn't in the Default_Routine() function, it is always running, even when the robot is disabled. This means that another way you can work setting up the camera is by mimicking the button controls. For instance:
I don't think i'll do this for changing the colors (it'll start looking for each color in turn), but it might be useful for the other functions. An important thing to remember is that there is no need to change the output variable when you can change the input one!
Last edited by schenkin : 04-02-2005 at 20:47.
|