There’s a lot of things I like about RobotC so far, and perhaps the most time-saving item is wireless downloading. In order to make use of this feature, you need to purchase the VEX wireless downloading cable, officially known as the “Programming Hardware Kit.” Cost: $50; I got mine on eBay for about half that — it’s worth it to check eBay every now & then! [EasyC users—you’re out of luck here. Although I’ve read on the VEX Forum of some easyC users being able to make it work on occasion, that software and this component don’t generally work together.]
Why we’re lovin’ RobotC:
- Wireless downloading!
- Wireless debug/sensor data (subject of another post).
- You can actually do sophisticated programming.
- Tons of code available to look at, use, and learn from on the VEX Forum, the RobotC Forum, and YouTube.
As an added bonus, our team will no longer get Forum users answering our easyC questions with “You should switch to RobotC.” Gee, thanks.
Wired vs. Wireless
Think about programming autonomous—or even better, autonomous skills. 60 seconds of trying to get everything just right with teeny changes and trying again and again. Without wireless capability, every iteration of programming involves the following:
- Move the robot over to where the person with the computer is, or vice versa
- Unplug the VEXnet key; may be more or less of a pain, depending on where it is on the robot
- Plug in the orange programming USB cable
- Unplug orange cable, plug in VEXnet
- Cycle the power off & on for the robot & joysticks, just to make sure it’s gonna work right
- Set up the robot for the next run
With wireless downloading, mirroring the steps above:
- Set up the robot for the next run.
- Click the “start” button on the RobotC debug-window-popup box to enable normal robot functionality and competition switch.
So how does this miracle occur? As shown in the image at right, the cable is a 3-part item—the first section is USB, which plugs into your computer, the same way as non-wireless downloading. The other end of the USB gets connected to a Magic Widget (rectangular orange box, photo at right). The other side of the Magic Widget has a different type of cable (looks more like a large, flat telephone wire) which runs from it to the “Program” port on the back of your main joystick (photo below). Then the joystick continues to talk to the cortex via the VEXnet keys, as it does during driver control.
Here’s VEX’s schematic of the whole thing put together:
Cool Add-On Product!
Apparently the USB that plugs into the Magic Widget is known to come unplugged from time to time, causing grand annoyances in the download process (because you don’t immediately realize it’s no longer connected). One of the VEX teams in this wonderful world will make you a box that holds the Magic Widget and plugs, and prevents them from getting tugged apart—WITH YOUR TEAM NUMBER ON IT! How awesome is that? Woo-hoo! We have one, bright green, easy to find around the lab, works as advertised.
From their online ordering page, you can either download the 3D design (I think), or select one of 3 vendors to print it & ship it to you. Cost: about $8 with US shipping. (If you’re a member of the VEX World Coaches Association facebook group, you can send the creator, Nasir Illasarie, a message if you have questions. If you’re not a member of the group, please join!)
We had a little difficulty getting this item set up and working, and then a little more difficulty getting it to work well after that. So this is why I’m writing this post—hopefully I can save some of you a bit of time on this one.
Do this stuff once:
- Start with robot and joysticks turned off.
- In the top menu in RobotC, go to Robot / Platform Type / VEX Robotics flyout menu and make sure it’s set to VEX 2.0 Cortex
- Also in the top menu go to Robot / VEX Cortex Communication Mode flyout menu, and make sure that it is set to “Competition (VEXnet)“
- [Possible] You may need to install special VEXnet serial drivers to your computer; page 2 of this document describes the steps to install them. I’m not sure if this information applies to the current version of RobotC, Windows, etc. because the document only covers up to Windows 7. However, the VEX product page says that you need to install them (under the “Description / Post-2012 Driver” tab at the bottom of the page).
- Sorry I can’t be more definitive here; I did not do the setup for my team, and the person who did doesn’t remember all of the steps required.
- Probably falls into the “couldn’t hurt” category.
Do this when you wirelessly download:
- Connect things together as shown in the schematic above.
- Turn on joystick and cortex and let them pair/connect
- Make sure your competition switch is plugged into the “Competition” port on the back of the main joystick and set to “Disable” (for safety; prevents runaway robots in case autonomous starts running after you download the program)
- Click the big “Download to Robot” button in the RobotC toolbar
- Ta-da! Your program is downloaded.
- However, the robot will not respond to the competition switch, and you’ll be annoyed and frustrated that this doesn’t work
- On your computer, after downloading there will be a popup box that looks like the image at right. Click the teeny “Start” button in the top left corner of the box
- NOW the robot will respond to the competition switch and work the way you expect, and you can run things repeatedly, enable, disable, drive with joysticks, test autonomous, the works.
- Additional downloads can be done the same way, and will not require turning off the joysticks or cortex. Be sure to set the competition switch to “Disable” before downloading every time. Safety first!
What’s That Button For?
There is an LED and a little button on the Magic Widget labeled “Program.” Basically, don’t worry about it—you will likely not have to use it. The only description I’ve found was from 2005 and 2006 VEX Forum posts:
The button will force the Vex Controller into a download or programming state and turn the program light on. You are then ready to download your User code. This is not normally required with most computers but it can be used if your computer is having trouble talking to the Program Module, and you cannot get the program light to come on when you are trying to download code.
In short, I think it’s a placebo button. “We can’t get the program to download.” “Try pushing the button.” Followed—probably—by, “It’s still not downloading.” I dunno; don’t sweat the button.
What If It Doesn’t Work?
This setup will, of course, have times when it does not work right. Some error messages we’ve received are below:
Oh great. What do I do now? Our troubleshooting steps—mostly in mostly this order—are listed below. I can’t stress enough the basic tenet of any scientific experiment: Only change ONE THING at a time. If you change multiple things, and your problem is solved, you still don’t know its real source, and it might pop up again, and you will waste time. (I hate wasting time; it’s such a …. waste of time.)
- Don’t panic.
- Read the error message. As you can see from these examples, it sometimes tells you (in a helpful way) what is wrong or what you need to do. If so, follow those instructions; if not, move through this list.
- Turn everything off—robot, joysticks, unplug USB cable from computer (leaving the joystick connected to the computer keeps power going to it, even when the switch is off).
- Turn everything on in the following fashion: (a) re-connect USB cable to computer; (b) robot; (c) joysticks. Let the VEXnet connect again, and re-download.
- Turn everything off and on again. Seriously, not kidding.
- Make sure the robot and joystick have happy green lights. See our VEXnet lights chart that you can print out & keep in your lab for reference. (We even laminated ours.)
- Try a different USB port on the computer, or try a different orange USB A-to-A cable that goes from the computer to the Magic Widget.
- Make sure the 4 ends of the hardware kit are securely plugged in (USB to computer / USB to Magic Widget / Magic Widget to flat telephone-type cord / flat cord clicked into Program port on joystick).
- Press the placebo button on the Magic Widget; who knows, it might do something!
- Unplug the wireless downloader from the joystick and look very closely at the little pins in the Program port on the joystick and on the wireless plug to make sure they’re not damaged. Reconnect and make sure that the wire is “clicked in” to the joystick (i.e., plugged in completely).
- Google the exact phrase that appears in the message box, and you will probably find someone else who’s had this problem in the past.
- Try to download the old-fashioned way, plugging the orange USB cable from the computer directly to the cortex. Does it work? If not, then the problem does not lie with the wireless system, and you need to troubleshoot the source of your wired-downloading issue.
- Change batteries on the robot and/or joystick (even if the lights are green; seriously, you’re pretty far down this list—you need to try everything).
- Turn everything off, REBOOT THE COMPUTER, and turn on/connect again.
- Update the firmware on the robot & joysticks under the Robot / Download Firmware menu at the top of the screen, and tell it to automatically include joystick updates.
- Swap out the VEXnet keys, if you have 1 or 2 to spare. Only swap out one at a time so that you know where the problem lies.
- I don’t know.
- George Gillard (georgegillard.com), a university student in New Zealand, has created some great documents on his website for download: The Beginner’s Guide to RobotC, Volume 1 and Volume 2 (and others!). Highly recommend; well laid-out with screenshots and examples. Volume 2 gets into more sophisticated topics. Thank you, Mr Gillard!
- Here’s a PowerPoint presentation that has some nice screenshots and has a bounty of useful information on RobotC in general, in addition to walking you through some of the stuff described in this post: ROBOTC for CORTEX Teacher Training.
- As I linked in a previous post on RobotC, the Carnegie Mellon VEX EDR Video Trainer is a thorough and easy-to-understand tour through many facets of using RobotC.
- McCallum Robotics, Team 8756, has created a large collection of RobotC tutorials on YouTube. Very clear and well-presented.
- Search results for RobotC + YouTube.