Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   camera scope problems (http://www.chiefdelphi.com/forums/showthread.php?t=51739)

xrabohrok 13-01-2007 13:30

camera scope problems
 
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! :)

Stuart 13-01-2007 14:25

Re: camera scope problems
 
edit the tracking.c and .h files to include custom getPan() getTilt() functions.

xrabohrok 15-01-2007 12:48

Re: camera scope problems
 
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

Re: camera scope problems
 
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:
Code:

#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

Re: camera scope problems
 
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:
PHP Code:

//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.


All times are GMT -5. The time now is 12:02.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi