Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Inovation First FRC Robot Controller (http://www.chiefdelphi.com/forums/showthread.php?t=105817)

Mark McLeod 22-04-2012 18:29

Re: Inovation First FRC Robot Controller
 
For the Watson code you're using, the analog inputs are read like this:
Code:

unsigned int myinput;

myinput = Quick_ADC(1);

The Get_Analog_Value() function that I mentioned before is what's used with the IFI default code. I forgot at the time that you weren't using the default code.

SeanPerez 22-04-2012 19:04

Re: Inovation First FRC Robot Controller
 
but how would i read from Analog-in 1? what do i change to read from other inputs?

would "myinput" be the input value? what input is it of?

plnyyanks 22-04-2012 19:56

Re: Inovation First FRC Robot Controller
 
Quote:

Originally Posted by SeanPerez (Post 1161481)
but how would i read from Analog-in 1? what do i change to read from other inputs?

would "myinput" be the input value? what input is it of?

"myinput" is the value of the analog input

you call Quick_ADC(n); where n=the number of the analog input you wish to read.

so, analog1Val = Quick_ADC(1);
analog2Val = Quick_ADC(2);
analog3Val = Quick_ADC(3);
...and so on

SeanPerez 22-04-2012 20:26

Re: Inovation First FRC Robot Controller
 
Thanks
I thought it was so. i just wanted clarification.

SeanPerez 22-04-2012 20:57

Re: Inovation First FRC Robot Controller
 
Why exactly cant delays be used on these controllers?

plnyyanks 22-04-2012 21:28

Re: Inovation First FRC Robot Controller
 
It's not that you can't use delays - it's just not a bright idea given the structure of the code. The code executes in an infinite while loop, which runs once every ~26 milliseconds - this is how often the master processor gives the user processor new data to work with. You want your robot code to execute in less than that time, otherwise there will be data available to process that won't be processed because your code is still executing the preceding iteration (with old data). It's akin to putting long loops/delays in the teleop code with the current control system - you'll miss packets from the DS and have considerable lag (at least with LabVIEW, not sure about cpp/java).

It's not a matter of the controller's ability to work with delays, but rather a matter of processing without missing input values. So try to avoid long delays and make sure your code executes in <26.2 ms.

general disclaimer: IFI control systems are from before my time with FRC, just keep that in mind; however, I've spend lots of time understanding the control system and have used it with modest success

SeanPerez 22-04-2012 21:48

Re: Inovation First FRC Robot Controller
 
is there a way that i can remove things or modifiy things in the code to make it faster? so maybe running once every ~14 milliseconds instead of 26 milliseconds? If so, how can this be achieved?

plnyyanks 22-04-2012 21:54

Re: Inovation First FRC Robot Controller
 
Well, you can't make the master processor send data any faster than it already does.

If you're using Kevin's code, then you can put code in Teleop_Spin(), which is called every iteration of teleop (as opposed to Teleop(), which is called only upon the arrival of new data - see the main() routine in ifi_frc.c). There are also Disabled_Spin() and Autonomous_Spin() for the appropriate modes, defined in the appropriate files.

If you using the "standard" default code, you can modify user_routines_fast.c as a place to put code that executes much faster.

The obligatory efficiency question: do you really need your code to run that much faster? In many situations, that much saved time doesn't make much of a difference. Just a thing to keep in mind - especially since these controllers have limited resources (which I don't remember off the top of my head).

Kevin Watson 04-05-2012 22:57

Re: Inovation First FRC Robot Controller
 
Quote:

Originally Posted by SeanPerez (Post 1161667)
is there a way that i can remove things or modifiy things in the code to make it faster? so maybe running once every ~14 milliseconds instead of 26 milliseconds? If so, how can this be achieved?

The "ifi_clock.zip" example code will give you millisecond timing accuracy. It can be found here:

http://kevin.org/frc/

Back in the archived 2005 code you'll find an example for the old EDU-RC controller that implements the functionality of a wall clock. The internal state machine may be of interest.

-Kevin

randalcr 10-07-2013 11:40

Re: Inovation First FRC Robot Controller
 
First, sorry to revive an old and dead thread. I'm trying to find information about the IFI controllers and so far what I have found is fairly limited. What I really am trying to find out is whether there are any data-flow or non-text based programming methods for the old FRC control system, something simliar to labview is really what I want, as I hate text based coding. If there are no other methods that can be used I can suck it up and use the tools mentioned in the thread.

Thanks.

protoserge 10-07-2013 12:10

Re: Inovation First FRC Robot Controller
 
Quote:

Originally Posted by randalcr (Post 1281817)
First, sorry to revive an old and dead thread. I'm trying to find information about the IFI controllers and so far what I have found is fairly limited. What I really am trying to find out is whether there are any data-flow or non-text based programming methods for the old FRC control system, something simliar to labview is really what I want, as I hate text based coding. If there are no other methods that can be used I can suck it up and use the tools mentioned in the thread.

Thanks.

They were C or Basic code and programmed via a typical compiler process as far as I know.

You may be better suited getting an Arduino solution and using ArduBlock (on SourceForge). Additionally, you can get an Arduino and use the LabVIEW Arduino toolkit. I'm not sure if the toolkit works with the FRC version of LabVIEW or if you need to buy the package through SparkFun.

randalcr 10-07-2013 12:25

Re: Inovation First FRC Robot Controller
 
C or Basic as in either could be used? I do have an arduino that I have been playing with, along with the labview toolkit. The arduino and toolkit work pretty well it's just that the toolkit is kind of limited for what I would like to do, but with some more time messing with it I think I can figure it out.

Would i be able to swap the robot processor out for the arduino and still be able to use the IFI DS and radio set?

Thanks.

protoserge 10-07-2013 12:45

Re: Inovation First FRC Robot Controller
 
Quote:

Originally Posted by randalcr (Post 1281823)
C or Basic as in either could be used? I do have an arduino that I have been playing with, along with the labview toolkit. The arduino and toolkit work pretty well it's just that the toolkit is kind of limited for what I would like to do, but with some more time messing with it I think I can figure it out.

Would i be able to swap the robot processor out for the arduino and still be able to use the IFI DS and radio set?

Thanks.

It depends on which year. In my senior year, they introduced the ability to program in C. That's about all I know with regards to programming.

I don't know how the IFI DS and radio function. I am fairly certain the modem was a standard RS-232 900 MHz serial port radio modem, so you could just plug the TX and RX into the Arduino's respective pins (look up how to do serial port communication with Arduino). You may have to decode how the DS sends commands over serial.

That's about the extent of my IFI controller knowledge. I'm sure the others will chime in more information.

randalcr 10-07-2013 14:00

Re: Inovation First FRC Robot Controller
 
My team has at least one from every year I think, so Im sure there will be one or two at least that are Basic capable.

Thanks for that, I think it should be fairly easy to at least try to rig something up and see if I can figure out whether or not that would work.

Thanks.

Mark McLeod 10-07-2013 14:02

Re: Inovation First FRC Robot Controller
 
The pBasic versions of the IFI robot controller (2000-2003) will have two DB25 connectors.

The C versions of the IFI robot controller (2004-2008) have banks of 3-pin headers instead.

The Ewave SCREAMER422 radios or the later (2007-2008) and bulkier IFI radios can be used with other equipment, but you'll have to write some code to handle the RS-422 I/O.
see the Ewave specs.

Packets:
Whenever two consecutive 0xFF bytes are received it is considered a packet header, and any prior bytes that were being assembled into a packet are discarded. The receiving modem then starts assembling the latest 26 byte packet. Only when a complete packet has been fully received is it sent out the receiving modem's RS-422 connection. The OI/RC software makes sure no packet has consecutive 0xFF's in the 24 byte data portion of the packet, otherwise, no complete packet will ever get through. This is why you'll never see a joystick or PWM output value of 255 coming out of the IFI OI. Any 255's set by the user code or detected on an OI analog input are converted into 254's by the RC master processor and the OI processor instead. For Robot Control & Telemetry (FIRST), the modems are set for "RM2000" or fixed-length, 26-byte packets with no retries, therefore, no CRC check is performed on the transmitted data packets.
The Radio Packet size is fixed at 26 bytes long. The packet format is:
  • 0xFF, 0xFF (always a packet header)
  • data bytes 1 through 24


All times are GMT -5. The time now is 20:14.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi