ROBOTC.net Blog  

ROBOTC News

Archive for the ‘cortex’ tag

Exciting New ROBOTC Update Available Today!

with 2 comments

ROBOTC4-25

We’re excited to release our latest update, ROBOTC 4.25!!  We are calling this our “Release Preview”, because we are still in development for the full version, which will be released by the end of the month. This release is stable and we encourage all our ROBOTC users to try it out. If you run into any major issues, let us know in the forums. This update is for the both the VEX Robotics (CORTEX and IQ) and LEGO MINDSTORMS (NXT and EV3) robotics systems.

Some of these new updates include …

  • Full EV3 Functionality (Sounds, LCD, LEDs, Sensors, Motors)
  • Graphical Language for all platforms (VEX IQ, VEX Cortex – LEGO NXT, LEGO EV3)
  • Updated 3rd Party Driver Library for NXT and EV3
  • Updated Text Based Natural Language for NXT
  • Tons and Tons of Bug Fixes and Enhancements!

Screenshot-2014-08-15_17.23.09

Screenshot-2014-08-15_17.37.14

Screenshot-2014-08-15_17.25.23

_____________________________________________________________________________

Before you can use ROBOTC 4.25, you will need to ensure that your devices are up to date. The instructions to update your hardware will be different depending on what hardware setup you may have…

LEGO NXT Users

  • Simply update to the latest ROBOTC firmware from inside of ROBOTC.

LEGO EV3 Users

  • Update your LEGO EV3′s Firmware/Kernel by connecting your EV3 and select “Download EV3 Linux Kernel” from inside of ROBOTC – This process will take about 5 minutes and will allow your EV3 to communicate with both ROBOTC and the EV3 Icon-Based programming language. After updating your EV3′S Linux Kernel, you’ll be able to install the ROBOTC firmware from inside of ROBOTC.

VEX IQ Users

  • Run the “VEX IQ Firmware Update Utility” and update your VEX IQ Brain to firmware version 1.10. You will also need to update your VEX IQ Wireless Controller by attaching it to your VEX IQ Brain using the tether cable. 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.25 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 the “VEXnet Key 2.0 Firmware Upgrade Utility” utility here.
  • Link: http://www.vexrobotics.com/wiki/index.php/Software_Downloads
  • 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.25 from inside of ROBOTC. After updating your master firmware, you will also have to install the latest ROBOTC firmware as well.

_____________________________________________________________________________

And finally, the very LONG Change Log for 4.25:

  • Cortex: Added servo motor commands to Cortex for Virtual Worlds.
  • Cortex: Added potentiometer commands to Cortex for Virtual Worlds.
  • Cortex: Add Timers and Clear Timers to Graphical for Cortex.
  • IDE: Spurious “rbg” file extension may have been added when saving a text file created from converting a graphics file. Fixed.
  • EV3: Update the routine that checks for “valid syntax of NXT on-brick file” for EV3. EV3 has different rules for file names than NXT.
  • VEX IQ: Added sound commands to Natural Language for VEX IQ – modified the playNote command to use typedefs to make it easier for natural language users.
  • Compiler: When substituting symbol names that match except with different letter case do a better job of handling the case when multiple symbols might possibly fit.
  • EV3: Support for standard ROBOTC “playTone” file with EV3.
  • Updated IDE Version (4.25)
  • Updated Firmware Version (10.25)
  • IDE: New Help System Engine + Content Files (replaces CHM)
  • Debugger: Fixed issue where VEX IQ motor debugger window was displaying “raw” encoder counts instead of “scaled” encoder counts.
  • Virtual Worlds: Adjust “no echo” value for VEX IQ in Emulator/Virtual Worlds
  • IDE: Default directory has been adjusted to be “my documents” instead of the root ROBOTC directory for saving un-saved files.
  • Compiler: Format code “%f” was broken in implementation when a number of decimal specifier wasn’t provided. Fixed.
  • Natural Language: Updated Natural Language Libraries to include “debugging” to LCD commands.
  • GUI: Updated Desktop/Start Icons for Graphical
  • Debugger: Sensor window had some “artifacts” when the number of display rows was larger than the number of active sensors. Fixed so that artifacts are now blank lines.
  • Compiler: Fixed compiler bug. Conversion of ‘float’ constant expressions to ‘long’ constant value was incorrect. End result of bug was that most likely value assigned was zero.
  • EV3: Added resources to the firmware image with sounds and images in /home/root/lms2012/resources/
  • EV3: EV3 firmware from LEGO does not properly handle the use of ‘.’ in the middle of filenames. Replace the ‘.’ with ‘_’.
  • Compiler: Fixed issue with rand() – Compiler was incorrectly optimizing get/set property opcodes to a one-byte index value with constant parameters. Almost all properties only need one byte with exception of “propertyRandom” which was behaving incorrectly as a result of this bug.
  • Graphical: Support for “compiler error” display for graphical files including using “graphical block numbers” rather than “text line index” for error display.
  • Graphical: Tweaked graphical loop block colors.
  • VEX IQ: Allow the debugger to display information based on the global motor encoder units instead of raw counts for VEX IQ
  • Cortex: Updated VEX Cortex IME Support to reflect new motor type (393 with Turbo Gears). Also removed some inconsistencies in the software as well.
  • EV3: When USB connected EV3 is disconnected then ROBOTC would not reconnect to it when reconnected until ROBOTC application was existed and re-entered. The problem was ROBOTC was using a “old” list of “discovered devices”. Now discards list of devices and rescans — when connecting via USB only — and problem is resolved.
  • EV3: Support for EV3 text drawing to screen.
  • EV3: Breakpoints now working for EV3.
  • EV3: Add support for “EV3 Remote Screen” as part of the Debugger.
  • Compiler: Improved implementation of compiler parse for ‘typedef enum” and “typedef struct”. Implementation is now closer to standard “C” with better handling for “anonymous” typedefs. Does not break any sample programs.
  • IDE: “Open Include File” command in source file context menu was broken; fixed. “Go to symbol definition” context menu command now filters out macro parameters and procedure variables.
  • NXT: Fixed issue where “simple” game controller data wasn’t appearing in available debugger windows
  • Graphical: Graphic trash can implementation. You can drag selection to the trash can to delete blocks.
  • NXT/EV3: Fix spurious generation of “#pragma config” for PID settings that are all set to 0xFF values.
  • Graphical: Syntax checking on graphical files. Some errors are now flagged.
  • Graphical: Implement “Comment” block for Graphical views including edit capability.
  • EV3: New Commands for EV3 IR Sensor
  • EV3: New Commands for EV3 Bumper/Touch Sensor
  • EV3: New Commands for EV3 Color sensor
  • EV3: New Commands for EV3 Gyro sensor
  • EV3: New Commands for EV3 Touch Sensor
  • Graphical: “>” and “<” comparison operators were swapping when saving a graphical file. Fixed.
  • IDE: When a new source file is opened (or a template file) do not initially set the “modified” flag in the file. Only set the modified flag after end user has modified the file.
  • IDE: Avoid double “Save File” prompt when compiling a file and on the first SAVE prompt you click cancel.
  • EV3 Kernel: Image of latest build – version 1.06X and all the I2C enhancements.
  • EV3: IDE “File Management” window for EV3 was often crashing; fixed a buffer read overflow situation which clears this up. Better text error message when there is not enough free flash memory to write a new file to the EV3.
  • IDE: Disable “error” message box when pulling USB cable from robot brain (and the debugger shuts down).
  • VEX IQ: Visual Error handling for Debugger Exceptions (Wrong Motor/Sensors/etc)
  • VEX IQ: Updated GUI Text: When a ROBOTC AUTO program had previously ran, and then a user was trying to access a TeleOp program, they would be greeted with a “No Radio Needed…” message box. Updated the text to reflect that if they’re seeing a message they probably need a remote control, because this string is never presented to the user for more than a split second in Auto mode.
  • IDE: Fixed issue with “Sensors” debugger window not being able to be edited.
  • VEX IQ: fixed Issue with VEX IQ Color Sensor – Hue values were being scaled improperly.
  • Graphical: Reduce flicker on graphical view when dragging blocks.
  • Graphical: Added registry options to adjust the appearance of graphical programs. Includes show/hide {}. Show/hide semi-colons. Optional “end” text on end block. Etc.
  • Robot Virtual Worlds / VEX IQ: Invert the proximity value provided by the vex color sensor to align with real hardware.
  • IDE: Add support to “Motors and Sensors Setup” to store drive side — left/right/none — for each motor. Graphical Movement Commands will now use this data to decide what motors to drive
  • Graphical: Adjust width of graphic programming blocks based on contents of edit controls and width of drop down menu items.
  • Graphical: Added EV3, VEX Cortex and NXT as “Graphical Language” platforms.
  • Bug: Large ICON toolbar was not getting built when IDE is opened unless it was “opening last file”. Changed data table to ensure that it is initially built.
  • IDE: Added ability for “Macro” commands to Compile/Download/Launch Graphical Files when special flags are stored inside of the .RGB files.
  • Graphical: VEX IQ Motors and Sensors now support dynamic menus based on Motors and Sensor Setup Data

_____________________________________________________________________________

Download ROBOTC 4.25 here!

As always, if you have questions or feedback, feel free to contact at support@robotc.net or visit our forums! Happy programming!!

Written by Cara Friez

August 15th, 2014 at 8:49 pm

Update – ROBOTC for VEX Robotics 4.08

with 4 comments

ROBOTC logo 4 UpdateThe 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.

VEX Cortex:

  • 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

VEX IQ:

  • 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 support@robotc.net. Happy Programming!!

 
 

Robomatter Blog Ad VEX IQ

 

Written by Tim Friez

March 26th, 2014 at 8:40 pm

Which Robotics Kit Should I Use? VEX Edition

without comments

VEXiq-109Now more than ever, robotics educators are faced with the important question of which kit they should purchase and use. This key question has been made even more intricate in the 2013-2014 school year due to the addition of the new robotics kits, VEX IQ kits. This article will help break down each VEX kit, their capabilities and target audiences, and allow you, the educator, to make an informed decision on which kit is best for your particular classroom.

The VEX IQ system is the brand-new robotics system from Innovation First International (IFI for short, makers of the VEX Robotics Design System). The VEX IQ can be used with any of the all-new hardware and sensors, including a unique plastic snap-fit structural system.

 

 

 

 

  • Sensors include a gyroscope, color sensor, potentiometer, touch LED, and ultrasonic sensor.
  • The base kits (either Sensor or Controller kits) are provided with over 650 structural components, 4 plug-and-play ‘smart motors’, at least 2 touch sensors (or more, depending on kit), and the VEX IQ microcontroller (more information on all available kits can be found here).
  • The IQ contains 12 smart ports that can be used to control either analog sensors, digital sensors, or servos/motors; the ports are non-typed and can be used to control any piece of VEX IQ compatible hardware that is plugged into it.
  • It also includes a micro-USB port for IQ-to-computer communication and a ‘tether’ port for direct connections to an VEX IQ Controller.
  • Debugging and programming information can be displayed on the backlit LCD information to increase ease-of-use in real time.
  • Wireless communication between the VEX IQ microcontroller and a VEX IQ controller is provided via a set of 900 MHz radio adapters.
  • The VEX IQ system will be fully legal in the new VEX IQ Challenge (designed specifically for the VEX IQ system), for students ages 8-14.
  • Recommended use: Middle School.

cortex-robotOne of the mainstays of the educational robotics world is the VEX Cortex platform. Originally released in 2010 by IFI, the Cortex can be used with the VEX Robotics Design System’s hardware and sensors.

  • Includes over 300 metal structural parts, 4 powerful DC motors, the VEX Cortex microcontroller, and a wide variety of fasteners, gears, and other miscellaneous hardware.
  • Sensors include touch sensors, an ultrasonic sensor, integrated motor encoders, line following sensors, and a potentiometer; additional sensors are available outside of the base kits.
  • Wireless communication between a VEX Cortex and a VEXNet Joystick Controller is possible by using the 802.11b/g VEXNet USB Adapter Keys.
  • The VEX Cortex system can be used in the VEX Robotics Challenge (Middle, High School, and College divisions).
  • Recommended use: advanced Middle School, High School or College.

We understand that choosing a robotics kit is a tough decision. The number one factor in determining which kit is right for you is the students; depending on the skill level of the students, it may be better to challenge them with a more advanced kit (VEX Cortex) or they made need to start with a simpler kit (VEX IQ.) No matter which kit you decide to use, though, you can rest easy knowing ROBOTC will fully support all of these platforms.


 
 
 

Robomatter Blog Ad VEX

 

Written by John Watson

August 27th, 2013 at 5:13 pm

PLTW Students Integrate LynxMotion and VEX

with one comment

Do you get hungry? Do you enjoy eating food more than you enjoy making food? If you answered “Yes!” to both of those questions, you’ll be happy to know that the future engineers of America have you covered.

Students from two Project Lead the Way (PLTW) Schools have integrated the sensing and control capabilities of the VEX Cortex Robotics system with the advanced articulation capabilities of the LynxMotion Robotics system to create highly capable (and delicious) assembly lines.

The first two videos are brought to us by students in a Computer Integrated Manufacturing (CIM) class at Kings High School in California.

Robotic Sandwich Factory:

Buttered Toast Factory (complete with real-life toaster):

The work behind the last two videos was done by students in another CIM class at Lancaster High School in New York.

Coffee Manufacturing Line:

Widget Assembly Line:

Well done to all the students involved, and to the instructors that inspired them. Keep up the great work!

If you’re looking for more information, additional videos and explanation can be found on their respective YouTube channels.

Written by Jesse Flot

June 12th, 2012 at 10:48 am

Posted in Cortex,VEX

Tagged with , , ,

VEX Robotics World Championship Firmware Update

without comments

VEX Robotics has released the following information on their website:

The VEX Robotics technical support team has identified an issue that some competition teams are experiencing in which the Cortex Microcontroller is unable to resume VEXnet link after a Microcontroller reset.

To help eliminate this issue at the VEX Robotics World Championship we are releasing a special version of the VEX Firmware, specifically for World Championship teams (3.21_Worlds). This firmware version modifies the Cortex re-initialization to help the VEXnet link reconnect in the event of a reset (i.e. caused by VEXnet Key “jostling”, power interruption, battery brownout, or static).

We know that competition teams dislike updating firmware so close to an event, so we are publishing this update in the hopes that teams will have a chance to test it “at home” before coming to VEX Worlds. If you’re comfortable with the new version, we strongly urge you to use it at the World Championship to help prevent potential problems related to a Cortex reset.

This firmware only updates a “back end” relinking protocol and it does not affect anything related to robot performance — you don’t need to tweak your autonomous mode, or anything like that.

Visit the VEX Forum thread on this firmware release for more discussions and to post any questions or concerns.

Download the 3.21_Worlds Firmware Update.

We’ve done an array of tests and the firmware is compatible with ROBOTC 3.08. User jpearman of the VEX Forums has also posted his test results, here.

We recommend that all competition teams update to ROBOTC 3.08 and use the 3.21 Worlds firmware. The firmware can be downloaded using the VEXnet Firmware Upgrade Utility, or ROBOTC using the following procedures:

1) Connect the Cortex to the Computer over USB

2) Switch the ROBOTC Menu Level to Expert:

3) Go to Robot > Download Firmware > Master CPU Firmware > Choose File…

4) Navigate to VEXnet Firmware Upgrade folder in your Program Files directory and select “CORTEX_V3_21_Worlds.BIN”.

5) Press Open to open the firmware and begin the download process.

6) Once the CORTEX_V3_21_Worlds.BIN Master firmware has finished downloading, you should also download the ROBOTC firmware. Go to Robot > Download Firmware > Manually Update Firmware > ROBOTC Firmware > Standard File.

Written by Jesse Flot

April 5th, 2012 at 3:59 pm

Major Improvements in ROBOTC 3.05 for VEX Cortex

without comments

ROBOTC 3.05 contains a number of enhancements that should be very exciting for VEX Cortex users. This is a free update for all ROBOTC for Cortex and PIC users (yes, even if you were using 2.3x)!

The ROBOTC 3.05 installer now includes the VEX Cortex and Prolific USB-to-Serial drivers. You no longer need to remember to download and install these separately.

We’ve heard your feedback! The new “Automatically Update VEX Cortex” option will detect if your Cortex is out-of-date, and automatically download the latest version of the Master CPU and ROBOTC Firmware files if needed. There’s no need to go through the long process of manually downloading each firmware, or put the VEX Cortex in “bootload” mode! The same functionality has been implemented for the VEXnet Joysticks as well.

Also included is a new version of the Master CPU Firmware from VEX Robotics. This version restores the functionality from the 2.x firmware, which allowed programs to run even when VEXnet was turned on (but not used).

New Standard Models! Standard models for the popular Robotics Academy robots and PLTW Training Testbeds have been added, and can be used to automatically configure all of the motors and sensors, hassle free.

New and improved sample programs! New sample programs for the VEX Mecanum Wheels and Line Tracking Kit have been added. others have been improved.

You now have the ability to give your robot a custom name. This will be a crucial enhancement for competition teams, and should be helpful for classroom settings, too.

Written by Jesse Flot

January 13th, 2012 at 12:15 pm

VEX Mecanum Drive using ROBOTC

with one comment

One cool new product for the VEX Robotics system are the VEX Mecanum Wheels.

Where traditional wheels only allow your robot to move forward, backward, and turn, mecanum wheels allow your robot to  move in all four directions -  forward, backward, left and right, while still maintaining the ability to turn. Your robot is able to accomplish this thanks to their unique design. Each wheel (which must be connected to its own, independent motor) contains rollers offset by 45 degrees from the wheel and the robot’s drive train. Instead of the motors introducing force in just the forward-backward directions, each wheel introduces force at 45 degree angles (45, 135, 225, 315). The force vectors of the different wheels can then be combined and/or cancelled out to create motion in the X and Y axis.

Here’s video of the Mecanum wheels in action (the code running on the robot can be found later in the post):

To give the wheels a test run, we built the robot below. Notice that if you’re looking down on the robot, the spokes or rollers of the wheels should point inward to create an X. If you’re looking at the bottom of the robot, they should point out to create a baseball diamond. There are two sets of two wheels - all four are not identical.

[scrollGallery id=4]

When you decide to incorporate your own mecanum drive system, be sure to follow the X/diamond rule or your robot will not behave as expected. Also know that equal weight distribution and consistent build quality are far more important when working with a mecanum drive. Remember that the robot moves based on adding and/or cancelling out the different force vectors produced by the four individual motors – if one or two motors can’t match the others the entire motion of the robot will be thrown off.

A fairly simple program can be written  to test the mecanum drive system. This program will use the left joystick on the remote control to move the robot forward-backward and right-left. The X axis on the right joystick will control the rotation of the robot.

#pragma config(Motor,  port2,           frontRight,    tmotorNormal, openLoop)
#pragma config(Motor,  port3,           backRight,     tmotorNormal, openLoop)
#pragma config(Motor,  port4,           frontLeft,     tmotorNormal, openLoop, reversed)
#pragma config(Motor,  port5,           backLeft,      tmotorNormal, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*+++++++++++++++++++++++++++++++++++++++++++++| Notes |++++++++++++++++++++++++++++++++++++++++++++
Mecanum Drive - Basic
- This program allows you to remotely control a robot with mecanum wheels.
- The left joystick Y-axis controls the robot's forward and backward movement.
- The left joystick X-axis controls the robot's left and right movement.
- The right joystick X-axis controls the robot's rotation.

[I/O Port]          [Name]              [Type]                [Description]
Motor Port 2        frontRight          VEX Motor             Front Right motor
Motor Port 3        backRight           VEX Motor             Back Right motor
Motor Port 4        frontLeft           VEX Motor             Front Left motor
Motor Port 5        backLeft            VEX Motor             Back Left motor
--------------------------------------------------------------------------------------------------*/

task main()
{
//Loop Forever
while(1 == 1)
{
//Remote Control Commands
motor[frontRight] = vexRT[Ch3] - vexRT[Ch1] - vexRT[Ch4];
motor[backRight] =  vexRT[Ch3] - vexRT[Ch1] + vexRT[Ch4];
motor[frontLeft] = vexRT[Ch3] + vexRT[Ch1] + vexRT[Ch4];
motor[backLeft] =  vexRT[Ch3] + vexRT[Ch1] - vexRT[Ch4];
}
}

The program above, however, isn’t perfect. If the joysticks don’t center perfectly at zero, or if the driver unintentionally moves the joysticks along multiple axis, the movement of the robot will be thrown off. With a few variables and a little bit of logic, we can ignore these erroneous values and provide smoother control of the robot:

#pragma config(Motor,  port2,           frontRight,    tmotorNormal, openLoop)
#pragma config(Motor,  port3,           backRight,     tmotorNormal, openLoop)
#pragma config(Motor,  port4,           frontLeft,     tmotorNormal, openLoop, reversed)
#pragma config(Motor,  port5,           backLeft,      tmotorNormal, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*+++++++++++++++++++++++++++++++++++++++++++++| Notes |++++++++++++++++++++++++++++++++++++++++++++
Mecanum Drive with Deadzone Thresholds
- This program allows you to remotely control a robot with mecanum wheels.
- The left joystick Y-axis controls the robot's forward and backward movement.
- The left joystick X-axis controls the robot's left and right movement.
- The right joystick X-axis controls the robot's rotation.
- This program incorportes a threshold/deadzone that allows very low Joystick values to be ignored.
This allows the robot to ignore values from the Joysticks when they fail to center at 0,
and provides a margin of error for the driver when they only want the robot to move in one axis.

[I/O Port]          [Name]              [Type]                [Description]
Motor Port 2        frontRight          VEX Motor             Front Right motor
Motor Port 3        backRight           VEX Motor             Back Right motor
Motor Port 4        frontLeft           VEX Motor             Front Left motor
Motor Port 5        backLeft            VEX Motor             Back Left motor
--------------------------------------------------------------------------------------------------*/

task main()
{
//Create "deadzone" variables. Adjust threshold value to increase/decrease deadzone
int X2 = 0, Y1 = 0, X1 = 0, threshold = 15;

//Loop Forever
while(1 == 1)
{
//Create "deadzone" for Y1/Ch3
if(abs(vexRT[Ch3]) > threshold)
Y1 = vexRT[Ch3];
else
Y1 = 0;
//Create "deadzone" for X1/Ch4
if(abs(vexRT[Ch4]) > threshold)
X1 = vexRT[Ch4];
else
X1 = 0;
//Create "deadzone" for X2/Ch1
if(abs(vexRT[Ch1]) > threshold)
X2 = vexRT[Ch1];
else
X2 = 0;

//Remote Control Commands
motor[frontRight] = Y1 - X2 - X1;
motor[backRight] =  Y1 - X2 + X1;
motor[frontLeft] = Y1 + X2 + X1;
motor[backLeft] =  Y1 + X2 - X1;
}
}

Both of the above pieces of sample code will be included in ROBOTC 3.05. The VEX Mecanum wheels, along with all of your hardware needs can be purchased from the Robomatter store.

Written by Jesse Flot

November 22nd, 2011 at 2:36 pm

3rd Party Sensors with VEX: Sharp IR Rangefinder

without comments

The VEX Robotics System includes a growing, powerful set of official sensors. That said, the electronics world is overflowing with other types of cool and useful sensors. The great news is, both the VEX PIC and the VEX Cortex microcontrollers are extremely versatile and can be used with many of these sensors. Both the VEX PIC and VEX Cortex can be used with Analog Sensors that operate between 0 and 5 volts (+/- .5 volts), and have Power, Ground, and Signal lines.

One such sensor is the Sharp GP2D12 IR Rangefinder.

The Sharp IR Rangefinder allows your robot to determine distance from the nearest object, much like the VEX Ultrasonic Rangefinder. Unlike the VEX Ultrasonic Rangefinder, which uses  sound waves to measure distance, the Sharp IR Rangefinder uses infrared light. On one side of the sensor an infrared LED shines a beam of light, which is reflected back by the closest object, and detected by the receiver on the other side of the sensor. The sensor then uses a method called triangulation to determine how far away the object was.

The basis for triangulation is that objects at different distances will reflect the infrared beam back to the receiver at different angles. The varying angles produce different voltage levels in the sensor, and in turn sensor values that can be used to calculate distance. See below:

The Sharp IR Rangefinder provides very reliable distance values ranging from 10 to 80 centimeters away. One big advantage with using the IR Rangefinder is that it’s not affected by soft for angled objects that cause the VEX Ultrasonic Rangefinder to fail.

One challenge with using the sensor is that the raw values provided do not directly correlate to useful distance values, and they’re also non-linear. This means that we must perform a calculation on the raw sensor data first. Documentation for the sensor tells us that we can calculate the distance using the following formula:

Voltage = 1 / ( Distance + 0.42 )

Which, when rearranged gives us:

Distance = (1/Voltage) – 0.42

One additional challenge is that we can’t directly access the voltage returned by the sensor in our program. What we can access is the sensor value, which is proportional to the voltage – we’ll just have to take a conversion factor into account.

Below is a sample program written for the Sharp IR Rangefinder. It contains the function “IRValue()” which will perform the necessary calculation and return the useful distance data, in centimeters. Note that the “sensorPotentiometer” type was used, since there is no “IR Rangefinder” sensor type in ROBOTC, and the Potentiometer type will return the full, unmodified analog data (unlike other sensor types like the Gyro).

#pragma config(Sensor, in5,    sharp,               sensorPotentiometer)
#pragma config(Motor,  port2,           rightMotor,    tmotorNormal, openLoop, reversed)
#pragma config(Motor,  port3,           leftMotor,     tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

//Function uses data from the IR Rangerinder to calculate and return distance
int IRValue(tSensors sensorPort, float conversionFactor = .0000469616, float k = .42)
{
return (1.0 / (SensorValue[sensorPort] * conversionFactor)) - k;
}

task main()
{
wait1Msec(2000);
clearLCDLine(0);
clearLCDLine(1);

//While true...
while(true)
{
//If the robot is greater than 25 cm away...
if(IRValue(sharp) > 25)
{
//Move Forward
motor[rightMotor] = 30;
motor[leftMotor] = 30;
}
else
{
//Stop
motor[rightMotor] = 0;
motor[leftMotor] = 0;
}

//Display IR Sensor Data to LCD
displayLCDString(0, 0, "IR Value:");
displayLCDNumber(0, 9, IRValue(sharp), 3);
displayNextLCDString("cm");
}
}

Our Sharp IR Rangefinder was previously configured wired for an older microcontroller called the Handy Board. Like the VEX Cortex and PIC, it had wires for Power, Ground, and Signal, so we were able to use simple jumper wires to adapt it for the Cortex.

Front of the robot with Sharp IR Rangefinder:

Top of the robot, with connection from Sharp IR Rangefinder to VEX Cortex Analog Port 5:

And finally, here’s a video of the code from above running on the robot:

For more information on interpreting and using the data provided by the Sharp IR Rangefinder, check out this tutorial.

Written by Jesse Flot

November 8th, 2011 at 11:13 am

Programming the VEX Gyro in ROBOTC

with one comment

The new VEX Yaw Rate Gyro is one of the more sophisticated sensors in the VEX Robotics System – but it’s also one of the most useful and powerful. Among other things, the Gyro allows your robot to make very precise, consistent turns.

Other sensors, like the Shaft Encoders, allow you to control your robot’s turns… but indirectly. The Shaft Encoders can measure the rotation of the axles (or shafts) of your robot’s drive train. By monitoring how much the axles spin, you can also monitor and control how much your robot moves forward or turns. (As a side note, some great tutorials on using the Shaft Encoders to do just that can be found in the Movement section of the VEX Cortex Video Trainer.)

The Gyro, on the other hand, actually measures the rotation of your robot. Factors such as wheel slippage and varying surface friction that cause inconsistencies with Shaft Encoder-based turns are far less problematic with the Gyro; your robot will turn until it reaches the target you set – no matter how much the wheels slip or how long it takes!

There are a number of different ways that electronic Gyros work. The VEX Gyro includes a sensing element kept in continuous oscillation which reacts when angular rate is applied, based on the “Coriolis effect”. The Coriolis effect is a deflection of moving objects when they are viewed in a rotating reference frame. In a reference frame with clockwise rotation, the deflection is to the left of the motion of the object; in one with counter-clockwise rotation, the deflection is to the right. This effect is caused by the rotation of the Earth and the inertia of the mass experiencing the effect.

Thus, the Gyro is able to detect whether the robot is turning clockwise or counter-clockwise and provide different sensor values based on how much it’s been rotated. For a more thorough explanation of the Coriolis effect, visit this Wikipedia article. For more technical information on the on the internals of the VEX Gyro, you can check out its datasheet.For this tutorial, we mounted the VEX Gyro on our Swervebot robot model and connected it to Analog port 8 on the Cortex.

ROBOTC includes a number of sample programs for the Gyro. You can open the sample program below by going to File > Open Sample Program > Gyroscope > “Gyro Based Turns – Basic.c”.

A few additional notes about the Gyro and the program:
  • Typically all sensors are configured in ROBOTC using the Motors and Sensors Setup window. This can still be done with the Gyro, but lines 23-28 do so manually. The Gyro is an extremely sensitive sensor – it’s readings are affected by heat, fluctuations in voltage, and how long the sensor has been in use. These factors cause the sensor to accumulate an error, or drift, over time. By setting Analog Port 8 to “sensorNone” on line 24, all of the drift is wiped out from previous runs. The sensor is then reconfigured as a “sensorGyro” on line 27.
  • After the Gyro is configured on line 27, it’s very important that your robot is kept completely still for at least 1.1 seconds. During this time, ROBOTC and the Gyro perform a calibration process. The 2-second wait on line 28 is more than enough time for this process to occur.
  • There is a small amount of variance between each Gyro. ROBOTC has default values used for scaling the readings from the VEX Gyro into useful SensorValues, but you may need to make a slight adjustment for your sensor. The “SensorScale[]” command (commented out on line 31) allows you to do just that. If you find that your robot is turning too far or too little, un-comment line 31 and adjust the “260″ value as needed.
  • As the Gyro is turned, the values it returns are in tenths of degrees, positive and negative. Thus, a SensorValue of 3600 equals 360 degrees, or one full rotation. When the sensor is mounted horizontally, counter-clockwise movements will return values from 0 to -3600; clockwise movements will return values from 0 to 3600. Once the gyro completes one full revolution, the sensor value will “roll-over” to 0 by default (for example: …3597, 3598, 3599, 3600, 0, 1, 2, 3,…). To change the “roll-over” point, un-comment line 33 and change the value of “SensorFullCount” from 3600 to the desired value (7200, 18000, ect)
  • For a much more thorough explanation of the program, check out the tutorial video we produced, here.
#pragma config(Motor, port2, rightMotor, tmotorNormal, openLoop)
 #pragma config(Motor, port3, leftMotor, tmotorNormal, openLoop, reversed)
 //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

/*+++++++++++++++++++++++++++++++++++++++++++++| Notes |++++++++++++++++++++++++++++++++++++++++++++
 Gyro Based Turns - Basic
 -This program instructs your robot to turn for the specified number of degrees in "degrees10".
 -For best sensor results, clear out the gyro and manually configure it at the begging of the code.
 -The Gyro is configured by default to provide values from 0 to -3600 for clockwise rotation,
 and 0 to 3600 for counter-clockwise rotation

Robot Model(s): Swervebot

[I/O Port] [Name] [Type] [Description]
 Motor Port 2 rightMotor VEX Motor Right side motor
 Motor Port 3 leftMotor VEX Motor Left side motor
 Analog Port 8 in8 VEX Gyro Top-center mounted,
 away from the Cortex
 --------------------------------------------------------------------------------------------------*/

task main()
 {
 //Completely clear out any previous sensor readings by setting the port to "sensorNone"
 SensorType[in8] = sensorNone;
 wait1Msec(1000);
 //Reconfigure Analog Port 8 as a Gyro sensor and allow time for ROBOTC to calibrate it
 SensorType[in8] = sensorGyro;
 wait1Msec(2000);

//Adjust SensorScale to correct the scaling for your gyro
 //SensorScale[in8] = 260;
 //Adjust SensorFullCount to set the "rollover" point. 3600 sets the rollover point to +/-3600
 //SensorFullCount[in8] = 3600;

//Specify the number of degrees for the robot to turn (1 degree = 10, or 900 = 90 degrees)
 int degrees10 = 900;

//While the absolute value of the gyro is less than the desired rotation...
 while(abs(SensorValue[in8]) < degrees10)
 {
 //...continue turning
 motor[rightMotor] = 25;
 motor[leftMotor] = -25;
 }

//Brief brake to stop some drift
 motor[rightMotor] = -5;
 motor[leftMotor] = 5;
 wait1Msec(250);
 }

Here’s a video of the robot moving, based on the code:

And again, just in case you missed it, a more detailed explanation of the program can be found in this tutorial video:

The VEX Gyro can be purchased from the RoboMatter store.

Written by Jesse Flot

October 13th, 2011 at 5:08 pm

Posted in Cortex,General News,VEX

Tagged with , , ,

Controlling the MINDS-i Lunar Rover with a VEX Cortex

with one comment

Article written by Steve Comer

Remote control cars are great for having fun. They can be driven off-road, taken off jumps, and raced among other things. VEX robots are great for learning. They can be used to teach programming, math, problem solving, and other engineering skills. What do you get if you put them together??

Well, I can tell you. You get a rugged 4WD truck that is still tons of fun to drive around outside, but can also be used as a teaching tool.

Follow this link for more photos: http://s1081.photobucket.com/albums/j353/comeste10/VEX%20Rover%20Extras/

I started off with a MINDS-i Lunar Rover kit which is driven by a 7.2V DC motor and steered with a standard hobby servo. I removed the solar panel from the Rover and in its place put a VEX Cortex microcontroller and an LCD screen. On each side, I attached a VEX flashlight from the VEXplorer kit and I mounted an ultrasonic sensor to the front. It just so happens that VEX bolts and nuts fit quite easily into the beams of the MINDS-i rover.

I did all the programming in RobotC. See bottom of the page to view my RobotC code.

In order to control the stock motor and servo with the Cortex, I had to make a few modifications. I soldered the two wires to a 2-pin head which I then connected to the Cortex with a VEX motor controller.

For the servo, I used three single male-to-male jumper cables.

The video demonstrates the rover in autonomous mode where it makes use of the ultrasonic sensor to avoid bumping into walls. Remote control is also demonstrated using the VEXnet controller over Wi-Fi.

This is just a small sampling of the possibilities with this combination type of platform. Don’t let my initial direction limit you. It would be great to see some new combination robots. Get out there and start building!

This is my RobotC Code for the behaviors seen in the video.

AUTONOMOUS MODE:


#pragma config(UART_Usage, UART2, VEX_2x16_LCD)
#pragma config(Sensor, dgtl1,  sonar,               sensorSONAR_inch)
#pragma config(Motor,  port1,           L,             tmotorServoStandard, openLoop)
#pragma config(Motor,  port2,           servo,         tmotorNormal, openLoop)
#pragma config(Motor,  port3,           drive,         tmotorNormal, openLoop)
#pragma config(Motor,  port10,          R,             tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
/////////////////////////////////////////////////////////////////////////
//  Author  : Steven Comer//  Program : Rover drives straight until near an object, it then slows,
//            stops, then backs up and turns.
//  Updated : 8 June 2011 @ 10:20 AM
/////////////////////////////////////////////////////////////////////////
task main()
{

  //pause at start and turn on headlights
  wait1Msec(2000);
  motor[R] = -127;
motor[L] = -127;
while(true)
{
clearLCDLine(0);
    displayNextLCDNumber(SensorValue(sonar), 3);

    //++++++++++++++++++++++++++++++CLEAR++++++++++++++++++++++++++++++++
if( SensorValue(sonar) > 20 || SensorValue(sonar) == -1 )
{
motor[servo] = -2;
motor[drive] = 50;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++APPROACH++++++++++++++++++++++++++++++
else if( SensorValue(sonar) <= 20 && SensorValue(sonar) > 15 )
{
motor[drive] = SensorValue(sonar) + 25; //power decreases
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++STOP AND TURN+++++++++++++++++++++++++++
else if( SensorValue(sonar) <= 15 )
{
//stop
motor[drive] = 0;
wait1Msec(500);
//back and turn
motor[servo] = random[50] + 60;
     //random degree
motor[drive] = -50;  //random power
wait1Msec(1000);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 }
}

REMOTE CONTROL MODE:


#pragma config(UART_Usage, UART2, VEX_2x16_LCD)
#pragma config(Sensor, dgtl1,  sonar,               sensorSONAR_inch)
#pragma config(Motor,  port1,           L,             tmotorServoStandard, openLoop)
#pragma config(Motor,  port2,           servo,         tmotorNormal, openLoop)
#pragma config(Motor,  port3,           drive,         tmotorNormal, openLoop)
#pragma config(Motor,  port10,          R,             tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//
/////////////////////////////////////////////////////////////////////////
//  Author  : Steven Comer
//  Program : Remote control rover with VEXnet controller
//  Notes   : Throttle is Ch 2 (right joystick)
//            Steering is Ch 4 (left joystick)
//            Headlights are Ch 5U/5D and 6U/6D (on/off)
//  Updated : 10 June 2011 @ 12:30 PM
/////////////////////////////////////////////////////////////////////////
task main ()
{
 while(true)
{
//right headlight
if(vexRT[Btn6U] == 1)
motor[R] = -127;
if(vexRT[Btn6D] == 1)
motor[R] = 0;
//left headlight
if(vexRT[Btn5U] == 1)
motor[L] = -127;
if(vexRT[Btn5D] == 1)
motor[L] = 0;
//driving
motor[servo] = vexRT[Ch4];   //steering
motor[drive] = vexRT[Ch2];   //throttle
//LCD screen
displayLCDCenteredString(0,"VEX");
displayLCDCenteredString(1,"ROBOTICS");
}
}

Written by Jesse Flot

June 9th, 2011 at 3:31 pm

Posted in Cool projects,VEX

Tagged with , ,