Go to Post You don't become great because of your sponsors, you become sponsored because of your greatness. - Bdf809 [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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-11-2015, 05:10 AM
vamfun vamfun is offline
Mentor :Contol System Engineer
AKA: Chris
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 2003
Location: Van Nuys, California
Posts: 182
vamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of light
Send a message via AIM to vamfun
Trouble getting encoder output to work with analog trigger sources

Hi all,
We are using two analog ports on RoboRio to read a grey hill encoder. We set up some analog triggers which tested ok by themselves. When we try to use them as DigitalSource objects for the WPI encoder class it doesn't seem to work.

Does anyone have some C++ code examples of driving encoder software with analog triggers?

We tried something like the following without success.

public class Robot extends IterativeRobot {
...
AnalogInput input1 = new AnalogInput(1);
AnalogInput input2 = new AnalogInput(2);

AnalogTrigger Trigger1 = new AnalogTrigger(input1);
AnalogTrigger Trigger2 = new AnalogTrigger(input2);

AnalogTriggerOutput source1 = new AnalogTriggerOutput(Trigger1,AnalogTriggerType.kRi singPulse);
AnalogTriggerOutput source2 = new AnalogTriggerOutput(Trigger2,AnalogTriggerType.kRi singPulse);

Encoder enc = new Encoder(source1,source2);

* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {


Trigger1.setLimitsVoltage(1.5,3.5);
Trigger2.setLimitsVoltage(1.5,3.5);

/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {

val = enc.Get();


I know .... this isn't our actual code but its representative.
Any ideas??

Last edited by vamfun : 02-11-2015 at 05:18 AM.
Reply With Quote
  #2   Spotlight this post!  
Unread 02-11-2015, 08:39 AM
GeeTwo's Avatar
GeeTwo GeeTwo is online now
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,539
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: Trouble getting encoder output to work with analog trigger sources

The encoder class is intended for sensors which send a signal rather frequently, typically 4 times per motor revolution. I'm not familiar with the sensor you're using but this reads like you're planning to use this to keep an item between boundaries. What are you trying to control, and what does it mean when these trigger values are met?
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #3   Spotlight this post!  
Unread 02-11-2015, 11:10 AM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,999
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Trouble getting encoder output to work with analog trigger sources

Quote:
Originally Posted by vamfun View Post
We are using two analog ports on RoboRio to read a grey hill encoder.
Did you mean Grayhill?

What is the part number of that Grayhill encoder?


Reply With Quote
  #4   Spotlight this post!  
Unread 02-11-2015, 02:54 PM
vamfun vamfun is offline
Mentor :Contol System Engineer
AKA: Chris
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 2003
Location: Van Nuys, California
Posts: 182
vamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of light
Send a message via AIM to vamfun
Re: Trouble getting encoder output to work with analog trigger sources

Quote:
Originally Posted by GeeTwo View Post
The encoder class is intended for sensors which send a signal rather frequently, typically 4 times per motor revolution. I'm not familiar with the sensor you're using but this reads like you're planning to use this to keep an item between boundaries. What are you trying to control, and what does it mean when these trigger values are met?
Using it as a lift encoder. We are out of digital ports so we want to create a digital source for the encoder routine using the analog trigger output. The trigger creates a true pulse when the Greyhill output transitions above 3.5v and a low pulse when below 1.5 volts. We were able to use the trigger output to drive a counter successfully so we know its working. Just doesn't seem to work with the encoder class.
Reply With Quote
  #5   Spotlight this post!  
Unread 02-11-2015, 02:57 PM
vamfun vamfun is offline
Mentor :Contol System Engineer
AKA: Chris
FRC #0599 (Robodox)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 2003
Location: Van Nuys, California
Posts: 182
vamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of lightvamfun is a glorious beacon of light
Send a message via AIM to vamfun
Re: Trouble getting encoder output to work with analog trigger sources

Quote:
Originally Posted by Ether View Post
Did you mean Grayhill?

What is the part number of that Grayhill encoder?



Hi Ether,
Been a long time. I don't recall the part number, but it is a 256 count. The max pulses per second we expect is around 12000. We are using 3 analog ports so we should have a 167000 sample rate on each a/d port since the RoboRio is capable of 500k hz total.

Last edited by vamfun : 02-11-2015 at 03:02 PM.
Reply With Quote
  #6   Spotlight this post!  
Unread 02-11-2015, 03:10 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,999
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Trouble getting encoder output to work with analog trigger sources

Quote:
Originally Posted by vamfun View Post
Hi Ether,
Been a long time.

Yeah, welcome back :-)

You've been gone from CD for what... 2 1/2 years?

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 09:15 AM.

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