|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Where do I begin to get the robot to move using the camera?
Thanks. I made these changes, hopefully it will work:
At the top of user_Routines.c I declared this Code:
int pwm03_On_Off = 1; Code:
if(pwm03_On_Off == 1)
{
pwm03 = p3_y; //ForkLift
}
Code:
if((pwm03 < 125) || (pwm03 > 129)) //if py_3 is being used (forklift going up or down)
{
if((now == 1) && (last == 0)) //If sensor, which connects to Dig In/Out port 4, sends a signal...
{
count++; //Number of times tape passes through the sensor.
Switch1_LED = 1; //Switch01 goes on when the tape passes the sensor.
}
else
{
Switch1_LED = 0;
}
switch(count) //for sensor module
{
case 1: //if count = 1 then that just means that it passed through the first piece of tape which will be used to show that it is in full DOWN position.
Relay2_green = 1;
Relay2_red = 0;
printf("count = 1");
break;
case 2:
Relay2_green = 1;
Relay2_red = 0;
pwm03 != p3_y;
pwm03_On_Off = 0;
pwm03 = 127; //Motor stops when it reaches 1st level of rack.
printf("count = 2");
break;
This is all still in Default_Routine() Code:
last = now;
now = rc_dig_in04;
last2 = now2;
now2 = p3_sw_trig;
last3 = now3;
now3 = p3_sw_aux1;
//some other stuff, but then:
if((now3 == 1) && (last3 == 0)) //p3_sw_aux1 sets counter to 0 in case forklift needs to be reset.
{
count = 0;
}
if((now2 == 1) && (last2 == 0)) //p3_sw_trig sets joystick 3 y-axis to forklift motor. Use after each level.
{
pwm03_On_Off = 1;
}
|
|
#2
|
|||
|
|||
|
Re: Where do I begin to get the robot to move using the camera?
That won't work because the next time around the fork lift is going to be reconnected to the joystick.
This does not do what you think it does: pwm03 != p1_y; Lets say p1_y is equal to 200 at the moment, so we have pwm03 != 200; Which means pwm03 is going to be set to 0 (for the moment). You will need an if or switch statement for your joystick. Also you might want to put a \r\n in your print statements. Keep up the good work!! Jason |
|
#3
|
|||
|
|||
|
Re: Where do I begin to get the robot to move using the camera?
Please help me, I can't figure out how to use the camera to actually MOVE the robot. I have the camera code working along with the camera itself, but how do I move pwm01 (left drive wheel) and pwm02 (right drive wheel) individually according to the pan of the camera? I have no idea where to begin with this code. (I just got the code to work for the camera and I've been trying for weeks. Now I only have 2 days, Please help if you can)
Code:
int I_Want_To_Search = 1;
int pwm01_On_Off = 1;
int pwm02_On_Off = 1;
int pwm03_On_Off = 1; //these are all at the top of user_routines.c Everything else is in Processfrom master UP (except TARGETRANGE[] and FIND_DISTANCE())
if(I_Want_To_Search == 1)
{
Servo_Track();
}
if((Get_Tracking_State() == CAMERA_ON_TARGET) || (Get_Tracking_State() == TARGET_IN_VIEW))
{
pwm01_On_Off = 0;
pwm02_On_Off = 0;
pwm01 = 230; //Desired Forward Velocity
pwm02 = 230;
Switch3_LED = 1;
//printf("2"); //these statements are just to see if it worked
}
else
{
Switch3_LED = 0;
pwm01_On_Off = 1;
pwm02_On_Off = 1;
//printf("4"); //these statements are just to see if it worked
}
/*
if(Find_Distance() <= 50) //THIS DOESN"T WORK!! WHY NOT?
{
pwm01 = 127;
pwm02 = 127;
pwm01_On_Off = 1;
pwm02_On_Off = 1;
I_Want_To_Search = 0; //Stops calling Servo_Track(). THEN CALL ANOTHER THING
Switch3_LED = 0;
//printf("3"); //these statements are just to see if it worked
}
*/
if(p1_y > 129 || p2_y > 129)
{
pwm01_On_Off = 1;
pwm02_On_Off = 1;
}
else if(p1_y < 125 || p2_y < 125)
{
pwm01_On_Off = 1;
pwm02_On_Off = 1;
}
Code:
unsigned int Find_Distance(void)
{
return(targetRange[pwm07-144]);
}
Code:
const rom unsigned int targetRange[] =
{
3355,
1676,
1116,
835,
666,
553,
472,
411,
363,
325, //place 10
293,
267,
244,
225,
208,
193,
179,
167,
156,
146, //place 20
137,
128,
121,
113,
107,
100,
94,
89,
83,
78, //place 30
73,
68,
64,
60,
56,
51,
48,
44,
40,
36, //place 40
33,
29,
26,
23,
19,
16,
13,
10,
6,
3, //place 50
0, //place 51
};
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Building the field :: where can I get the carpet? | Armando Gonzalez | Technical Discussion | 10 | 12-01-2007 14:14 |
| Where in the world is the new 2007 cmu camera docs?!?!? | xrabohrok | Programming | 13 | 08-01-2007 20:28 |
| Where do we get more extention wires for the Vex robot? | pbrules15 | Technical Discussion | 5 | 27-01-2006 07:48 |
| how do u figure out the torque req'd to move a robot? | Salik Syed | Technical Discussion | 11 | 03-11-2004 08:12 |
| Using Robotics to get the girl | necroprime | Chit-Chat | 66 | 21-03-2003 23:21 |