Programs Home Page Home Page
Tutorial for Storming Robots Students

LEGAL USE (MUST READ)

Unless otherwise noted, Storming Robots retains with copyrights under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0; pursuant from the day this document was published by Storming Robots. You may copy, distribute and transmit the work IF AND ONLY IF appropriate credit is provided, and changes were made only under Storming Robots' permission.See the Legal Code under the Creative Commons
"
- by Elizabeth Mabrey -

Computer Science and Engineering

Note: This was written mainly for SR's Algorithms in C/C++ students for reference, not meant to be a detailed tutorial. Go here to see detailed syllabus for this track.


Computer Science - Computational Programming

- last update - Dec/2016

Intro to Computer Science and Engineering

Module 1: Warm up - Bare Basics. and Basic IO

Module 2: Basics in Control Structure and Functions

Module 3: Basics in Array and Functions

Modue 4: Recursion vs. Iteration

Module 5: Advanced pointers / string Functions

Module 6: Struct, and Union

Other more advanced topics, such as stack/queue and many other algorithms will be covered in Level II+ in the Algorithms in C/C++ track.



Using Eclipse as the IDE

Command Line Build: Build your files without using the IDE..

AP Computer Science (OOPS-Java).   Exercises.

Programming Style and Troubleshooting (with hardware) Guide (coming soon!)


Links from other websites which I found very useful:


The C Library Reference Guide -- a reference on the C language and its standard library.

comp.lang.c FAQ- covering many of C's complicated corners and idiosyncrasies

Coming soon : Sorting and Searching + USACO Exercises
 

RobotC  /  Robotics


NOTE:   RobotC IDE, by the CMU Robotics Academy, comes with a rich set of samples. You should be able to consult its sample directories at ease.  Use the New Help feature from version 4.X.  Be resourceful!

This tutorial is written mainly for Storming Robots students to perform further review and exercises at home. Tutorials are meant to compliment the guidance of robotics projects conducted in our Robotics Engineering Program, not meant for completely self-taught.   However,  those students who have taken Algorithms in C/C++ with us will find the tutorial very intuitive to follow .

RobotC
Packet

Samples

Should review the Packet  on the left before you
download the samples below.

Graphical RobotC Packet

- updated - Nov/2016 -


Additional Challenge

For VexIQ

RobotC for VexIQ Packet

- updated - August/2015 -
 
A simple Programming Style Checklist for robotic project students.


RobotC Packet I

- last updated - December/2016

The following files are all in zip format. Some of these samples contain error files which you are supposed to correct.

to correct.

Download Chapter 1 Samples   Download Chapter 2 Samples

Download Chapter 3 Samples  Download Chapter 4 Samples

Download Chapter 5 Samples   Download Chapter 6 Samples

Download Chapter 7 Samples   Download Chapter 8 Samples

After you complete Chapter 1, download these files and fix the errors. 

After you complete Chapter 2, download these files and fix the errors. 

A reference table to use RobotC 's pragma

Note: Found Errata - please Email us .


Color Sensor Sample (for  EV3 and NXT). - <updated in December, 2016)

 


RobotC Packet II

- updated - Dec/2014

The following files are all in zip format.
  • some of these samples contain error files which you are supposed to correct.

Download Chapter 1 Samples   Download Chapter 2 Samples

Download Chapter 3 Samples   Download Chapter 4 Samples

Download Chapter 5 Samples   Download Chapter 6 Samples (w/ Data Logging)

 Applied Gear Math


You should not pass this point until you are complete with the Packet I and II above.   The following samples were written with the assumption that you have already had satisfactory skill level from the Packet I & II. Some of them were written for students who have already taken algorithm in C with us (past the pointer chapter).

The following samples may have been written with older RobotC version. Therefore, do not expect they all compile perfectly. However, if you have worked through Packet I and II, you should not have difficulty in making necessary modification to make them  work.

other I2C Sensors
- updated -
May/2016

 Find Light Array samples from RobotC's installation  - from "File > Open Sample programsNXT > 3rd Party Sensor Drivers" - look for mindsenosor  array samples.

Here is a sample calibration program

Notes:  Finishing up to Packet II from above will help to understand samples from RobotC with ease.  In addition, you may find files won't compile due to small changes in more latest versions of RobotC.  However, if you have thorough understanding in Packet II, you should have no issue in fixing these errors.

Whenever you use a new sensor, you should always understand its behavior by performing data logging.    Consult Chapter 6 in Packet II.

Special Note:

Mindsensors created a I2C adapter module which allows :
- connect NXT with EV3 sensors
- connect EV3 with multiple sensors on its' port splitter.

Here is a video to show you how to scan it using the I2C scanner tool.
Test Your I2C sensors on a Mindsensor Splitters


Compass Sensor
Interface Packet


- updated - Jan/2013

Exercises

  • csSimple.c: Simple operation on compass sensor data.
  • csGoDir.c :  your controller only terminates when it faces west no matter which direction it faces at the startup time.
  • csReturn.c: your controller only terminates when it returns back to the direction where it faces at the startup time.
  • You must calibrate first. Read the packet on the left.

After playing with the samples, you should make the modification yourselves:
  • csGoDir.c :  add in motor navigation code to make your robot turn to west no matter which direction it faces at the startup time.
  • csReturn.c:  add in motor navigation code to make your robot turn back to the direction where it faces at the startup time.

RobotC -Interface with I2C devices



RobotC - I2C Interface Packet I

- updated - July/2014

Document covers :

  • Binary vs. Hexdecimal vs Decimal conversion
  • Bit-wise Math Operations
  • Bit-shift Operations
  •  RobotC  Native I2C APIs
  • HiTechnic Accelerometer/Tilt Sensor specifics
  • HiTechnic IR Seeker Sensor specifics
  • HiTechnic Sensors MUX Device specifics

Sample I2C device code (using I2C Samples and common libraries files):

Accelerometer Sample Library
(contains the two main sample functions to interface with Accelerometer)

Accelerometer Sample Test (must download the Sample Library as well)


I2C interface - Packet II


 
 This packet gears toward cross-platform communication with NXT as the master controller and Arduino as the I2C slave controller. This will allow NXT to interface with non-NXT digital and analog sensors and devices.

Sample Codes - NXT as the master device, and Nano as the slave device


I2C RobotC-Arduino Packet

Use this packet if you want to :
-  interface Mindstorms NXT with Arduino via I2C.
-  create your own Arduino based combo sensors device, ie. using  Arduino as  I2C slave device. 
Bluetooth Interface

- updated - June/2014
Assumption:
  • Should have two controllers (NXT bricks), one for the hand held controller (the master), another one is the robot car (the worker).
  • Have manually established the bluetooth connection from the master brick to the worker brick.

Exercises

  • btSender.c : send one byte counter to the receiver via bluetooth
  • btReceiver.c : receive the one byte counter from the sender via bluetooth
  • btSearchNConnect.c : master device performs search and connect when the device is not connected.

After playing with this communication, you should make modification to perform the following:
  • btSender.c : make this a hand-held controller unit. Incorporate the buttons control as the control switches which will dictation how the receiver bot navigate. e.g.:
    • left button == move left
    • right button == move right
    • enter button == backup, etc.
  • btReceiver.c : make this a moving engine.  After receiving the one byte counter from the sender via bluetooh, it should decode the byte and navigate accordingly.
 
GPS Data Streaming


   TBD.
Check out the Multi-agent site  and
RobotC/CMU 's firewiki site.

IR Seeker

- updated - Jan/2011


To use the  HiTechnic specific driver library codes,  you need to:
- access the drivers from the RobotC IDE:
  • click on "File" --> "Open Sample Program"
  • click on "3rd Party Sensor Drivers" -->"Drivers"
  • copy the following files into your working directory:
    • "common.c"
    • "HTIRS2-driver.c"

- Download this I2C - InfraRed Seeker Sample

To write your own I2C interface without using the HiTechnic driver library, see samples:

Arduino Learning


Arduino/PI


Arduino Helper Document. (used for our roboclub and summer workshops)

Go to Resources link to learn more on the hardware/software required; and some recommendation on books, etc.

Raspberry PI -


Networking Packet

Samples - will be posted.


Interface NXT with another platform (essentially creating a hybrid platform with HiTechnic ProtoType Board)



More options will be added in the future. For the time being, we are using the Hitechnic Super Prototype Board.

You may download the Prototyping Guide here (from HiTechnic).  This document is copied here in December of 2012.  You should always check to see if it offers any update at its website.

You will either write your own driver code or use the driver codes available from www.BotBench.com. These 2 files are:
- common.h
- hitechnic-superpro.h

Open this NXT Hybrid Supplemental Online Document to learn about how to interface this platform.

If you are advanced users, you should always learn the lower level apis without using its default driver libraries.  SR will provide more sophisticated samples at Roboclub when students are ready for them.

Here is a link to a  Hitechnic Super Prototype Board Fritzing part.  

RobotC Virtual World

Installation &
License Activation
NOTE: Scope of this section is limited to "how to run the RVW tool for Level B to II Robotics Club Exercises". This is not for SR's more advanced projects, nor is this a robotic programming tutorial. For programming tutorial, use the RobotC Packet I or Graphical RobotC Packet above.

The RVW tool is very self-explanatory and user-friendly. Therefore, students with the basic skills set should be able to self-learn and navigate around the tool; and utilize the full potential of the this virtual software.

Download and install RVW (select "LEGO" one)

Download and install RVW Level Builderfor creating your virtual field.

Download and install the Challenge Pack for more additional fun activities.

Need to activate licence after installation

  1. Start the RobotC Virtual World IDE.
  2. Click on Help --> Add License
  3. Select Product: ROBOTC Robot Virtual Worlds
  4. Enter Your license Id and Your password
  5. Click on Activate Online
Practice their work The following links serve as samples to get the students started. The Robot Virtual World offers a game like environment to enable students to learn robotics programming without the cost of a physical robot.

When they are at the center, they will have the opportunity to actually interact with a physical robot. With a physical robot, they will gain more in-depth insight where mechanical and physical environment come into play as well.

  Execute your Basic Movements code with the default field Challenge. Students should create own code to execute at the default field.

  Customize your own Square Race Movements Test Field. Students customize a Square field for testing.

  Execute your movements code with a custom Square Race field. Students execute their own Square Race Movements code at their customized field.

  Execute your line tracing code with a customed built Line Tracing field.Another sample for students to run their line tracing code at their own customized field.

What Ifs...
  • I want to switch machines after installation?
    Since this is a special 180-days license, you will not be able to transfer the license to another machine. You will need to purchase a new one with only $10.

    (Please do note that SR absorbs much cost in order for us to offer you this learning tool at such low cost. We are subject to the restriction dictated by the RobotC Virtual World provider. )

  • I could not find the RVW Level Builder or Challenge Pack feature?
    1. Start the RobotC Virtual World IDE.
    2. Click on Robot --> Compile Target --> Virtual World
    3. Click on Robot --> Platform Type --> LEGO Mindstorms EV3
    4. Click on Window --> Select Virtual World To Use --> Download More Packages
    5. Select RVW Level Build, and/or Challenge Pack for EV3 and/or Curriculum Companion

IMPORTANT NOTE: For any other technical questions in using additional features about Virtual World, please contact support@robotc.net.

Eval Questions Graphical RobotC

(TBD) RobotC


Storming Robots at Twitter Storming Robots at Facebook Storming Robots News robochannel Storming Robots SiteMap Contact