View Full Version : camera scope problems
xrabohrok
13-01-2007, 13:30
I have been programming our robot's autonomous by using the current positions of the camera servos seen in tracking.c. This, of course, creates scope issues. If anyone could tell me an effective way to pass these variables to user_routines_fast.c, that would be incredibly appreciated. thx! :)
edit the tracking.c and .h files to include custom getPan() getTilt() functions.
xrabohrok
15-01-2007, 12:48
I don't know how to implement that. I tried making the music the extern variable type but that only us a weird problem that goes something like "pan_servo_position's definition in tracking.o" How in the world do I fix this?
Andrew Schreiber
15-01-2007, 13:51
It seems to me you wouldnt have to extern the variables. Instead what you can do is to read the PWM output that you are sending to the camera from the servoTrack(). Uh, basically in youre user_routines.h file where it says to add your aliases here you put the lines:
#define CAMERA_PAN pwm01
#define CAMERA_TILT pwm02
instead of pwm01 and pwm02 you put whatever pwm outputs the actual servos are connected to. For another example of how this is done Im relatively sure you can check lines 36 and 42 of tracking.h.
Now to write the get____ functions you just write them like you would any other Accesor Method (sorry too much java programing for me). The only thing you would need to have the function do was return PAN_SERVO or TILT_SERVO. Of course you need to add them to the tracking.h file like any other functions you write.
If you still cant get it pm me and ill try to explain better. Sorry if I seem a bit vague, I dont like it when people just tell someone what to do. Thats really not the spirit of first or programming. Yay for problem solving
Uberbots
15-01-2007, 20:48
um... we used the camera's pwm constants in the autonomous code last year without fail... why would this be causing a scope error at all?
snippet:
//update variables
autoOption = (bAutoOpt01 + (bAutoOpt02*2))+1; //parse the binary input
robotTilt = Get_Gyro_Angle();
cam_pan = PAN_SERVO;
cam_tilt = TILT_SERVO;
cam_pixels = T_Packet_Data.pixels;
that worked without fail. i wouldnt use get__ functions though, unless they are inline, because the sheer amount of calls you will be making to these funtions might cause undesirable overhead.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.