|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
CMUcam communications with motors
Hello,
I'm not sure if I worded the title very well, but its the only way I can think to word it. I'm currently working on a way to have the CMUcam to communicate with the normal motors from when the code tells the camera to move , from saying move +/- 1 for the motor to move until it centers. I am unsure if this will work very well. I read in the "Servo Values to Degrees... How?" thread talked about making degrees from the servo values, but I don't really understand it very well. So first I was hoping some one could help explain that to me, more of where to put what. Also, I only want the camera working in auto mode. I have found a few things in around about it, although I haven't been able to do anything the past few days due to a bad snowstorm. Another thing I want to discuss was what other teams are doing for auto mode, and how that are making the CMUcam communicate with other parts of their robot. I'm not to sure if most of this makes since, and if it doesn't I'm sorry, I'm not feeling the best. Thanks for the help Josh 1555 |
|
#2
|
|||||
|
|||||
|
Re: CMUcam communications with motors
Well, if you want to use the camera to interact with the motors you are going to have to understand the code. It is not so complicated if you go through the comments. To start off, do not worry about camera.c/h. The file you really need to look at is tracking.h/c.
There are two ways you can use the camera to adjust your drive train to a specific point. Either you use the servo values when it is centered on the light, or you use the camera target values. There is no way I can go through exactly how to write this code, but good luck figuring it out. It is fun. |
|
#3
|
||||
|
||||
|
Re: CMUcam communications with motors
Well, I guess that didn't make much sense. Oh well.
I have the camera working perfectly. But I have a few problems with it communicating with the rest of the robot. I'm not sure if this would be the right place for this or not. But if I can avoid making a new thread, yay.... The robot, besides the camera, is not responding at all. I hooked up the dashboard and all pwms are 0 and pwm08, which isnt used, is 255. pwm04 to pwm 09 are not used also, but they are still 0. I am not sure if this is something electrical or not. The code I added is below. I am unable to test the code on any other robot right now. The battery is still giving power, the backup battery is still working. I haven't changed any other code besides user_rouintes.c and user_routines_fast.c. Right now i am thinking it is electrical, but I don't know. Another thing I would like to ask is if the code below would work the way I want it to. It should be set so, if the cameras pan servo is more than 10 degrees it goes right and vice versa. EDIT: I have just tested it again, I used a clean CMUcam s_21 and I put to lines of pwm16 = 140; and pwm15 = 114; And nothing still happens. Thanks Josh 1555 This code isn not copied and pasted from the original, so I may have miss typed something. Code:
if ((((int)PAN_SERVO - 124) * 65)/124 > 10)
{
pwm16 = 140;
pwm15 = 114;
}
else if ((((int)PAN_SERVO - 124) * 65)/124 < -10)
{
pwm16 = 114;
pwm15 = 140;
}
else
{
pwm16 = 127;
pwm15 = 127;
}
Last edited by Oumonkey : 17-02-2007 at 12:28. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CMUCam problems with EasyC Kickoff demo code | Team 562 | Programming | 4 | 14-02-2007 14:27 |
| Interrupts with CMUCam | RyanW | Programming | 6 | 08-02-2007 23:32 |
| Problem with TTL-RS232 + CMUCam | Shinigami2057 | Programming | 6 | 28-01-2007 08:47 |
| CMUCam with EasyC | gabrielse | Programming | 5 | 01-02-2006 14:28 |
| Problems with CMUcam & LABView | Daniel_H | LabView and Data Acquisition | 1 | 30-01-2006 12:07 |