Go to Post the whole process is the most valuable part, not the award itself - Rich Kressly [more]
Home
Go Back   Chief Delphi > CD-Media > White Papers
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

photos

papers

everything



EDU Robot Controller PC Interface

By: seanwitte
New: 03-11-2003 13:20
Updated: 03-11-2003 13:20
Total downloads: 82 times


Application provides bi-directional interface to control the 2004 EDU robot controller from a PC. GUI has 4 joysticks. Sends 8 control bytes and recieves 14 feedback bytes. Setup package includes .hex file with mods needed to work with this application as well as the source "user_routines.c&quo...

Application provides bi-directional interface to control the 2004 EDU robot controller from a PC. GUI has 4 joysticks. Sends 8 control bytes and recieves 14 feedback bytes. Setup package includes .hex file with mods needed to work with this application as well as the source "user_routines.c" file.

This is a setup package for Windows. You should be able to use "Add/Remove Programs" under the Control Panel to uninstall it.

VERSION 1.2, Updated 1:17PM 11/3/2002. Fixed synch and cleaned up some of the RC code. Data packet fields are pointers now, so you can reference shared variables without assigning values between loops.

Requires .hex file included in setup. You will need to upload that .hex file before you can connect to the RC.

Attached Files

  • zip EDU Robot Controller PC Interface

    1067883650educontroller_v1_1.zip

    downloaddownload file

    uploaded: 03-11-2003 13:20
    filetype: zip
    filesize: 2.12MB
    downloads: 80



Recent Downloaders

  • Guest

Discussion

view entire thread

Reply

24-11-2003 01:55

Sachiel7


Unread Cool

This is a really good program!
It not only serves as a new method of input for those of us with low resources, but it also gives great programming examples of serial communication! Great job!
I would only have to recommend one addition to the program:
-Reading joystick input
I think if the PC could pull the input from at least one Joystick and assign it to step in for one of the four joystick inputs, that'd be great. Since this is a windows app, you should be able to use the Windows API for joysticks without worrying about the system's setup. We could actually drive the edu around with a joystick on our pc! The mouse kinda gets tricky after a while
I'm actually going to try and write a small piece of code to do that now, using what you've put up here. Then I can work on writing a port of my CopyCat code for the new controller!!! YEAH!!
Once again, GREAT JOB!



24-11-2003 08:33

seanwitte


Unread

That program is just a prototyping tool. I received a request to add joystick support but just haven't had time to do it. I have added a data capture feature so that you can capture and plot up to 10 of the IO values. The printing is flakey but you can save a capture plot as a bitmap. Will post it once its been confirmed that it works. I'm out of town for the holidays so one of the other engineers has the controller.

BTW - If you right-click on the joystick it recenters both axis.



24-11-2003 09:34

Sachiel7


Unread

Sounds cool.

Quote:
BTW - If you right-click on the joystick it recenters both axis.
Heh, I just figured that out last night. Helps alot!
I have a few questions though:
What did you use to program this?
I'm trying to understand the communications a bit more. I don't have very much experience in serial or COM communications at all. From what I understand, the PC puts together a data packet of all 4 joysticks. This is 8 bytes in length. I'm assuming it's 2 bytes per joystick, 1 byte per axis. When Its got a new packet ready, it sends out a signal to the RC. When the RC is ready to receive, it sends a signal back. The RC receives the packet, then sends out its 10 byte, 2 integer packet back.
But I'm having trouble with the inner workings of this routine. I browsed through the pc_interface.c file included in the packet, and found the Wait4TXEmpty function call. I noticed that when I tried to compile the project, I couldn't, because the alias.h was referred to as IFI_aliases.h and the IFI_default.h (i think) was missing something. I'm guessing you updated the default code with that function.
Anyway, I'm guessing that it means wait until the PC has pulled this value.
So, when I load up my program (the one I wrote for the joysticks ) and it starts transmitting data, the RC gets stuck in an infinite loop. Now, my PC recognizes if the RC goes offline, so I know it's seeing it right. I just don't think I'm handling everything correctly. Could you give a C code example (even though I'm using Qbasic ...for now...) of how the data's put together and sent/received. Anyway, I have got the joystick input working aok. I've got one flight stick hooked up, and I can pull all the axis, wheel, and buttons from it. The program I have currently calibrates the joystick at startup, then filers the values every cycle, so they range from 0-254, and the axis are lined up correctly. So far so good. I just need an idea of what to do after that. After 1 PC cycle, the next packet is ready. So, I'm supposed to send a small byte to the RC, right? Or do I pull a value?
That's where most of my confusion sets in.
Oh, and another quick question:
What's the setup of the COM connection?
9600baud, no parity, 7 databits, 1 stopbit ?
That also may be where I'm off. Anyway, thank's for the help.



24-11-2003 10:01

seanwitte


Unread

The sequence is as follows:

1. PC sends 1 arbitrary byte to tell the RC to get ready to receive.
2. RC sends back 1 byte and waits for 8 bytes in the receive buffer.
3. RC sends its data packet back.

The baud rate matches the default that IFI uses, which is 19200, 8 bits, no parity, one stop bit.

Write your PC client so that it reads the joystick and sends one byte to the RC. On the RC side, just grab the value in the recieve buffer whenever data is waiting and write it to a PWM output with a servo attached. Once you get that working add the rest. You have to make sure that the code running on the PC during step 2 is tight enough that the RC isn't sitting there waiting.

The program is written in VB 6.0 with the MSCOMM control as the serial interface. I'll make the source available when I have time to clean it up.



view entire thread

Reply

Tags

loading ...



All times are GMT -5. The time now is 11:04.

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