![]() |
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. |
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 stateCode:
autonomous_mode; //Defined in ifi_defaults.h |
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! |
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.
|
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
|
| All times are GMT -5. The time now is 12:17. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi