Go to Post Code doesn't break. It reacts exactly the same time every time. When something new happens that never happened before, it's because the mechanicals, electricals or drivers gave the code some new stimulus that wasn't tested before. - GaryVoshol [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 08-11-2007, 13:21
youngWilliam14's Avatar
youngWilliam14 youngWilliam14 is offline
Team 461 Electrician and Operator
AKA: Will Crabtree
FRC #0461 (Westside Boiler Invasion)
Team Role: Electrical
 
Join Date: Jan 2007
Rookie Year: 2006
Location: West Lafayette, IN
Posts: 184
youngWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud of
Send a message via AIM to youngWilliam14
programing the vex optical shaft encoder

i'm having a small problem w/ optical shaft encoders on the vex swervebot i'm building. the encoders tell the rc how far the drive pods have turned.

in the program, i start all the encoders, and have them retrive to variables. once the vairables reach a the right value, the pods stop turning, then i reset the variables when the pods need to turn back.

my problem is that i allign all the pods, but when i test the program, they don't all turn the same amount, so they're off when they come back. i think it might be how i set up the motors to run.

can anyone help me fix this? i'm including a copy of my code
Attached Files
File Type: zip swervebot.zip (2.2 KB, 184 views)
__________________

"C.N.C." lyrics/"Driving on Regolith" lyrics
Let's all go nuts! Robots! Robots!--Team 461 chant
  #2   Spotlight this post!  
Unread 08-11-2007, 16:42
JamesBrown JamesBrown is offline
Back after 4 years off
FRC #5279
Team Role: Engineer
 
Join Date: Nov 2004
Rookie Year: 2005
Location: Lynchburg VA
Posts: 1,280
JamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond repute
Re: programing the vex optical shaft encoder

I may be able to help, however I think we need to know a little more about your bot, for example does one motor turn all of the pods or do they turn seperately, also how much different is the amount that the encoders report and how much different is the amount that the actual pods turn.

I tried to look at your code but the file formats are .bds and .ecp which I don't recognize at all, I assume you are using easy C but is there any way you can give us .c or just txt files?
__________________
I'm Back


5279 (2015-Present)
3594 (2011)
3280 (2010)
1665 (2009)
1350 (2008-2009)
1493 (2007-2008)
1568 (2005-2007)
  #3   Spotlight this post!  
Unread 08-11-2007, 22:33
youngWilliam14's Avatar
youngWilliam14 youngWilliam14 is offline
Team 461 Electrician and Operator
AKA: Will Crabtree
FRC #0461 (Westside Boiler Invasion)
Team Role: Electrical
 
Join Date: Jan 2007
Rookie Year: 2006
Location: West Lafayette, IN
Posts: 184
youngWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud of
Send a message via AIM to youngWilliam14
Re: programing the vex optical shaft encoder

umm, i'm not sure. the pods turn on separate motors, but all the encoders are mounted exactly the same
__________________

"C.N.C." lyrics/"Driving on Regolith" lyrics
Let's all go nuts! Robots! Robots!--Team 461 chant
  #4   Spotlight this post!  
Unread 09-11-2007, 10:50
charrisTTI charrisTTI is offline
Ramblin' Wreck
AKA: Charles Harris
FRC #0623
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2003
Location: Vienna, VA
Posts: 106
charrisTTI has a spectacular aura aboutcharrisTTI has a spectacular aura about
Send a message via AIM to charrisTTI
Re: programing the vex optical shaft encoder

your program assumes that all the motors go exactly the same speed and stop/start immediately.

you need to take inertia of your system into account.

looks like a typo for the compare value of rot_encoder2: rot_encoder2 < 2 should probably be rot_encoder2 < 20 (in several places)

try evaluating each encoder value separately and turn the corresponding motor off when that encoder reaches the desired value.

you may also need to accelerate and decelerate the motors rather than just a hard stop and start to reduce overshoot.
__________________
FRC 623 2003,2004,2005,2006,2007,2008, 2009, 2010, 2011
FRC 1900 2007
FVC 60 and 193 2006
FVC 3271 2007
FTC 226 and 369 2008, 2009, 2010, 2011
FTC 3806 2010
  #5   Spotlight this post!  
Unread 09-11-2007, 13:32
youngWilliam14's Avatar
youngWilliam14 youngWilliam14 is offline
Team 461 Electrician and Operator
AKA: Will Crabtree
FRC #0461 (Westside Boiler Invasion)
Team Role: Electrical
 
Join Date: Jan 2007
Rookie Year: 2006
Location: West Lafayette, IN
Posts: 184
youngWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud of
Send a message via AIM to youngWilliam14
Re: programing the vex optical shaft encoder

thanks, i just copy/paseted that part of the code ^.^;

how do i get the motors to accelerate/decellerate? i don't have to put in a bunch of blocks stepping up to the speed i want, do i?
__________________

"C.N.C." lyrics/"Driving on Regolith" lyrics
Let's all go nuts! Robots! Robots!--Team 461 chant
  #6   Spotlight this post!  
Unread 09-11-2007, 14:04
youngWilliam14's Avatar
youngWilliam14 youngWilliam14 is offline
Team 461 Electrician and Operator
AKA: Will Crabtree
FRC #0461 (Westside Boiler Invasion)
Team Role: Electrical
 
Join Date: Jan 2007
Rookie Year: 2006
Location: West Lafayette, IN
Posts: 184
youngWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud of
Send a message via AIM to youngWilliam14
Re: programing the vex optical shaft encoder

ok now i have another problem:

Code:
while (swerve == 0)
{
      Tank4 (0 , 2 , 2 , 3 , 4 , 1 , 2 , 1 , 0 , 1 , 0);
       swerve = GetRxInput (1 , 5);
}
the variable 'swerve' is set to 0 when i press the lower ch. 5 button. i'm still holding the button down when i get to this part of the code, but it skips the while loop and goes right to trying to turn the wheels back to zero. does anyone know why the loop gets skipped, even though the value of 'swerve' is still 0? the only reason why the program gets to that point is because it's allredy checked to see if the button is being pressed
__________________

"C.N.C." lyrics/"Driving on Regolith" lyrics
Let's all go nuts! Robots! Robots!--Team 461 chant

Last edited by youngWilliam14 : 09-11-2007 at 14:07.
  #7   Spotlight this post!  
Unread 09-11-2007, 14:15
JamesBrown JamesBrown is offline
Back after 4 years off
FRC #5279
Team Role: Engineer
 
Join Date: Nov 2004
Rookie Year: 2005
Location: Lynchburg VA
Posts: 1,280
JamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond repute
Re: programing the vex optical shaft encoder

Quote:
Originally Posted by youngWilliam14 View Post
ok now i have another problem:

Code:
while (swerve == 0)
{
      Tank4 (0 , 2 , 2 , 3 , 4 , 1 , 2 , 1 , 0 , 1 , 0);
       swerve = GetRxInput (1 , 5);
}
the variable 'swerve' is set to 0 when i press the lower ch. 5 button. i'm still holding the button down when i get to this part of the code, but it skips the while loop and goes right to trying to turn the wheels back to zero. does anyone know why the loop gets skipped, even though the value of 'swerve' is still 0? the only reason why the program gets to that point is because it's allredy checked to see if the button is being pressed
Can you post the code that comes right before this loop? the syntax of the loop looks fine so if it is actually missing the loop the problem is probably occurring before it reaches it. To test this put a printf right before the loop, one right in the loop and one after the loop this will let you know whether the problem is the code not stepping into the loop or if the problem occurs somewhere else.

I still can't read the rest of your code since I don't have EasyC on my laptop but it sounds like you are just driving the motors until you get to a certain number of pulses from the encoder then stopping them. If this is the case you may be able to get (read as will get) better results if you use PID control (or any of many other control algorithms) there is a code paper on here that outlines how to do it, I'll find it and edit this post with a link as soon as I can.

James

http://www.chiefdelphi.com/media/papers/1823 - That is a good reference to get you started on PID control if you have never used it before.
__________________
I'm Back


5279 (2015-Present)
3594 (2011)
3280 (2010)
1665 (2009)
1350 (2008-2009)
1493 (2007-2008)
1568 (2005-2007)

Last edited by JamesBrown : 09-11-2007 at 14:20. Reason: Found the white paper
  #8   Spotlight this post!  
Unread 09-11-2007, 14:23
youngWilliam14's Avatar
youngWilliam14 youngWilliam14 is offline
Team 461 Electrician and Operator
AKA: Will Crabtree
FRC #0461 (Westside Boiler Invasion)
Team Role: Electrical
 
Join Date: Jan 2007
Rookie Year: 2006
Location: West Lafayette, IN
Posts: 184
youngWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud of
Send a message via AIM to youngWilliam14
Re: programing the vex optical shaft encoder

ok, i put in print statements before, in, and after the loop. before the loop, 'swerve' is zero. the first time though the loop, it's still zero, but the second time through it says 127!?!? so it quits the loop.


***EDIT***
i forgot to say that the print statement in the loop is AFTER it checks for the button
__________________

"C.N.C." lyrics/"Driving on Regolith" lyrics
Let's all go nuts! Robots! Robots!--Team 461 chant

Last edited by youngWilliam14 : 10-11-2007 at 13:24.
  #9   Spotlight this post!  
Unread 10-11-2007, 14:53
JamesBrown JamesBrown is offline
Back after 4 years off
FRC #5279
Team Role: Engineer
 
Join Date: Nov 2004
Rookie Year: 2005
Location: Lynchburg VA
Posts: 1,280
JamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond reputeJamesBrown has a reputation beyond repute
Re: programing the vex optical shaft encoder

Quote:
Originally Posted by youngWilliam14 View Post
ok, i put in print statements before, in, and after the loop. before the loop, 'swerve' is zero. the first time though the loop, it's still zero, but the second time through it says 127!?!? so it quits the loop.


***EDIT***
i forgot to say that the print statement in the loop is AFTER it checks for the button
Assuming swerve is defined as a char then that makes sense, it should equal 127 if the button is pushed.
__________________
I'm Back


5279 (2015-Present)
3594 (2011)
3280 (2010)
1665 (2009)
1350 (2008-2009)
1493 (2007-2008)
1568 (2005-2007)
  #10   Spotlight this post!  
Unread 10-11-2007, 19:53
youngWilliam14's Avatar
youngWilliam14 youngWilliam14 is offline
Team 461 Electrician and Operator
AKA: Will Crabtree
FRC #0461 (Westside Boiler Invasion)
Team Role: Electrical
 
Join Date: Jan 2007
Rookie Year: 2006
Location: West Lafayette, IN
Posts: 184
youngWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud of
Send a message via AIM to youngWilliam14
Re: programing the vex optical shaft encoder

Quote:
Originally Posted by JamesBrown View Post
Assuming swerve is defined as a char then that makes sense, it should equal 127 if the button is pushed.
ok, i'll try that. it's defined as an integer right now
__________________

"C.N.C." lyrics/"Driving on Regolith" lyrics
Let's all go nuts! Robots! Robots!--Team 461 chant
  #11   Spotlight this post!  
Unread 11-11-2007, 16:16
youngWilliam14's Avatar
youngWilliam14 youngWilliam14 is offline
Team 461 Electrician and Operator
AKA: Will Crabtree
FRC #0461 (Westside Boiler Invasion)
Team Role: Electrical
 
Join Date: Jan 2007
Rookie Year: 2006
Location: West Lafayette, IN
Posts: 184
youngWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud ofyoungWilliam14 has much to be proud of
Send a message via AIM to youngWilliam14
Re: programing the vex optical shaft encoder

defining it as character made the program not record the value, but i fixed the loop thing

i still need a way to get evrything to turn the same amount though
__________________

"C.N.C." lyrics/"Driving on Regolith" lyrics
Let's all go nuts! Robots! Robots!--Team 461 chant
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
Problem using VEX shaft encoder jskene Programming 15 28-10-2007 22:33
VEX Shaft Encoder Kit jeffmorris FIRST Tech Challenge 1 19-05-2006 12:23
VEX Optical Shaft encoders in FRC sanddrag FIRST Tech Challenge 8 04-10-2005 07:52
Hollow Shaft optical encoders magical hands Robotics Education and Curriculum 0 03-02-2005 22:56
Rotary Encoder (optical etc.) Gary C Technical Discussion 4 16-01-2005 18:23


All times are GMT -5. The time now is 03:29.

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