Archive for the ‘vex’ tag
Alexis and Noah are back again with another Student POV! This time, sharing how they programmed a robovacuum in ROBOTC Graphical Language for the VEX IQ platform.
In this challenge, we programmed the Vex IQ robot to perform a task that was based off of the robotic vacuums that vacuum autonomously while avoiding obstacles. Our challenge was to program a robot that would perform like a robotic vacuum. Therefore it would be able to move autonomously while avoiding obstacles.
We started our program by putting in a repeat forever loop. This means that our program will continuously run until we stop it with the exit button on the Vex IQ brain.
We then made a plan on what we needed our robot to do. Within the repeat loop, we had to put an “if else” statement. An if else statement is a command that makes a decision based on a condition. With our program, our condition is the bumper sensor. The robot checks the condition of whether or not the bumper sensor is depressed. If the bumper sensor is not depressed, it will run the command inside the curly braces of the if statement. If the bumper sensor is depressed, it will run the commands inside the brackets of the else statement. We had to put this statement inside a repeat forever loop because without it, it would only make this decision once.
We then had to decide what task the robot was to perform when the sensor was depressed. So we set up commands within the curly braces of the else statement shown here.
Below is an image of the final program.
Now our robot is able to move around autonomously while avoiding different obstacles!
– Alexis and Noah
It’s Danica and Jake, back again! This time, teaching people about the slalom challenge, in ROBOTC Graphical Language for the VEX IQ platform. The challenge is to line follow using the VEX IQ color sensor without hitting the “mines”, also known as the cups.
In the graphical organizer, to line follow on the left side of the line, all you have to do is use the block, lineTrackLeft, to follow the right side you have to use lineTrackRight.
In this block, there are 3 boxes, one for the threshold, the second for the speed of the left motor, and the last box is for the speed of the right motor. In this line of code, the threshold of 105, the robot’s left motor is set to go at 50% power, and the right motor is set to go at 15% power.
This block has to be included into a repeat loop to make sure the robot continues to do this command for an allotted amount of time.
The repeatUntil loop has many options for how long the loop should run. For this challenge, we decided to use the timer.
The timer is set at 7000 milliseconds or 7 seconds, so it has enough time to make it through the slalom. Our finished program looks like this:
Now you can line follow in any challenge you would like, the possibilities are endless!
The ROBOTC Development Team is excited to announce the availability of ROBOTC for VEX Robotics 4.08 – an update for the VEX Cortex and VEX IQ platforms. This new version supports the latest firmware versions provided by VEX Robotics (4.20 for VEX Cortex / 1.09 for VEX IQ) and all of the new features supported by the new firmware updates. Some of these new improvements include:
– Support for the VEXnet 2.0 (white) Radios for the VEX Cortex
– Bug Fixes for the VEX IQ system to prevent “I2C Errors”
– Speed enhancements for VEX IQ for better performance of motors and sensor
– New VEX IQ commands for Gyro sensors
This new version of ROBOTC also supports the VEX IQ “Graphical Natural Language” feature. This new interface allows users to program robots from inside ROBOTC with easy-to-use graphical blocks that can be drag-and-dropped to form a program. Each block represents an individual command from the “text-based” ROBOTC and Natural Language. The new click and drag interface along with the simplified commands of Natural Language allows any robotics user to get up and running with programming their robots as soon as possible. As of today, the Graphical Natural Language commands work with the VEX IQ system, but we’re actively developing support for ALL ROBOTC supported platforms!
Before you can use ROBOTC for VEX Robotics 4.08, you will need to ensure that your VEX devices are up to date. The instructions to update your hardware will be different depending on what hardware setup you may have…
- VEX IQ Users
- Run the “VEX IQ Firmware Update Utility” and update your VEX IQ brain to firmware version 1.09. You will also have to install the latest ROBOTC firmware from inside of ROBOTC.
- VEX Cortex Users (with Black VEXnet 1.0 Keys)
- You will need to update your VEX Cortex and VEX Game Controllers with version 4.20 from inside of ROBOTC. After updating your master firmware, you will also have to install the latest ROBOTC firmware as well.
- VEX Cortex Users (with White VEXnet 2.0 Keys)
- The new VEXnet 2.0 keys have a specific “radio firmware” that you will need to upgrade to enable “Download and Debugging” support. You can find this utility here.
- Download the “VEXnet Key 2.0 Firmware Upgrade Utility” and insert your VEXnet 2.0 key to any free USB port on your computer. Follow the instructions on the utility to update each key individually. All VEXnet 2.0 keys must be running the same version in order to function properly.
- After updating your VEXnet 2.0 keys, you will need to update your VEX Cortex and VEX Game Controllers with version 4.20 from inside of ROBOTC. After updating your master firmware, you will also have to install the latest ROBOTC firmware as well.
- Note that this new firmware version will support download and debugging with both VEXnet 1.0 (black) and VEXnet 2.0 (white) keys.
Here’s the list of changes and enhancements between version 4.06 and 4.08.
- Support for VEX Cortex Master Firmware 4.20 and VEX Game Controller Master Firmware 4.20
- Support for wirelessly download and debugging using the new VEXnet 2.0 2.4Ghz radios.
- Fixed an issue with launching ROBOTC in “Virtual Worlds” mode, which may incorrectly choose the wrong compiler target.
- Fixed issue with Windows XP/Vista/8 where ROBOTC may crash when unplugging/plugging in a device
- Improved motor responsiveness (16ms update cycles as opposed to 50ms today – this was a mitigation for the I2C issues in the current Master FW)
- Improved sensor responsiveness (varies by sensor – this was a mitigation for the I2C issues in the current Master FW)
- Gyro sensors can now return either integer values (getGyroDegrees/getGyroRate) or floating point values (getGyroDegreesFloat/getGyroRateFloat)
- Fixed a bug where the Gyro sensor was not using the “rate” setting to properly return a deg/sec calculation for the getGyroRate command.
- Exposed the ability to calibrate the gyro sensor from the user program and specify the number of “samples” to take during calibration (more samples = less drift = longer calibration time)
- Also added a boolean “get” command to read the gyro calibration status bit to know when calibration is done.
- New PWM adjustment function – allows users to trigger a specific VEX IQ motor to read the current battery voltage from the VEX IQ brain to adjust the PWM scale factor in the motor to ensure consistent performance. This is automatically done each time a program is executed with ROBOTC, but for longer programs end-users might want to readjust the PWM scale factor.
- New “read immediate current” from motor – returns a value in mA
- Modified functions for “motor strength” – renamed these to be “motor current limit” and uses values in mA instead of 0-255 byte value. These commands used to be called “getMotorStrength” and “setMotorStrength” – they’re now renamed to “getMotorCurrentLimit” and “setMotorCurrentLimit”
- Fixed an issue with “Graphical” mode where users may start up in “Cortex” mode and the function library will appear blank
- Fixed an issue when “Natural Language” mode was enabled that normal sample programs may not run properly (using the leftMotor/rightMotor keywords)
- Fixed issue with Windows XP/Vista/8 where ROBOTC may crash when unplugging/plugging in a device
If you have any questions or issues, contact us at firstname.lastname@example.org. Happy Programming!!
Hi, we’re Alexis and Noah, two eighth grade students at Hopewell Memorial Junior High School. Earlier this week, we did the Robo 500 challenge. To write the programs, we used the recently released ROBOTC Graphical software for the VEX IQ. The goal of the challenge was to complete two laps around a Vex IQ storage bin.
We completed the challenge by using timing and degree measurements. The first step was to get the robot to move forward. For this, we would use a basic motor command.
In ROBOTC Graphical, it gives you the option to choose the values in which you want your motor to run by, such as time and rotations. In this challenge, we chose time.
From there, we experimented with different time values until we found the timing that was needed to finish the side of the challenge before the turn. Through testing, I found that 3.7 seconds covered the distance needed.
Now, what was left was the largest challenge of the program, the turn. Timing a turn can be challenging on seconds alone. So, I used degree turns. I started with a 180 degree, which brought me around about 45°. Due to the drift of the robot when it moves forward, I had to make the turn slightly less than double the 180° turn. I settled on a value of 300°.
Once the values were established, the rest was just repeating the commands so the robot would go around the whole box. Here is an example of my final program.
We were then thinking about how the turns were a hassle with trial and error, and contemplated a better way to turn. So, we decided to use a gyro sensor to have the most accurate turns possible.
To start out the program we had to reset the gyro sensor so the sensor could record the degrees from zero.
From here we moved forward to the end of the course for time, and we moved forward for about four seconds. Then we used a while loop. A while loop is set to check a condition and while the condition is true, it performs what is inside of the curly braces of the while loop. In this case the condition is while the gyro sensor value is less than 90 degrees.
We would then repeat these actions until the robot has made two full laps around the course. Here is the program for one lap. To do two laps I would just repeat this program again.
We were able to finish our programs efficiently in a short amount of time due to the design of the new graphical programming. This new design enables you to drag over commands from the function library; such as, moving forwards and backwards, turning, and sensor commands while avoiding the hassle of painstakingly typing each command. This reduces the time spent on each program and allows us to speed up the pace at which we program, and we are able to complete challenges in a shorter amount of time.
To the left, we have an image of the function library and a depiction of what would happen if you dragged a command into your program. The command would line up with the next available open line and would give you options as to what values you wanted to program your robot with.
If you’re a student who would like to contribute to the blog, let us know at email@example.com.
We are really excited to introduce a new blog series called Student POV! This series will feature students giving their perspective and advice for programming in ROBOTC. If you’re a student who would like to contribute to the blog, let us know at firstname.lastname@example.org. Welcome our first student bloggers, Danica and Jake!
Hi it’s Danica and Jake, and we just completed the Labyrinth Challenge. We are both 8th grade students attending Hopewell Memorial Junior High. We both used VEX IQ Graphical Programming Language to complete this challenge since it is a new software recently released by ROBOTC. The first challenge we had to accomplish was the labyrinth challenge. The labyrinth is a square, where the robot has to travel from the starting point, to the ending point by doing a series of basic commands.
Our first task was to make our robot move forward.
This block is telling the robot to go forward at 50% power for 5 rotations, but you can also set the robot to move for degrees, milliseconds, seconds, and minutes.
Our second task was to make the robot turn left.
When turning left, you can use multiple commands such as degrees, rotations, milliseconds, seconds, and minutes. You can also use this for turning right.
One problem while programming for this challenge was making 90 degree turns. To get a perfect 90 degree turn, with timing, you had to go through a lot of trial and error. After figuring out the perfect turns, based on timing, the time for moving forward, and the stops to prevent drifts, we had to string all the commands together to form the program for the challenge. This what the finished program looks like:
An easier way to perform more accurate turns, is with the use of the gyro sensor. The gyro sensor allows you to count how many degrees you turn. This simply means that you can actually tell the robot to make an accurate turn. You also have to remember to reset the gyro after every use, and it will make this program a lot easier.
To reset the gyro you have to use this block:
The finished program with the gyro sensor looks like this:
In this program we used the setMotor command instead of turnLeft or turnRight. This command is better to use in the while loop since you only have to set the speed of the motor. The condition in the while loop determines how long the robot turns. As a result, we just need to set the motor speed with the setMotor command.
A cool feature you can use in RobotC is commenting out your code. You can also do this in the VEX IQ Graphical Organizer. It is much easier though since you only have to click the number on the block of code you want to comment out.
Commenting looks like this:
These comments allow you to test only one turn out of the whole code, which is very useful during the trial and error stage.
Now it is time to go try the Labyrinth challenge on your own, either with or without the gyro sensor. Have fun!
There is only one day left to enter our Robot Virtual Worlds VEX Toss Up Competitions!
VEX Toss Up is played on a 12’x12′ square field. The object of the game is to score your colored BuckyBalls and Large Balls into the Near Zone and Far Zone, by Locking Up your colored BuckyBalls and Large Balls into the Goals, and by Low Hanging, Hanging and Ultra Hanging off your colored Bar at the end of the match.
This Virtual World is designed to simulate the Toss Up competition field and several robot designs, allowing teams to practice their programming and form winning gameplay strategies.
See the rules documents for the full CS2N game explanation:
Additional information to help you get started:
- All information on CS2N Competitions can be found here
- VEX Toss Up can be downloaded at RobotVirtualWorlds.com or CS2N.org
- If you don’t already have a CS2N account, sign up for a free one here
- Updates and information will be posted on the CS2N Competition pages.
- If you need any help, don’t hesitate to post on the ROBOTC.net forums
Good Luck and Happy Programming!
Programming your robot to make precise turns can be a source of frustration for some students as they begin to learn ROBOTC. Oftentimes, when students are just learning programming, all of the movements of their robots are based on timing. When programming a robot to move forward or backwards, a small error or a small amount of inconsistency can usually be overcome. With turning, however, inconsistencies and small errors can lead to larger errors and the frustration I mentioned earlier.
At this point, students learn that sensors can be used to improve the movement of their robots. With the VEX IQ, a Gyro Sensor is provided that eliminates any guesswork when it comes to programming your robot to turn.
The Gyro Sensor measures the rotational angle of the robot. If you look at the Gyro Sensor, you will see an arrow that points in a counter-clockwise direction. That is the default positive direction. Therefore, as long as the sensor is mounted flat on the robot it picks up the parallel angle to the ground. The sensor then registers the current position as a zero point. If the robot turns counter-clockwise, it registers as a positive value. If it turns clockwise, the sensor registers a negative value. We can see this applied with the following illustration:
We can program the Gyro Sensor using Natural Language or full ROBOTC. To use Natural Language, you just need to make sure that the Gyro Sensor is plugged into port 4. Let’s take a look at some ways to program the Gyro Sensor with Natural Language.
With this program, getGyroDegrees returns the current rotational value of the sensor in units of degrees. When making gyro-based turns, it is best to reset the gyro sensor before each turn, so the resetGyro command is utilized. With the example, we want the robot to turn until the getGyroDegrees command returns a value (from the Gyro Sensor) of 90 degrees. Therefore, we use the repeatUntil command. When we run this program, our robot should make a 90 degree left turn. Note that the robot may turn more than 90 degrees due to drift, which is caused by momentum. If this occurs, just slow down the speed of the motors. That should eliminate the drift.
We can apply the same commands to program our robot to make a right turn.
What I did when first showing the students the Gyro Sensor was to have them see the sensor work with the debugger screen. I used a sample program utilizing full ROBOTC with this activity. The sample program we used was in the Gyro Sensor Folder, and it is called Gyro Display Values. The students compiled and downloaded the program. They kept the USB cables plugged into their robots so they could see the values of the Gyro Sensor on the debugger screen. To access the debugger windows, go to the Robot menu, click on Debugger Windows, and then select Sensors.
The students can now run their program, physically move their robot, and see how the values of the Gyro Sensor change via the debugger screen.
The VEX IQ Gyro Sensor is extremely useful and easy to program, and the students have a lot of fun using this sensor.
– Jason McKenna
After months of work, the ROBOTC Development Team is excited to announce the availability of the first preview release of ROBOTC Graphical Language for the VEX IQ platform. This new interface will allow you to program robots from inside ROBOTC with easy-to-use graphical blocks that can be drag-and-dropped to form a program. Each block represents an individual command from the “text-based” ROBOTC and Natural Language. The new click and drag interface along with the simplified commands of Natural Language will allow any robotics user to get up and running with programming their robots as soon as possible.
The first release of ROBOTC Graphical Language is available for the VEX IQ platform for use with the standard VEX IQ Clawbot and Autopilot Robots. All ROBOTC 4.0 users will receive access to the new Graphical Language interface at no additional cost! Our plans over the next few months are to extend the Graphical Language interface to all of ROBOTC’s support platforms, including the Robot Virtual Worlds technology. You can download the preview version today at http://www.robotc.net/graphical/.
The new ROBOTC Graphical programming environment adds a number of new features we’d like to highlight:
Graphical Language Command List (Drag and Drop)
With the new ROBOTC Graphical Mode, we’ve updated our “Functions Library” to match the style of the Graphical interface. This new mode will allow you to drag and drop blocks of code from the “Graphical Functions” menu into your program to get your program created even faster!
New Language Commands for Easier Programs
We also added some new language extensions to both ROBOTC and Natural Language; such as the simplistic “Repeat” command. Prior to the Repeat command, users would need to copy and paste large sections of code or use a looping structure (like a ‘for’ or ‘while’ loop) in order to have a set of actions repeat a number of times. With the new “Repeat” command, however, users can simply specify how many times they would like the code to run, with no complex coding required. And users who wish to make an “infinite loop” can use the “repeat forever” command to accomplish this task quickly!
Commenting Blocks of Code!
Another awesome tool that we’ve implemented in ROBOTC Graphical is the “comment out” feature. You can now comment out an entire line of code just by clicking on the block’s line number. The robot ignores lines of code that are “commented out” when the program runs, which makes this feature very useful when testing or debugging code. This new tool is unique to ROBOTC’s Graphical interface.
Updated and Simplified Toolbar
Sometimes navigating menus as a new user can be a little overwhelming – so many options to choose from and lots of questions about what each option is used for. To help with this, we’ve redesigned ROBOTC’s toolbar to make getting up and running easier. We put the most used commands on a larger toolbar so new users have an area to easily click to download firmware, send their code to their robot, and run their programs without having to use the standard menu interface.
Convert to Text-Based Natural Language
Because each Graphical Natural Language block corresponds to a real ROBOTC or Natural Language function, users will be able to graduate from Graphical Programming to full text-based programming with the press of a single button. This allows users to naturally transition from Graphical Natural Language to the text based Natural Language (or ROBOTC), without having to worry about manually converting the code line-by-line!
Teacher’s Guide and Sample Programs
The new graphical interface includes over 50 new sample programs to help you get up and running with working examples and demo code. In addition, we’ve also developed a 30+page guide to walk new (and existing) users through the new Graphical Programming interface and getting started with the VEX IQ platform. You can find a link to the programming guide here and also on the ROBOTC Graphical page.
This initial release is only the beginning and we’re planning on improving the software with more features and flexibility over the coming months.
- Copy and Paste
- Undo/Redo Support
- Support for custom robots/configurations via an updated “Motors and Sensor Setup” interface.
- Dynamic Loop and Command Parameters (based on Motors and Sensor Setup / Robot Configuration)
- Tooltips, Contextual Help, and more!
Let us know what you think! If you have any feedback or questions, please send them along via the ROBOTC’s VEX IQ forums.
Whether they are in elementary school, middle school, or high school, students really enjoy programming their robots with remote controls. Luckily, the VEX IQ wireless controller allows you to do just that. ROBOTC allows you to create your own remote control programs to customize each joystick axis and button controls. Moreover, you can use both Natural Language and full ROBOTC with the remote controls.
Both the VEX IQ brain and the remote control require a radio controller for communication. The radio controller has to be in each in order to use the remote control. Additionally, a battery needs to be placed into the remote control for the wireless communication. Just like the battery for the VEX IQ brain, the battery for the remote control is rechargeable.
In order for the VEX IQ brain and the controller to communicate, they must be paired together. With both devices turned off, connect the two devices together with the tether cable that is included with the VEX IQ Starter Kit with Controller. The tether cable is just a standard Ethernet cable. Turn on the VEX IQ brain by pressing the check button. The controller will automatically link and pair with the VEX IQ brain.
Once your connection has been established, the green light will blink on both the remote control and the VEX IQ brain. You will not have to link the tether cable with the remote control the next time you turn on the VEX IQ brain or the remote control. In the classroom, you can assign each robot to a remote control by giving each a number. That way, you never have to link the remote control with the VEX IQ brain. Or, you can just have the students do a quick set up at the beginning of class. Either way will work.
ROBOTC can access all of the data from the VEX IQ remote control by referencing the button and axes by their described names. Joystick buttons return values of..
• 1 – Pressed
• 0 – Not Pressed/Released
Joystick Axis return values of…
• -100 to +100 (0 when centered)
When using the VEX IQ remote control, make sure you switch to your “Controller Mode” to Tele-Op.
Alright, now you can begin programming (either in Natural Language or full ROBOTC) and have some fun.
As teachers, we all know to expect the unexpected. I recently had the students on a Friday, with a long weekend in front of them. Therefore, I did not want to start a new concept, for I would have to re-teach it after the long weekend. So, I decided to set up a quick in-class competition with the VEX IQ Challenge Field and some Bucky Balls and rings.
I allowed the students to make up the parameters for the game, gave them some time to devise some strategy, downloaded some sample programs to run the remote controls, and let the fun begin. The students had a great time and the activity will serve as a springboard for future investigation into how to customize the remote control programs.
– Jason McKenna
The Carnegie Mellon Robotics Academy will be offering two ROBOTC online professional development courses in February!
The six-weeks online courses will be:
ROBOTC Online Training for LEGO / TETRIX
February 11th – March 18th, 2014
Tuesdays for 6 Weeks
7-9:00pm EST (4-6:00pm PST)
ROBOTC Online Training for VEX CORTEX
February 13th – March 20th, 2014
Thursdays for 6 Weeks
7-9:00pm EST (4-6:00pm PST)
The Professional Development courses provide teachers and coaches with a solid foundation for robot programming in the respective languages, and experience in troubleshooting common student mistakes. It also focuses on identifying and extracting academic value from the naturally occurring STEM situations encountered in robotics explorations. Find out more here – Robotics Academy Professional Development
Classes are filling up quick, so sign up today!