|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Control a vex with a laptop?
Have any of you ever tried controlling a vex with a laptop? I'm digging through the default vex code right now, but is it possible to receive commands from the computer's serial interface as well as send messages to it? I wonder if it's as simple as a scanf function, but unfortunately I don't have a vex on me to try it at the moment.
I ask this because I realized that my laptop, an Asus EeePC, is the perfect size for the job. That brings up another question... is it possible to use the serial interface under Linux? My laptop is running Kubuntu. I've interfaced with Cisco routers under Linux, which use the rollover cables and serial adapter, so I don't think it'll be any different... Anyway, if I get this working, my laptop has wifi and a webcam, not to mention a screen, speakers, and USB interfaces. This might be fun. ![]() Now I just gotta steal my brother's vex kit while he's not around... ![]() |
|
#2
|
|||
|
|||
|
Re: Control a vex with a laptop?
Hmmm... a bit more searching through the forums and I think I've answered my question.
Quote:
|
|
#3
|
|||||
|
|||||
|
Re: Control a vex with a laptop?
Well, I happen to think you're on to a great idea here... mainly because I've got something pretty similar running on my VEX bot right now. It carries the laptop around, has a webcam mounted to a servo on the arm, and connects over wifi using Skype.
I have lots of fun driving the robot from another room using the live video feed and have been waiting to fix up a few little things before posting the video link here. Then I was going to ask a question similar to yours, but a bit different... Does anyone have any suggestions on how to interface the laptop on the robot to the rest of the internet, so that I can control the data feed down the serial port TO the robot using any computer on the planet? Skype will take care of the video feedback for the operator... I just need to get data... preferably from a joystick but I'll settle fo the keyboard or mouse for now... across a few firewalls and down a serial port. And that is something I could do with a few suggestions on how to implement! Jason |
|
#4
|
|||
|
|||
|
Re: Control a vex with a laptop?
Quote:
There's a port of Open SSH server to Windows, but I don't know if there are any CLI based terminal emulators for Windows. It might be a pain to set up so it might be worth dual booting Linux, I don't know... Oh, and btw, after an all nighter of coding I've gotten the basic command interface working. It doesn't do anything right now... I still need to actually parse the commands. I'm a total parsing noob (in perl, I often just split() the strings and simply assume which pieces are which), so this should be a good learning experience for me. ![]() Anyway, I guess we're in this thing together. Good luck! ![]() |
|
#5
|
|||
|
|||
|
Re: Control a vex with a laptop?
Okay, I've almost got this working, but I've reached a stumbling block. I'm using Kevin's latest FRC code with this Vex because it comes with serial port functions. However, once I got to the part where I set the PWMs, I found that setting the PWM values doesn't do anything! Has anyone else tried to run Kevin's code on the Vex? Or, has anyone gotten serial input to work on the default vex code? I hate getting stuck on silly problems like this... I just want to see the robot move.
![]() |
|
#6
|
|||
|
|||
|
Re: Control a vex with a laptop?
A bit more experimenting, and I think this particular Vex controller is dead. The serial interface works well enough, but the PWMs don't work even with the default Vex code. It forgets the code loaded on it the instant I turn it off. That's disappointing. I might be able to get my hands on another controller later, but it looks like I'm grounded for now.
![]() Let me know how that remote controlling goes. Interfacing with the robot through the serial port is really easy with Kevin's serial_ports.c/h code. *yawn* it's 10:32 and I've yet to get any sleep... enough messing with this thing... |
|
#7
|
||||
|
||||
|
Re: Control a vex with a laptop?
Before chunking it, try reloading the master code (the .bin file). Our annual summer camp was this week and there was a robot that would not connect to the OI at all, and after downloading the master code and the user code, it worked fine. I'm not sure why it went bad, but it did. Also some controllers would forget their code as well.
You sound pretty smart with programming and computers, so you have probably already done this, but I thought I would give a shot at helping you. |
|
#8
|
|||
|
|||
|
Re: Control a vex with a laptop?
Hehe, I'm not /that/ smart. I never even thought of that. I'll try that...
|
|
#9
|
|||
|
|||
|
Re: Control a vex with a laptop?
Thanks. I loaded the latest firmware and the controller is working now, at least with the default code. Unfortunately, I wasn't able to control the PWMs using Kevin's code. I've read on the forum somewhere that components of Kevin's FRC code can be dropped into the regular Vex code easily enough, so I'll try that next.
Unrelated, I'm having trouble using mplab 8.10 with the 2.40 compiler... I guess I'll start another thread to fix that issue. Looks like another long night of delicious code. ![]() |
|
#10
|
|||
|
|||
|
Re: Control a vex with a laptop?
I tried using Kevin's serial_ports.c/h with the default Vex code and I got it to compile and run, but whenever I call Read_Serial_Port_One(), the bot stops working, the "PGRM STATUS" LED flashes red, and the serial port doesn't work at all.
So right now it looks like I get to choose between either being able to move the bot by using the default Vex code, or being able to communicate with it by using Kevin's FRC code. I haven't gotten moving and communication working at the same time yet. Oh, and btw, when running Kevin's FRC code, the program LED is always flashing red, but at least the serial port works. Maybe that will help to diagnose the problem. |
|
#11
|
||||
|
||||
|
Re: Control a vex with a laptop?
Quote:
Now as for adding his serial port drivers, yes it is possible. In fact, I highly recommend it. I currently have his: Interrupt, ADC, Gyro, IR receiver and serial port code added into the default 2007 FVC code. It is not that difficult to do and it really adds some great functionality. For one, I can now get real-time telemetry from the Vex via Serial port 2 and my BlueSMiRF from Sparkfun. I also have an adapter that allows the same from Serial port 1, but it is not as convenient to use. I do not believe Kevin's PWM code will work with Vex without some major modifications. Vex only has 8 PWMs while FRC has 16. Kevin's code is written to work with PWM's 13-16 and use the CCP hardware to generate the PWM signals, bypassing the need to use interrupts. |
|
#12
|
|||
|
|||
|
Re: Control a vex with a laptop?
Quote:
1) A serial IO component to provide an interface between the onboard laptop and the vex controller. The easiest protocol would be a 4-byte packet with the camera PWM, left motor PWM, right motor PWM, and 0xFF delimiter. The PWM values should be in the range 0-254. The Vex controller will need to listen and parse data from the serial port. The Vex controller will also want to stop the motors if no data is coming in, in case the link to the laptop is broken. 2) A Windows service to manage the connection to the Vex controller. The service will keep the current PWM command in memory and resend then on a fixed schedule. The service will expose a method to update the motor values. The service itself would be implemented as a WCF web service. 3) An ASP.NET application running on the laptop to collect inputs and call into the service to update the motor values. You can configure your WAP to route traffic on a non-standard port (ex. 8085) to the laptop. You would access the web application at your router's public IP address and the port you configured in the WAP settings. You can get the public IP by hitting http://ipchicken.com from behind the router, or through the router settings. |
|
#13
|
|||
|
|||
|
Re: Control a vex with a laptop?
I mounted my laptop to the Vex, and it works great! Here's a picture:
![]() I used that Perl script to control it and I used an app called Linphone to look through the webcam. As a test I drove the robot down the hall to see if the bathroom was occupied. Seeing that it wasn't with the webcam, I proceded to get off my chair and utilize it. ![]() The one thing I don't really like about it is the way I strapped the laptop on. It didn't fall off, but it's still a bit shaky. I should probably also find a better approach to controlling the robot too, probably with a leaner protocol and a service running on the laptop like seanwitte suggested. I might even make a video... although I'm not very good at making stuff like that. I'd like to see that webcam attached to the arm... I wish I could have done something like that. The idea reminds me of a robot I saw that one of our team sponsors had built. It had a camera on this neat arm that would telescope out like ten or fifteen feet in the air. It was cool. ![]() |
|
#14
|
|||
|
|||
|
Re: Control a vex with a laptop?
On my way to work I remembered this: http://www.chiefdelphi.com/media/papers/1453
I wrote that a few years ago for rapid prototyping on the min-RC. We didn't have an RC radio for it so I wrote an app for the PC to provide a UI to drive the robot using the serial port. I don't know whether it will work with the Vex, but the RC code is pretty simple. It provides 4 2-axis joysticks (widgets you drive with the mouse) and 8 digital inputs. The robot can send back sensor data. It will also plot I/O channels for you. If you can get a remote desktop or application sharing program to work over the internet then you could just remote into the laptop and drive it using that UI. |
|
#15
|
|||
|
|||
|
Re: Control a vex with a laptop?
I added an arm to my robot. It really seems like a robot now. Picking up things with the arm and the webcam is great fun.
![]() ![]() I updated my Perl code to use my left joystick for single stick drive and my right joystick to control the arm. As far as I can tell, my PSX controller works as well as the controllers that come with the Vex. I also added some simple timeout detection code that just sends out a '\a' character every second. My code is still event driven, so it doesn't waste bandwidth by sending motor values when nothing has changed. And I've sort of started working on a video for it... I've chosen the background music at least. ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using a VEX Receiver with Non-Vex Equipment | akaria | VEX | 26 | 09-06-2008 12:55 AM |
| The poor serial port less laptop owners with a ExpressCard Slot | Kingofl337 | Programming | 8 | 03-11-2008 10:25 PM |
| Laptop Controlled VEX robot | John Gutmann | Technical Discussion | 0 | 04-11-2007 12:51 AM |
| PC Control of Vex processor | tacman1123 | Programming | 1 | 06-06-2006 10:47 AM |
| What to do with an old Windows 3.10 laptop? | Elgin Clock | IT / Communications | 13 | 07-14-2005 05:45 PM |