Go to Post "Congratulations to our FIRST team coming back from the championships in St. Louis." (We all applaud) "Remember, if you're not FIRST, you're last!" - Our pilot on the second plane back home. - demosthenes2k8 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-02-2006, 11:46
team 803 team 803 is offline
Wow! a whole week1/2 of experience
FTC #0803 (Hawks)
Team Role: Programmer
 
Join Date: Feb 2006
Location: Hanahan SC
Posts: 37
team 803 is an unknown quantity at this point
Controlling

How would I arrange the programming so that one controller controls the robots movement.
We have the right side motors connected through with ONE wire and the same with the left. So:
pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);
pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);
How would I edit this since both the right side and the left side only use one port.
pwm01
pwm02

We are using the second stick for the launcher, I am not quite sure how to set that up (two weeks experience with programming). We need it so that when the top button is pressed, the motor starts. (I think that would be aux)
pwm 04
Then when the stick is pressed forward it moves the other motor forward and when moved backwards it goes backwards.
pwm 05
__________________
"Vir prudens non contra ventum mingit"
"Machina improba! Vel mihi ede potum vel mihi redde nummos meos!"
  #2   Spotlight this post!  
Unread 21-02-2006, 11:47
team 803 team 803 is offline
Wow! a whole week1/2 of experience
FTC #0803 (Hawks)
Team Role: Programmer
 
Join Date: Feb 2006
Location: Hanahan SC
Posts: 37
team 803 is an unknown quantity at this point
Re: Controlling

I am really bad at describing.
__________________
"Vir prudens non contra ventum mingit"
"Machina improba! Vel mihi ede potum vel mihi redde nummos meos!"
  #3   Spotlight this post!  
Unread 21-02-2006, 12:31
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: Controlling

Quote:
Originally Posted by team 803
How would I arrange the programming so that one controller controls the robots movement.
We have the right side motors connected through with ONE wire and the same with the left. So:
pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);
pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);
How would I edit this since both the right side and the left side only use one port.
pwm01
pwm02

We are using the second stick for the launcher, I am not quite sure how to set that up (two weeks experience with programming). We need it so that when the top button is pressed, the motor starts. (I think that would be aux)
pwm 04
Then when the stick is pressed forward it moves the other motor forward and when moved backwards it goes backwards.
pwm 05
Whoa nothing like last minute programming! So for the drive motors just replace pwm13=pwm14= with pwm01 = and the same thing for the other side so that it looks like this:

pwm01 = Limit_Mix(2000 + p1_y + p1_x - 127);
pwm02 = Limit_Mix(2000 + p1_y - p1_x + 127);

For your pwm04 motor: remember pwm ports need a value from 0 to 254, 0 is full reverse, 254 is full forward, and 127 is neutral. The aux1 input is boolean, meaning it has a value of 1 or 0. Actually in C it is an unsigned char that can be evaluated as a boolean. So assuming your second joy is connected to port 2 of your OI:

if (p2_aux1)
{
pwm04 = 254; // full forward
} else
{
pwm04 = 127; //stop
}

For your pwm05 motor: Now you have to realize that moving the joy stick around returns a value of 0 to 254. When the joys are calibrated correctly, the center position should return p2_x = 127 and p2_y = 127:

// This makes your pwm05 speed proportional to joy position with a
// deadband that alleviates accidental actuation (147 - 107 sets
// pwm05 to 127;
if (p2_y > 147 || p2_y < 107)
{
pwm05 = p2_y;
} else
{
pwm05 = 127;
}

Alternatively if you just want to turn the motor on full blast:

if (p2_y > 147)
{
pwm05 = 254;
} else if (p2_y < 107)
{
pwm05 = 0;
} else
{
pwm05 = 127;
}

Notice all the examples have a way to stop the motor. Generally you want to send all your motors a 127 when the controls are released. This is especially important for the drive motors so that if the driver releases the controls for some reason (knocked senseless by a poof ball!) the robot will stop in a stable configuration.

Good luck!
  #4   Spotlight this post!  
Unread 21-02-2006, 12:52
team 803 team 803 is offline
Wow! a whole week1/2 of experience
FTC #0803 (Hawks)
Team Role: Programmer
 
Join Date: Feb 2006
Location: Hanahan SC
Posts: 37
team 803 is an unknown quantity at this point
Re: Controlling

I put this code in
pwm01 = Limit_Mix(2000 + p1_y + p1_x - 127);
pwm02 = Limit_Mix(2000 + p1_y - p1_x + 127);
and got this error
H:\Project\Project\user_routines.c:139:Error: syntax error
__________________
"Vir prudens non contra ventum mingit"
"Machina improba! Vel mihi ede potum vel mihi redde nummos meos!"
  #5   Spotlight this post!  
Unread 21-02-2006, 12:59
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Controlling

I dont see anything wrong with those two lines of code

I think the error message is telling you there is a syntax error on line 139 of your code?

check your code and see what is on line 139
  #6   Spotlight this post!  
Unread 21-02-2006, 13:02
team 803 team 803 is offline
Wow! a whole week1/2 of experience
FTC #0803 (Hawks)
Team Role: Programmer
 
Join Date: Feb 2006
Location: Hanahan SC
Posts: 37
team 803 is an unknown quantity at this point
Re: Controlling

hmmm, my friend decided that it would be nice to insert a random period in the file.
__________________
"Vir prudens non contra ventum mingit"
"Machina improba! Vel mihi ede potum vel mihi redde nummos meos!"
  #7   Spotlight this post!  
Unread 21-02-2006, 13:03
team 803 team 803 is offline
Wow! a whole week1/2 of experience
FTC #0803 (Hawks)
Team Role: Programmer
 
Join Date: Feb 2006
Location: Hanahan SC
Posts: 37
team 803 is an unknown quantity at this point
Re: Controlling

Where would I insert the code for the 04 and 05 code lines?
__________________
"Vir prudens non contra ventum mingit"
"Machina improba! Vel mihi ede potum vel mihi redde nummos meos!"
  #8   Spotlight this post!  
Unread 21-02-2006, 13:15
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Controlling

right after the other lines you added/edited.

also search your code for those pwms to make sure they dont get set to 127 right before the serial output.

If there are more than one pwm0x = nnn assignments in your code, the last one is the one that takes effect.
  #9   Spotlight this post!  
Unread 21-02-2006, 13:42
team 803 team 803 is offline
Wow! a whole week1/2 of experience
FTC #0803 (Hawks)
Team Role: Programmer
 
Join Date: Feb 2006
Location: Hanahan SC
Posts: 37
team 803 is an unknown quantity at this point
Re: Controlling

Okay, I put it all in, and built it, this error came up.
H:\Project\Project\user_routines.c:230:Error [1105] symbol 'p2_aux1' has not been defined
__________________
"Vir prudens non contra ventum mingit"
"Machina improba! Vel mihi ede potum vel mihi redde nummos meos!"
  #10   Spotlight this post!  
Unread 21-02-2006, 13:50
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Controlling

look at the default code and see what the exact variable name is. I dont know off the top of my head, it should be something like p2_sw_aux1 ?
  #11   Spotlight this post!  
Unread 21-02-2006, 13:56
team 803 team 803 is offline
Wow! a whole week1/2 of experience
FTC #0803 (Hawks)
Team Role: Programmer
 
Join Date: Feb 2006
Location: Hanahan SC
Posts: 37
team 803 is an unknown quantity at this point
Re: Controlling

Well, I was just informed that that code will not be needed, Thx for the help







Cheers!
__________________
"Vir prudens non contra ventum mingit"
"Machina improba! Vel mihi ede potum vel mihi redde nummos meos!"
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Controlling visibility of cells in Excel sanddrag IT / Communications 5 05-01-2006 02:45
Problem controlling a servo Entropia Programming 2 18-06-2005 18:36
controlling just x or y axis of a double articulated arm Leav Programming 8 06-02-2005 14:50
Legality of controlling 2 cylinders with 1 solenoid mtangolics Pneumatics 4 19-02-2004 21:29
Controlling Arm travel - Limit Switch or Mechanical Stop? archiver 2001 8 23-06-2002 23:55


All times are GMT -5. The time now is 21:57.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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