Go to Post And if in the end the students are inspired and more of the public becomes aware of the program, and people gain more appreciation for engineering, how can that not be a good thing? - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 16-02-2013, 14:01
Chris is me's Avatar
Chris is me Chris is me is offline
no bag, vex only, final destination
AKA: Pinecone
FRC #0228 (GUS Robotics); FRC #2170 (Titanium Tomahawks)
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2006
Location: Glastonbury, CT
Posts: 7,710
Chris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond reputeChris is me has a reputation beyond repute
Send a message via AIM to Chris is me
Encoder Doesn't Reset to Zero

We have a strange programming bug that we're a bit stuck on. We have an encoder on a mechanism that we want to reset every time a limit switch is depressed. However, when we depress the limit switch, weird things happen. The printed value of the count from encoder.Get() either just adds a zero to the end of the number or replaces the first digit with zero. For example, numbers like 215 and 217 turn to 015 and 017. Once we break 1000, the number just changes from something like 1300 to 01300, and then begins counting much faster.

We have no idea why this happens or how to fix it. Got any ideas?

Update: We changed the code so that the limit switch reset a drivetrain encoder instead of the mechanism encoder and it worked perfectly. I'll see if we can get code up. I have no idea why this would work for one encoder but not the other.

Update 2: We ruled out a hardware problem by plugging the mechanism encoder into the DT encoder port, it resets in that port fine.
__________________
Mentor / Drive Coach: 228 (2016-?)
...2016 Waterbury SFs (with 3314, 3719), RIDE #2 Seed / Winners (with 1058, 6153), Carver QFs (with 503, 359, 4607)
Mentor / Consultant Person: 2170 (2017-?)
---
College Mentor: 2791 (2010-2015)
...2015 TVR Motorola Quality, FLR GM Industrial Design
...2014 FLR Motorola Quality / SFs (with 341, 4930)
...2013 BAE Motorola Quality, WPI Regional #1 Seed / Delphi Excellence in Engineering / Finalists (with 20, 3182)
...2012 BAE Imagery / Finalists (with 1519, 885), CT Xerox Creativity / SFs (with 2168, 118)
Student: 1714 (2009) - 2009 Minnesota 10,000 Lakes Regional Winners (with 2826, 2470)
2791 Build Season Photo Gallery - Look here for mechanism photos My Robotics Blog (Updated April 11 2014)

Last edited by Chris is me : 16-02-2013 at 14:34.
Reply With Quote
  #2   Spotlight this post!  
Unread 16-02-2013, 20:52
Cel Skeggs Cel Skeggs is offline
Robot Software Manager Alumnus
AKA: Previously known as Colby
FRC #1540 (The Flaming Chickens)
Team Role: Alumni
 
Join Date: Feb 2013
Rookie Year: 2009
Location: Portland, Oregon, USA
Posts: 107
Cel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of lightCel Skeggs is a glorious beacon of light
Re: Encoder Doesn't Reset to Zero

How are you displaying the current encoder value?
This sounds like a common display bug where the line isn't cleared before printing a new number.
If an output contains '217' and '0' is printed without clearing the line, then you'd get '017'.
There are a few ways to fix this (if it is the problem): Clear the line before writing a number, or append spaces to the number that you are printing.
By appending spaces before printing, '217' and '0 ' would be seen as '0' instead of '017'
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 11:49.

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