Go to Post Math is FUN! - Cynette [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-07-2008, 19:57
king vash king vash is offline
Registered User
FRC #2635 (Hazmat)
Team Role: Programmer
 
Join Date: Jul 2008
Rookie Year: 2007
Location: Oregon
Posts: 4
king vash is an unknown quantity at this point
Detecting Hybrid \ Teleoperated

I can think of a couple obvious ways to tell if your in the hybrid loop but is their a byte or an api you can call to tell? checking if all joystick are 127 works but isn't what I want to do. I also realize that, the hybrid code execution execution is an indicator.

My problem is that I want to use the same code in the hybrid and teleoperated loop and it would be nice to know which one I'm in with out having to rely on joysticks being uncalibrated \ wiggled.
  #2   Spotlight this post!  
Unread 10-07-2008, 21:36
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: Detecting Hybrid \ Teleoperated

From what you say, I think the easiest thing to do is place any shared code into a function, then call that function from both the teleop and hybrid loops. If you need to, you could pass hybrid or teleop as a param to the function.

If you have other plans, you can use these functions/variables to get state info.

In EasyC

Code:
IsEnabled(); //In menu as Controller state
IsAutonomous(); //In menu as Competition state
In MPLab

Code:
autonomous_mode; //Defined in ifi_defaults.h
//For disabled there are previous discussions.
__________________
Eric Haskins KC9JVH
  #3   Spotlight this post!  
Unread 10-07-2008, 21:38
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 688
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: Detecting Hybrid \ Teleoperated

Not that I'll have much of an answer, but the first question that will come to mind from everyone here is what programming/compiler are you using, and what version. MPLAB has two "out of the box" versions by Kevin Watson (Kevin.org -- whoa! New picture Kevin!), and Easy C. Both of them (if I remember correctly: it's been a couple of months from robo-programming) keep the hybrid/teleop mode switch out of the hands of the programmer and jumps to their respective routines and you go from there. For Kevin's 2007-and-earlier MPLAB version, you can see the switch in the main.c routine. But I wouldn't fiddle with it unless you know what you're doing.

Looking over your question again, if you want to use the "same code" for both modes, if that is what you're asking: Hybrid and teleop start in different routines. Can they not call the same routine(s) from there? And as one uses joysticks and the other (presumably) does some program-operated thinking, the stuff that is different will be in their own starting routine before or after they call the common routine(s).

Of course, this is all changing for 2009 as there is a new controller and new software coming out (hopefully before Kickoff ).

And naturally, Eric got in ahead of me, even if you weren't there a second ago!

Last edited by Roger : 10-07-2008 at 21:42. Reason: Shake my puny little fist at Eric!
  #4   Spotlight this post!  
Unread 10-07-2008, 21:44
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Detecting Hybrid \ Teleoperated

In the IFI code, you can use the value of autonomous_mode. It'll be 0 when in teleoperated, and 1 in autonomous/hybrid.
  #5   Spotlight this post!  
Unread 14-07-2008, 13:15
king vash king vash is offline
Registered User
FRC #2635 (Hazmat)
Team Role: Programmer
 
Join Date: Jul 2008
Rookie Year: 2007
Location: Oregon
Posts: 4
king vash is an unknown quantity at this point
Re: Detecting Hybrid \ Teleoperated

Thanks to everyone that responded! Using autonomous_mode I have been able to implement what I wanted on the IFI controller
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Detecting Start of TeleOp Mode Danny Diaz Programming 4 26-02-2008 01:37
Keepers in Teleoperated mode burkey_turkey Rules/Strategy 47 05-03-2007 12:56
detecting life in batteries wkethman Electrical 5 07-03-2006 08:04
Detecting and handling sensor failure gracefully mtrawls Programming 9 20-04-2004 17:19
How do you tell whether your sensor is detecting a crate or the diamond plate? Greg Ross Technical Discussion 4 13-01-2003 19:02


All times are GMT -5. The time now is 23:01.

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