Archive for the ‘sensor’ tag
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
In years past, the science and art fields were generally considered to be diametrically opposed; if something was scientific it usually didn’t have artistic value, and if it was a work of art it probably didn’t do much for the scientific community. Recently, though, the line between art and science has been blurred and blended in some very unique and interesting ways.
A prime example of this is a color-sensing “Coltar” made by Youtube user PhilippLens. By mixing imagination with ingenuity, PhilippLens created the hybrid guitar using a LEGO Mindstorms NXT brick with a color sensor and two touch sensors (one on the Coltar itself, the other on the ‘pick’). Using the touch sensors to control chords and the color sensor to control which notes are being ‘strummed’ allows the Coltar to emit a surprisingly large range of notes.
More 3rd party 3rd party drivers
Does a 3rd party 3rd party driver make it a 4th party? I’m not sure, you decide. In any case, my good man Gus at HiTechnic has provided a very nice driver for the new HiTechnic Super Pro Board. Thanks for that!
I also added a driver for the totally awesome Mindsensors Touch Panel sensor and their very versatile Sumo Eyes sensor. Big thanks to Mindsensors for providing me with the sensors! The Touch Panel driver still needs a bit of work; I need to add the ability to calibrate it and allow the gesture code. I’ve made a start but I’m still trying to figure out exactly how they work. I tried calibrating it once and that really messed it up. A simple factory reset fixed it, of course, no permanent damage was done, just some mild panic on my side and me thinking I had killed my panel (I was not a happy camper, trust me!). Deepak from Mindsensors had a quick fix which was actually in the docs, if I had bothered to read them a bit more carefully. Note to self: Read The Fine Manual! Oh and don’t calibrate the panel, it’s really not necessary. Trust me.
* common.h: added better round() function
* DIMU-driver.h: fixed signed to unsigned conversion
* LEGOUS-driver.h: fixed boneheaded I2C address error
* Added MSSUMO-driver.h for Mindsensors SumoEyes sensor + test program
* Added MSTP-driver.h for Mindsensors TouchPanel sensor + test program
* Added HTSPB-driver.h: for HiTechnic Super Pro Board + tonnes of examples
* HTMAG-test1.c: cleared up some things in test program
Where can I download it?
You can get it at the usual place: [LINK].