Go to Post Defense will be everybody's part time job, not their career. - Wayne TenBrink [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
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 30-01-2015, 18:55
Dolphin07 Dolphin07 is offline
Registered User
FRC #5568 (Solid Rock)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Arkansas
Posts: 9
Dolphin07 is an unknown quantity at this point
Lightbulb Encoder in Autonomous

We are trying to code a motor in autonomous using an encoder. We aren't getting any feedback from the encoder in autonomous, but we are in teleop. Any suggestions?
Attached Thumbnails
Click image for larger version

Name:	code pic.JPG
Views:	96
Size:	22.3 KB
ID:	18064  
Reply With Quote
  #2   Spotlight this post!  
Unread 30-01-2015, 19:04
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,731
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Encoder in Autonomous

Is this the code you dropped into Autonomous?
Did you add a loop (with a Wait please)? Otherwise it gets called a single time, then never again in Autonomous.
Without an Autonomous loop your Arm will just keep running forever.

Teleop itself gets called every 20ms (optimally), so this code in Teleop gets called over and over again.
Autonomous is called only once, and you have to supply your own loops to keep it going and checking.


I'd also call Config Timer once in Begin, rather than every time you get an encoder value.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 30-01-2015 at 19:09.
Reply With Quote
  #3   Spotlight this post!  
Unread 11-02-2015, 19:37
Dolphin07 Dolphin07 is offline
Registered User
FRC #5568 (Solid Rock)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Arkansas
Posts: 9
Dolphin07 is an unknown quantity at this point
Re: Encoder in Autonomous

Thank you! We ended up putting a while loop in and it works! Another problem that we are now having is that autonomous mode only runs when timed tasks is disabled. Do you have any ideas of why this is happening or a way to fix it?
Reply With Quote
  #4   Spotlight this post!  
Unread 12-02-2015, 12:41
aeastet aeastet is offline
Programming Mentor
AKA: Tim Easterling
FRC #6043 (Allegan Tigers Robotics)
Team Role: Coach
 
Join Date: Jan 2015
Rookie Year: 2011
Location: Holland, MI
Posts: 116
aeastet is an unknown quantity at this point
Re: Encoder in Autonomous

You are probably talking to two things at the same time. Look for motor control or other things that require in input to go or react. If you post both we can take a look and help.
Reply With Quote
  #5   Spotlight this post!  
Unread 12-02-2015, 12:45
aeastet aeastet is offline
Programming Mentor
AKA: Tim Easterling
FRC #6043 (Allegan Tigers Robotics)
Team Role: Coach
 
Join Date: Jan 2015
Rookie Year: 2011
Location: Holland, MI
Posts: 116
aeastet is an unknown quantity at this point
Re: Encoder in Autonomous

If you do not want everyone to see your code you can email me and I can look through it and give some help. Just message me if you want so help.
Reply With Quote
  #6   Spotlight this post!  
Unread 12-02-2015, 14:21
Dolphin07 Dolphin07 is offline
Registered User
FRC #5568 (Solid Rock)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Arkansas
Posts: 9
Dolphin07 is an unknown quantity at this point
Re: Encoder in Autonomous

Here are pictures of the timed tasks code and the beginning of autonomous. In auto, we're reading buttons from the dashboard to select which version of the code to run, and positions from the driver station as well.
Thank you.
Attached Thumbnails
Click image for larger version

Name:	Auto.JPG
Views:	32
Size:	126.9 KB
ID:	18306  Click image for larger version

Name:	Timed Tasks.JPG
Views:	32
Size:	64.3 KB
ID:	18307  
Reply With Quote
  #7   Spotlight this post!  
Unread 12-02-2015, 14:36
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,731
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Encoder in Autonomous

By setting the Arm motor in two places at the same time the latest set wins.
That would be Periodic (Timed) Tasks because it reSets the motor every 10ms.

You have to set it in only one place.
Generally, I'd say have Autonomous set a Global variable that Timed Tasks reads and acts on.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #8   Spotlight this post!  
Unread 12-02-2015, 14:41
Dolphin07 Dolphin07 is offline
Registered User
FRC #5568 (Solid Rock)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Arkansas
Posts: 9
Dolphin07 is an unknown quantity at this point
Re: Encoder in Autonomous

How would you suggest doing that?
Reply With Quote
  #9   Spotlight this post!  
Unread 12-02-2015, 15:16
aeastet aeastet is offline
Programming Mentor
AKA: Tim Easterling
FRC #6043 (Allegan Tigers Robotics)
Team Role: Coach
 
Join Date: Jan 2015
Rookie Year: 2011
Location: Holland, MI
Posts: 116
aeastet is an unknown quantity at this point
Re: Encoder in Autonomous

You are starting things in multiple places. If you start the encoder in the periodic tasks then you do not need to do it in the auto loop too. You just need to get the value from the to the Autonomous code. That can be done with a global variable.

Click image for larger version

Name:	Timed Tasks.png
Views:	34
Size:	441.7 KB
ID:	18308
Reply With Quote
  #10   Spotlight this post!  
Unread 12-02-2015, 22:01
Dolphin07 Dolphin07 is offline
Registered User
FRC #5568 (Solid Rock)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Arkansas
Posts: 9
Dolphin07 is an unknown quantity at this point
Re: Encoder in Autonomous

We put the code in teleop like you suggested and it worked wonderfully! Thanks for the help!
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 03: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