Go to Post I'm intrigued by the possibility of Mayan stadium sports, minus the whole sacrificing part. - AlecMataloni [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 06-07-2007, 22:50
bglass bglass is offline
Registered User
AKA: Bryan
#1609 (S.W.A.R.M.)
Team Role: Leadership
 
Join Date: Feb 2005
Rookie Year: 2004
Location: St. Louis
Posts: 8
bglass is an unknown quantity at this point
Send a message via AIM to bglass
Question RS232 (Serial) Communication To OI

Hey Everybody,

I am working on a project that is not FIRST related, but figured I would come here for help as I am using the IFI Control System (that you all seem to be so good with). I scoured the forums to try to find some answers to my questions, but as it's not legal in the FIRST competitions, couldn't find much of anything.

What I would like to do is essentially emulate the joysticks (and other input devices that plug into the OI) through my laptop. It seems impractical to hook 4 joysticks and other switches up so that I have enough buttons to perform tasks. Unfortunately, my background in programming is primarily in Java. After doing some research, I decided that programming in C would probably allow me more flexibility and be a bit more universal. I don't need to send extremely complex things to the OI, just the values that would normally be sent via the OI (0-254 for the axis, 0 or 1 for the buttons). I read through some forums on Serial Communication in C, but they seemed far more complex than what I need to do for this project. If somebody would be willing to give me the commands to do this, I would appreciate it. I also don't know some of the information that I anticipate that I will need (Baud Rate, etc).

I imagine that this would also be able to help with FIRST during the off-season. It seems there is always a shortage of joysticks, and this would allow for some easy debugging. Look forward to your responses.

Bryan
  #2   Spotlight this post!  
Unread 06-07-2007, 23:02
bear24rw's Avatar
bear24rw bear24rw is offline
Team 11 Programming Captain
AKA: Max T
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2005
Location: Flanders, NJ
Posts: 385
bear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to behold
Send a message via AIM to bear24rw
Re: RS232 (Serial) Communication To OI

The game ports on the OI (where the joysticks get plugged into) just take digital and analog inputs you could use a microcontroller that interface the digital and analog inputs (i dont remember the name of the device you need to do analog out) but then you could communicate with the micro through serial from a laptop.. might be an easier way (like through the dashboard port) but thats just what i came up with off the top of my head

good luck
  #3   Spotlight this post!  
Unread 06-07-2007, 23:15
lukevanoort lukevanoort is offline
in between teams
AKA: Luke Van Oort
no team
 
Join Date: Oct 2005
Rookie Year: 2005
Location: Waterloo, ON, Canada
Posts: 1,873
lukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond reputelukevanoort has a reputation beyond repute
Send a message via AIM to lukevanoort
Re: RS232 (Serial) Communication To OI

Quote:
Originally Posted by bear24rw View Post
(i dont remember the name of the device you need to do analog out)
I believe Digital Potentiometers (often shortened to didgipots) are what you are referring to.
__________________
Team 1219: 2009 - Mentor
Team 587: 2005 - Animator, 2006-2008 - Team Captain
  #4   Spotlight this post!  
Unread 06-07-2007, 23:40
bglass bglass is offline
Registered User
AKA: Bryan
#1609 (S.W.A.R.M.)
Team Role: Leadership
 
Join Date: Feb 2005
Rookie Year: 2004
Location: St. Louis
Posts: 8
bglass is an unknown quantity at this point
Send a message via AIM to bglass
Re: RS232 (Serial) Communication To OI

Looks like the biggest problem with controlling the OI inputs over RS232 from a laptop is that there is only 1 data pin on the serial protocol. I could spend some extra time writing a simulator for the OI and just use an adapter to run the radio straight from my laptop, but that seems like an excessive amount of work. If anybody knows of a simple way to send different values to the different pins on each port of the OI, let me know. I'd still like to do this (even if slightly impractical) because of the flexibility it will allow me. If I'm able to get it working, I'll write a whitepaper and help anybody get the same system up. Appreciate the help.
  #5   Spotlight this post!  
Unread 07-07-2007, 00:00
bear24rw's Avatar
bear24rw bear24rw is offline
Team 11 Programming Captain
AKA: Max T
FRC #0011 (MORT)
Team Role: Programmer
 
Join Date: Sep 2005
Rookie Year: 2005
Location: Flanders, NJ
Posts: 385
bear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to beholdbear24rw is a splendid one to behold
Send a message via AIM to bear24rw
Re: RS232 (Serial) Communication To OI

What do you mean there is only 1 data pin? And also writing a simulator for the oi would be close ot impossible since we dont have the code for the OI and also the radio is not rs-232 do DO NOT plug it into your computer. I still think just using a simple micro between your rs232 port and the OI gameport ports is your best bet
  #6   Spotlight this post!  
Unread 07-07-2007, 01:42
bglass bglass is offline
Registered User
AKA: Bryan
#1609 (S.W.A.R.M.)
Team Role: Leadership
 
Join Date: Feb 2005
Rookie Year: 2004
Location: St. Louis
Posts: 8
bglass is an unknown quantity at this point
Send a message via AIM to bglass
Re: RS232 (Serial) Communication To OI

Sounds good. Since the consensus seems to be that the microcontroller is the best way to go, I guess I'll have to look into that. If anybody has any suggestions on which to use (or how to get started), please let me know. Best wishes.
  #7   Spotlight this post!  
Unread 07-07-2007, 01:50
Unsung FIRST Hero
Greg Marra Greg Marra is offline
[automate(a) for a in tasks_to_do]
FRC #5507 (Robotic Eagles)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2005
Location: San Francisco, CA
Posts: 2,031
Greg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond reputeGreg Marra has a reputation beyond repute
Re: RS232 (Serial) Communication To OI

Quote:
Originally Posted by bglass View Post
Sounds good. Since the consensus seems to be that the microcontroller is the best way to go, I guess I'll have to look into that. If anybody has any suggestions on which to use (or how to get started), please let me know. Best wishes.
Having used PIC 18F2455's in an introduction to mechatronics course, I would recommend them. They can be programmed by an inexpensive programmer and support USB communication in addition to RS232. You'll need to use another chip (A MAX232, or similar) to turn the serial from your serial port into the type of serial the PIC likes (there is a voltage difference).

The PIC is programmed in MPLAB, just like the FRC controller. For a bunch of documentation about how to get the PIC to do specific things, I send you to the website of the course I took. It's full of goodies!

But once you can send data to the PIC, you just need to set some digital output pins, some analog output pins, and make them do what the computer says. You could even listen to the feedback LED pins and send them back to the computer for two-way communication.
  #8   Spotlight this post!  
Unread 07-07-2007, 02:16
6600gt's Avatar
6600gt 6600gt is offline
Registered User
AKA: Lohit
FRC #0226 (Hammerhead)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Troy, MI
Posts: 221
6600gt is a jewel in the rough6600gt is a jewel in the rough6600gt is a jewel in the rough
Re: RS232 (Serial) Communication To OI

I am working on application that allows you to simulate all four joysticks(2 at any given time) through the program port on the RC. You need to connect the OI to run but thats all. Yes, there will be some interrupt and code overhead but unless you are pushing the processor to the limit it should work for most things. It also has other features. I am concentrating on the DataView and Camera right now but I will work on the Joystick if you require.

The pic and other hardware way is quite possible but also quite messy. PIC, D/A converter, MAX232, code and more code...
Do you know how to access the serial port on the PC using Java?

I have a pic of what it looks like:
Attached Thumbnails
Click image for larger version

Name:	Dashboard.jpg
Views:	71
Size:	134.8 KB
ID:	5616  

Last edited by 6600gt : 07-07-2007 at 02:29.
  #9   Spotlight this post!  
Unread 07-07-2007, 03:20
bglass bglass is offline
Registered User
AKA: Bryan
#1609 (S.W.A.R.M.)
Team Role: Leadership
 
Join Date: Feb 2005
Rookie Year: 2004
Location: St. Louis
Posts: 8
bglass is an unknown quantity at this point
Send a message via AIM to bglass
Re: RS232 (Serial) Communication To OI

Awesome. Thanks for the help everybody. As I have quite a bit of time left on my project, I think I'll probably try both methods (microcontroller and programming port) to see which works better (at least for my purposes). I think I have a pretty good basis (at least for the microcontroller based operation).

As far as the program goes...looks phenomenal so far. Communicating with serial port via Java isn't the most fun thing to do, but I can help you out with it. You're going to need the Java.Comm class (which isn't really hosted anymore). I have a copy that I managed to scrounge up from some of my older programming stuff. Shoot me a message and I'll send it over to you. It's got some decent documentation with it and I should still be able to help you some with it (it's been a while).

Thanks for the help everybody...I knew coming to ChiefDelphi would pay off...
  #10   Spotlight this post!  
Unread 07-07-2007, 04:04
6600gt's Avatar
6600gt 6600gt is offline
Registered User
AKA: Lohit
FRC #0226 (Hammerhead)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Troy, MI
Posts: 221
6600gt is a jewel in the rough6600gt is a jewel in the rough6600gt is a jewel in the rough
Re: RS232 (Serial) Communication To OI

Quote:
Originally Posted by bglass View Post
As far as the program goes...looks phenomenal so far. Communicating with serial port via Java isn't the most fun thing to do, but I can help you out with it. You're going to need the Java.Comm class (which isn't really hosted anymore).
Thanks, but I was just wondering. I am using the .NET serialport class so its easy to use.

The DataView(along with the graphing) has been field tested during the 2007 season. It saved my life, especially when I was trying to debug 3 different robots.

I was actually working on a similar project without a computer interface though. Did a lot of research but never put it into practice. I have done a lot of development on the PICs though.
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
Need Help With Maplab C programming on serial communication loveheb3 Programming 0 04-06-2007 21:24
Serial Communication Problems with LabVIEW FRC Toolkit Jon236 LabView and Data Acquisition 1 28-12-2006 11:57
Serial Communication in C++ Adam Shapiro Programming 8 21-01-2003 12:49
Serial Port Communication White Paper rbayer Programming 87 14-06-2002 16:10
serial communication using c++ Malakili Programming 31 01-05-2002 15:51


All times are GMT -5. The time now is 19:29.

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