Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   CMUCam and autonomous code (http://www.chiefdelphi.com/forums/showthread.php?t=53690)

Demothesis 08-02-2007 08:09

CMUCam and autonomous code
 
How do you interface the streamlined version of Kevin's CMUCam code with the default code? I understand that you change the position o fthe robot as a whole based upon the pulses you send to the camera's servos, but how or where do you put the camera code into the default code?

Bomberofdoom 08-02-2007 09:39

Re: CMUCam and autonomous code
 
The default code, from what I understood, focuses on giving you the simplest code to control your robot. It doesn't include other components except those related to the "cart".

Kevin's CMU code takes the default code and adds the camera functions and varibles so you can use them to work on targeting the lights on the rack and using the functions and varibles to do things around the arena(such as going to the spiders).

I'm affraid that using the default code with the camera won't be possible(you'll be controling the tilt of the camera with the Y axis of your joysticks :p ).

You shouldn't have any problem at all using codes you've written in the default code(and those that actuall worked) and transfer them to the CMU code. The CMU code is there to give your more options.

Hope I helped and good luck! :D

Alan Anderson 08-02-2007 11:05

Re: CMUCam and autonomous code
 
Quote:

Originally Posted by Demothesis (Post 574218)
How do you interface the streamlined version of Kevin's CMUCam code with the default code?

You don't. Instead, you do it the other way around, and make the necessary modifications to Default_Routine in the camera code project. Just map the OI inputs you need to the motors and relays you're using, and make sure you let the camera tracking code control the servos.

Then, when you have the robot running manually and the camera still tracking the light at the same time, you can start getting fancy with software to run the robot automatically based on what the camera is telling you.

Ianuser 08-02-2007 21:15

Re: CMUCam and autonomous code
 
I have a question. Do I need to measure the degree angle of the camera (pan/tilt) and do I need to use it in order to allow the robot to move itself during manual routines?

if (get_tracking_state() == CAMERA_ON_TARGET)
{
set pwm values;
}

Would that work? Might I put this in Process_Data_From_Master_uP?

Ianuser 08-02-2007 21:25

Re: CMUCam and autonomous code
 
Also, I'd need to calculate the distance to the light in order to stop the pwm's? (if so...I know the formula, but how the heck to I get it to work? I don't even know where to begin for that):)

Bomberofdoom 11-02-2007 15:58

Re: CMUCam and autonomous code
 
Well, you asked me to answer like this, so my answer is yes. :D

Demothesis 12-02-2007 23:45

Re: CMUCam and autonomous code
 
Cool. :cool: Now I see that the camera code is just kind of inserted into the default code. How convenient, no?:)

Bomberofdoom 13-02-2007 04:12

Re: CMUCam and autonomous code
 
Yep, just one thing, you'll need to commnet/uncomment some code lines in the camera code in order to use some of the default code stuff, such as the engines. It's more of where exactly you call the functions. Don't worry, if something doesn't work in your code(and it was compiled succesfuly) it probablly means that you need to change the place where you call the code lines or functions.

Really, it's no big deal. :)

Demothesis 13-02-2007 10:11

Re: CMUCam and autonomous code
 
yeah, i heard about uncommenting some functin like "default_routine()" or something like that and change something with PWM01 and PWM02. What exactly is that that because it confused me, and it didn't work. :confused:

Bomberofdoom 13-02-2007 10:13

Re: CMUCam and autonomous code
 
Uncomment Default_Routine() and comment pwm01 = p1_y and pwm02 = p2_y.

Bharat Nain 13-02-2007 10:51

Re: CMUCam and autonomous code
 
Quote:

Originally Posted by Demothesis (Post 577351)
yeah, i heard about uncommenting some functin like "default_routine()" or something like that and change something with PWM01 and PWM02. What exactly is that that because it confused me, and it didn't work. :confused:

If you have two different sets of code trying to control one pwm output, the processor is well going to be confused just like you. When you write your code, you need to make sure only one set of values is output to a pwm at any given time. Therefore, when using Kevin Watson's code, you need to comment out pwm01 and pwm02(or whichever you choose to use really). Look at the above post also.

Demothesis 15-02-2007 10:35

Re: CMUCam and autonomous code
 
I kind of figured that, but it didn't work. the good thing is, it doesn't matter anyway. I need to know how to work the camera from autonomous code.

Demothesis

Bharat Nain 15-02-2007 11:08

Re: CMUCam and autonomous code
 
Quote:

Originally Posted by Demothesis (Post 578709)
I kind of figured that, but it didn't work. the good thing is, it doesn't matter anyway. I need to know how to work the camera from autonomous code.

Demothesis

You call the same processes used in user_routines.c. Off the top of my head, I think they are Camera_Hander(); and Servo_Track();.

Bomberofdoom 15-02-2007 13:22

Re: CMUCam and autonomous code
 
Camera_Handler() * ;)

Demothesis 16-02-2007 08:06

Re: CMUCam and autonomous code
 
Okay, camera_handler() and not servo_track()? Is there any other special code that I have to write or work around in order to use the PWMs in autonomous mode? If so, will it conflict with the values mapped to the camera PWMs?:o

Demothesis


All times are GMT -5. The time now is 04:11.

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