Go to Post Be yourself and do what you love. - Greg Marra [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 11-02-2015, 05:10
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 : 11-02-2015 at 05:18.
Reply With Quote
 


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 00:42.

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