Go to Post Chief Delphi down for a few hours ON A WEEKEND??? This is MADNESS! - [more]
Home
Go Back   Chief Delphi > Other > FIRST Tech Challenge
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 02-02-2011, 11:34
JohnFogarty's Avatar
JohnFogarty JohnFogarty is offline
Trapped under a pile of MECANUMS :P
AKA: @doctorfogarty
FTC #11444 (Garnet Squadron) & FRC#1102 (M'Aiken Magic)
Team Role: Mentor
 
Join Date: Aug 2009
Rookie Year: 2006
Location: SC
Posts: 1,573
JohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond reputeJohnFogarty has a reputation beyond repute
[FTC]: DC MotorEncoder Code

So in the instance of having servos, those servos have set positions you can send them to. What I want to do is tell a motor to go to specific encoder positions in robotC. I haven't the slightest clue how to begin doing that. My goal is to push a button and have an arm powered by a motor go to a certain position and stop or keep a low level of power to keep it locked in that position until the button isn't pressed.
Thank You.
John Fogarty
__________________
John Fogarty
2010 FTC World Championship Winner & 2013-2014 FRC Orlando Regional Winner
Mentor FRC Team 1102 M'Aiken Magic
"Head Bot Coach" FTC Team 11444 Garnet Squadron
Former Student & Mentor FLL 1102, FTC 1102 & FTC 3864, FRC 1772, FRC 5632
2013 FTC World Championship Guest Speaker
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2011, 19:15
normalmutant's Avatar
normalmutant normalmutant is offline
Registered User
AKA: Nathan
FTC #3539 (Say Watt?)
Team Role: Alumni
 
Join Date: Apr 2010
Rookie Year: 2006
Location: Edison, NJ
Posts: 126
normalmutant has a spectacular aura aboutnormalmutant has a spectacular aura about
Re: [FTC]: DC MotorEncoder Code

Here's one way to do it:
Have the motor move back until it hits a touch sensor. Set the input from the encoder as the zero position (store it in a variable) and move the motor forward to the encoder position you want, plus the zero value.
We did this to align a dispenser tread on our old robot. If it doesn't rotate all the way around, you may not have to do this.
__________________
SAY-WATT.ORG
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2011, 21:43
normalmutant's Avatar
normalmutant normalmutant is offline
Registered User
AKA: Nathan
FTC #3539 (Say Watt?)
Team Role: Alumni
 
Join Date: Apr 2010
Rookie Year: 2006
Location: Edison, NJ
Posts: 126
normalmutant has a spectacular aura aboutnormalmutant has a spectacular aura about
Re: [FTC]: DC MotorEncoder Code

Oh, actually, you could just reset the encoder using the software when it hits the touch sensor. Sorry, I'm a hardware guy. I was unsure about my last post, so I read our team's own tutorial on using them.
http://say-watt.org/wp2/archives/391
__________________
SAY-WATT.ORG
Reply With Quote
  #4   Spotlight this post!  
Unread 04-02-2011, 02:42
Tim Delles's Avatar
Tim Delles Tim Delles is offline
Since 2001.
FRC #0078
Team Role: Mentor
 
Join Date: Dec 2004
Rookie Year: 2001
Location: Providence, RI
Posts: 1,002
Tim Delles has a reputation beyond reputeTim Delles has a reputation beyond reputeTim Delles has a reputation beyond reputeTim Delles has a reputation beyond reputeTim Delles has a reputation beyond reputeTim Delles has a reputation beyond reputeTim Delles has a reputation beyond reputeTim Delles has a reputation beyond reputeTim Delles has a reputation beyond reputeTim Delles has a reputation beyond reputeTim Delles has a reputation beyond repute
Re: [FTC]: DC MotorEncoder Code

Code:
nMotorEncoder[motorA] = 0;
wait1Msec(50);
nMotorEncoderTarget[motorA] = x;    <- set this to the number of rotations the Motor Encoder needs to rotate
motor[motorA] = 100;
while ((nMotorRunState[leftMotor] != runStateIdle))
  {
    EndTimeSlice();
  }
  return;
This can only be used if you have a shaft encoder attached to the motor you want to use. Good luck.
__________________
Timothy Delles - Clarkson University
2011 - Present: FRC Team 78 - AIR Strike
2011 - Present: VEX Team 78 - AIR Strike
2010 - 2011: FRC Team 3280 - Rhode Rebels
2001 - 2009: FRC Team 229 - Division By Zero
Reply With Quote
  #5   Spotlight this post!  
Unread 04-02-2011, 14:54
clwillingham clwillingham is offline
Registered User
AKA: Chris 1.0
FTC #2845 (Team Duct Tape)
Team Role: Programmer
 
Join Date: Mar 2010
Rookie Year: 2006
Location: Tampa
Posts: 7
clwillingham is an unknown quantity at this point
Re: [FTC]: DC MotorEncoder Code

another way thats a bit more direct but probably a little bit less reliable in terms of skidding:

Code:
motor[FL] = power;
motor[FR] = power;
motor[BL] = power;
motor[BR] = power;
while(nMotorEncoder[FL] < units){}
Stop(); // we wrote this function to set every motor to 0.
please note that this code is for a four wheel drive robot.
Reply With Quote
Reply


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


All times are GMT -5. The time now is 19:07.

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