Page 2
, BOTGUY, and the BOTGUY design and character are trademarks and/or service marks of KISS Institute for Practical Robotics and may not be used without express written permission. LEGO, iRobot, and iRobot Create are registered marks of their respective owners.
8. Observe Results on the KIPR Link Display __________________________________________ 14 3. Programming for the KIPR Link ________ 15 Using the C Programming Language with the KIPR Link and the KISS IDE ______________________ 15 KIPR Link Function Libraries _________________________________________________________ 17 Using Sensors __________________________________________________________________ 17...
Page 4
Writing an iRobot Create Script ______________________________________________________ 44 Example _______________________________________________________________________ 45 Code _________________________________________________________________________ 45 Sample Program for Using KIPR Link Digital Output to Light an LED __________________________ 48 Setup _________________________________________________________________________ 48 Code _________________________________________________________________________ 48 Sample Program Using a Thread for Monitoring a Sensor __________________________________ 49...
Page 5
File I/O for a USB Flash Drive Plugged into the KIPR Link ___________________________________ 50 Creating your own sensor ___________________________________________________________ 50 Tools Needed __________________________________________________________________ 52 Supplies needed ________________________________________________________________ 52 Method _______________________________________________________________________ 52 Creating your own motor ___________________________________________________________ 54 Tools Needed __________________________________________________________________ 54...
1. KIPR Link About the KIPR Link The KIPR Link is a Linux-based robot controller designed by the KISS Institute for Practical Robotics (KIPR). It is most easily accessed by installing the KISS IDE (Integrated Development Environment) on your computer, software created and maintained by KIPR to support the KIPR Link.
(or one with the same specifications) is used to charge the KIPR Link. The KIPR Link should only be charged when under adult supervision and should not be left on Link. The KIPR Link should only be charged when under adult supervision and should not be left on Link.
KIPR Link Features Color touch screen (320x240 dpi), 8 analog ports, 8 digital WiFi, 2000 mAh LiPo battery, I/O ports, 4 motor ports, 800mhZ ARMv5te CPU, FPGA, 4 servo ports imbedded Linux HDMI display port Top View speaker side button...
Turning On Your KIPR Link Plug your AC power adapter into the wall and into the back of the KIPR Link. You will see a green charger present light and a colored charge status light at the power input. Slide the power switch to the ON position to boot the KIPR Link.
If you are using OS X 10.8 (Mountain Lion), you will have make a system adjustment to allow the KISS IDE to run as an unverified app. Directions from Apple Support for doing this are on the web site http://support.apple.com/kb/HT5290.
Windows 8 DO NOT PLUG THE KIPR LINK INTO THE COMPUTER UNTIL INSTRUCTED TO DO SO! The current version of the KISS platform for Windows systems may be downloaded from http://www.kipr.org//kiss-platform-windows. Follow the following steps in order to install KISS-C on Windows 8: 1.
Downloading and Running a Program for Your KIPR Link 1. Connect the KIPR Link to your Computer Use the supplied USB cable to connect the KIPR Link to your computer and turn in on. 2. Launch the KISS IDE Click on the KISS IDE icon to launch the KISS IDE and bring up its opening screen.
IDE. Press on the file name to highlight it. 7. Compile and Run the Program on the KIPR Link Press the Run button and the program will compile, bringing up the compiler report screen.
KIPR Link and KISS IDE are ready to use for developing your own programs. The next section of this guide illustrates how to use the KIPR Link library functions and the KIPR Link user interface with KIPR motors and sensors.
C. To write a C program for the KIPR Link, set up your KIPR Link as described in the Quick Start Guide, proceeding to the "Edit/Save/Download the Program File" step. Use one of the C templates. Your program will have a file tab on the KISS IDE interface, which will have a tab labeled "* Untitled"...
Page 16
Any errors the compiler finds in your program will be displayed in a panel at the bottom of the KISS IDE window, starting with the first error encountered in the program. If you double click on an error, you will be taken to the line listed for the error.
Orientation analog ports(0-7) and digital ports (8-15) Any sensors purchased from KIPR will work with the KIPR Link. They are “keyed” so that there is only one orientation for which all of the pins will be in holes. Page 17...
Instructions for accessing the jumpers are in the appendix as are specifications for creating your own sensors. KIPR Link Library Functions for Sensors The two most basic library functions for using sensors with the KIPR Link are the analog10 and digital functions. analog10(<port#>) Analog sensors produce a varying voltage value as resistance between SEN and GND varies.
There are additional functions for sensors in the KIPR Link library, described in the appendices. These include button functions for the KIPR Link's side button, and for the virtual A, B, C, X, Y, Z buttons on the program input/output console screen.
Servo motor ports should be disabled when not in use to limit their impact on system power resources. On boot, servo ports are disabled by default. There are 4 servo ports, labeled 0, 1, 2, 3. The KIPR Link Library includes functions for managing servo ports as well as functions for operating servo motors. The basic functions are: enable_servo(<servo_port#>)
The DC drive motors sold through the KIPR online store use a two pronged plug and can be plugged into the KIPR Link motor ports in either direction. The motor port center hole is not employed. The effect of reversing the plug is to reverse the motor's − +polarity, which simply reverses motor direction.
All Off turns off power for all motor ports. off(<motor#>) Turns off power for the specified motor port. There are a number of additional motor functions in the KIPR Link library, described in the appendices. Page 22...
Standard C library function for formatting output directed to standard out (which is the program output console screen for the KIPR Link). If the string contains % codes then the arguments after the initial string (the . . . portion of the function's arguments) will be printed in place of the % codes using the format specified by the matching % code.
The KIPR Link Vision System incorporates color vision tracking and QR code identification. A USB web camera is used to provide images to the KIPR Link at a rate dependent on lighting conditions but exceeding 6 frames per second. Using the KIPR Link interface, an arbitrary number of camera configurations containing channels for color vision tracking and/or QR code identification can be defined.
Setting Up KIPR Link Color Tracking Channels The USB camera plugs into one of the USB (type A) ports on the back of the KIPR Link. Unplugging the camera while it is being accessed will usually freeze the system, requiring a reboot.
Page 26
When the selection corner is released, to facilitate further adjustment, the KIPR Link will shift the spectrum to have the current color spectrum selection in the center (the Hue spectrum cycles back to 0 after 359, so the Hue range may be from higher to lower as well as lower to higher).
HSV values for the channel. These can be adjusted by using the numeric keypad the interface brings up when a value is pressed on the KIPR Link's touch display. Manual adjustment is particularly useful when the color channel needs to discriminate among objects having related, but distinctive colors, such as the orange and red objects in the above image.
The default configuration is marked with a "star" and can be changed to any other configuration listed by highlighting the configuration and pressing the Default button. KIPR Link Vision Library Functions These are commonly used vision functions, for a complete list see the appendix. camera_open(<resolution>) Opens the camera using the currently loaded configuration.
Page 29
camera_update() Once the camera has been instantiated using camera_open, each call to camera_update will retrieve and process the current camera image. Always call this function before using any other camera functions so they reference the current data. get_object_count(<channel>) Returns the number of objects for a channel as determined by the most recent camera_update().
Sample color tracking program controlling a servo motor This sample program is a demo for using the camera on the KIPR Link to control a servo motor. If you don't have a servo motor, skip to the next example. Servo motors come with "horns" designed to fit on the motor shaft.
Code Note: For improved readability as the program executes, the Link specific function display_printf is used in place of printf, since printf will scroll the screen once it has reached the last row of the display. display_printf(<col>, <row>, <string>, . . .) Performs a standard printf starting at screen location col, row, limited to columns 0 through 41 and rows 0 through 9 (fewer rows if extra buttons are turned on).
Set Up Attach the camera to the KIPR Link. You need to set the color model on channel 0 to track an object you can move in front of the camera (the more saturated the color, the better). For best results point the camera horizontally at a grid marked off on a piece of paper so you can see the accuracy of the behavior.
Code For this program, point the camera at an 8-quadrant grid that fills the KIPR Link screen. Each motor light corresponds to an area of the grid in the pattern G G G G R R R R i.e. if the center of the largest object on channel 0 is over a particular...
Sample program for decoding a QR code This sample program is a demo that uses QR scanning Channel 1 for detecting and decoding a QR code when one is present in the camera field of view. From the Motors and Sensors .. Camera screen, aim your camera at this code and verify it is being seen on Channel 1.
Central Standard Time, or email support@kipr.org. Problem Solution Plug your KIPR Link into the charger. At the plug point a red LED should be visible indicating the charger is correctly plugged in. A green charge status LED should also come on indicating the KIPR Link battery is My Link does not turn on.
Page 36
OS 10.5 (or newer) or Windows. Turn on your KIPR Link. Check to make sure that the KIPR Link is listed in the System Profiler. If the KIPR Link My KIPR Link is not recognized by my Mac running OS is not listed there, check to make sure your USB cable is 10.5 (or newer).
Page 37
COM port and select Uninstall to purge it. The KISS IDE has been verified to run on all of the listed systems, but variations among system configurations may in some instances prevent a communications link from being established until minor adjustments are made.
Step 4: Unplug any motors, servos, or sensors from your KIPR Link and plug in the AC adapter. Power off the KIPR Link, then plug the USB drive into one of the two USB ports on the back of the controller.
Controlling an iRobot Create with the KIPR Link The KIPR Link can control an iRobot Create via its TTL serial connection. You will need to get a KIPR Link Create cable from the KIPR store (https://botballstore.org) or manufacture your own: The iRobot Create uses a 7 pin Mini-Din connector where pin 3 is Create TTL serial in, pin 4 is Create TTL serial out, and either pin 6 or 7 is GND.
Create KIPR Link Library Functions There are a large number of functions in the KIPR Link Library for controlling an iRobot Create module. These functions provide an interface between a program on the KIPR Link and the Create Open Interface (http://www.irobot.com/filelibrary/pdfs/hrd/create/Create%20Open%20Interface_v2.pdf).
Page 41
As the iRobot Create operates, it accumulates data on distance traveled and angle turned through. There are also "set_create" and "get_create" functions in the KIPR Link Create Library for initializing and obtaining these measures. The complete listing is in the appendix. Two commonly used set_create and...
Page 42
The complete listing of get_create functions is in the KISS IDE documentation and in the appendices. In using an iRobot Create module, keep in mind that the Create and the KIPR Link are independent entities communicating via a serial connection. If the connection is lost, the iRobot Create will continue on its own according to the last command it received.
200 mm/sec for 10 seconds, then displaying the distance traveled and the angle covered. Set Up Fully charge your KIPR Link and iRobot Create. Connect the KIPR Link to the iRobot Create with the KIPR Link Communication cable. Place the KIPR Link into the cargo bay of the iRobot Create. Set the iRobot Create on the floor with an adequate area cleared in front of the iRobot Create.
The KIPR Link communicates with the iRobot Create via a (TTL) serial connection. Functions are included in the KIPR Link Library for the iRobot Create, and send serial byte code sequences to the Create over the serial connection, making it possible to operate the Create without having to reference the Open Interface guide.
Example The following program includes a function that uses create_write_byte to define and send a script to the iRobot Create byte by byte. The script is designed to move the Create a specified distance at a specified speed and illustrates the low level coding involved in defining a script. Code #define RUN_SCRIPT create_write_byte(153) void make_drive_script(int...
Page 46
There are three major byte code commands used in the script: 1. Byte code 152 Specifies start of script definition, and must be immediately followed by a byte that gives the remaining number of bytes in the script (0-98). 2. Byte code 137 Byte codes 137 is a drive command for the iRobot Create, and must be immediately followed by 4 bytes representing two 16-bit two's complement integers representing speed and turn radius in mm, respectively.
Page 47
(such as a bump), the iRobot Create will remain idle until the event occurs, during which time the KIPR Link can be detached. In this manner, a script can be used as a means for operating an iRobot Create as an independent, if somewhat limited, robot entity.
Sample Program for Using KIPR Link Digital Output to Light an LED By default the digital ports for the KIPR Link are configured for input. The KIPR Link Library function set_digital_output is used to configure digital port direction; for example, set_digital_output(9, 1);...
On a single processor machine, like the KIPR Link, the instructions running in separate threads appear to be operating in parallel. Each thread, once started, will continue until its process finishes or until it is forcibly terminated by another process using the thread_destroy function.
Before the Linux operating system can access a file system, it has to "mount" the file system. When a USB flash drive is plugged into the KIPR Link, it is automatically mounted. When the USB flash drive is unplugged it is automatically unmounted. The C Library has a number of functions designed to access files located in mounted file systems.
Page 51
// done with file, so close it printf("Data read is %s: %d\n", s, x); The USB drive can now be removed from the KIPR Link. A file named will now be present myUSBfile on the USB drive and can be accessed using a text editor to verify file contents .
Row 3 – GND The KIPR Link normally will work with either 3.3V or 5V sensors. For a 3.3V sensor a max value reading for SEN occurs when voltage reaches 3.3V or more (Row 1). You will need to read the data sheet for the sensor you are creating to determine how the sensor needs to be wired.
Page 53
Before plugging your new sensor into your KIPR Link, use a multi meter to check for shorts and for continuity between each sensor lead and its corresponding plug lead.
• Method As for sensors ports, the KIPR Link DC motor interface employs standard 0.1” (2.54mm) female headers. Each pair of motor ports is a dual 1 x 3 female header strip serviced by a dual H-bridge chip for PWM.
Page 55
You will need to read the data sheet for the particular motor you are using to figure out how the motor needs to be wired and whether or not it can be operated using a KIPR Link motor port and PWM to vary motor response.
By default the digital and analog sensor ports on the KIPR Link are set to provide +5V on the V rail, which is also the nominal voltage for the SEN rail.
Page 57
Phillips head screw. Step 5: Reattach the battery and close up your KIPR Link, paying particular attention that the battery cables are clear and the speaker is back in place, then reinstall the 4 Torx screws that hold the bottom half of the case to the top.
Returns the value of the accelerometer for its vertical, or z direction, relative to the horizontal plane of the KIPR Link. When the Link is horizontal it is calibrated to have a value corresponding to the gravitational constant G (your acceleration to towards the center of the Earth to keep you from flying off of the planet).
Page 59
atan [Category: Math] Format: double atan(double angle); Returns the arc tangent of the angle. angle is specified in radians; the result is in radians. b_button [Category: Sensors] Format: b_button(); Reads the value (0 or 1) of the B button. b_button_clicked [Category: Sensors] Format: b_button_clicked();...
Page 60
display_clear [Category: Output] Format: void display_clear(); Clear the Link display for display_printf. See also console_clear. display_printf [Category: Output] Format: void display_printf(int col, row, char s[], ...); Perform a standard printf starting at screen location col, row. (col 0 to 41, row 0 to 9 - less if extra buttons are turned on) clear_motor_position_counter [Category: Motors] Format:...
Page 61
fd [Category: Motors] Format: void fd(int Turns motor m on full in the forward direction. Example: fd(3); freeze [Category: Motors] Format: void freeze(int Freezes motor m (prevents continued motor rotation, in contrast to off, which allows the motor to "coast"). get_analog_pullup [Category: Sensors] Format: int get_analog_pullup(int...
Page 62
log [Category: Math] Format: double log(double num); Returns the natural logarithm of num. mav [Category: Motors] Format: void mav(int vel); This function is the same as move_at_velocity. motor [Category: Motors] Format: void motor(int Turns on motor m at scaled PWM duty cycle percentage p. Power levels range from 100 for full on forward to -100 for full on backward.
Page 63
Digital ports on the KIPR Link can be configured for either input or output. By default digital ports are set for input. The statement set_digital_output(9,1) will configure digital port 9 for output. The port parameter must be in the range of values 8-15.
Page 64
Digital ports on the KIPR Link can be configured for either input or output. For a port configured for output, this function is used to set its value to either 0 (low) or 1 (high). The port parameter must be in the range of values 8-15.
Page 65
side_button_clicked [Category: Sensors] Format: side_button_clicked(); Gets the Side button's state (pressed or not pressed). If pressed, blocks until released. Returns 1 for pressed, 0 for not pressed. The construction while (side_button()==0) { while (side_button()==1); . . .} //debounce Side button is equivalent to while (side_button_clicked()==0) {.
Page 66
thread_wait [Category: Threads] Format: void thread_wait(thread id); The thread_wait function is used to wait for a thread that has been started by thread_start to finish, where id is the thread ID value returned by thread_create when the thread was created. x_button [Category: Sensors] Format: x_button();...
Loads a config file on the KIPR Link in place of the default config file. You must append .config to the file name for this function to locate it. Returns 1 on success, 0 on failure. See also camera_open, camera_open_device.
Page 68
get_object_center [Category: Vision] Format: point2 get_object_center(int channel, object); Returns the (x, y) center of the given object on the given channel as a point2 data type. For example, point2 cntr; cntr = get_object_center(0,2); printf("Center: x coord %d y coord %d\n", cntr.x, cntr.y); displays the x and y coordinates of center point of box 2 for channel 0.
[Category: Create Serial Interface] Format: void create_write_byte (char byte); Uses the serial interface to have the KIPR Link send the byte to the iRobot Create. Create configuration functions create_full [Category: Create Configuration Function] Format: void create_full(); Create will move however you tell it (even if that is a bad thing). In particular, the Create will not stop and disconnect if a wheel drop or cliff sensor goes high.
create_start [Category: Create Configuration Function] Format: void create_start(); Puts Create back into active mode (all commands will work). Active mode is the default mode at power on. get_create_mode [Category: Creat Configuration e Function] Format: get_create_mode(); Returns the Create's current operating mode (0=off, 1=passive, 2=safe, 3=full). In passive mode, motor commands don't work.
Page 71
get_create_overcurrents [Category: Create Movement Function] Format: get_create_overcurrents(); Returns the overcurrent status byte where the 16's bit indicates overcurrent in the left wheel; 8's bit overcurrent in the right wheel, 4's bit is LD2, 2's bit is LD0 and 1's bit is LD1 (LD is for the Create's 3 low side driver outputs, pins 22 to 24 for the connector in the Create cargo bay).
Page 72
get_create_bay_AI [Category: Create Sensor Function] Format: get_create_bay_AI(); Returns the 10 bit analog value on pin 4 from the cargo bay. get_create_bay_DI [Category: Create Sensor Function] Format: get_create_bay_DI(); Returns a byte for determining the current digital inputs (0 or 1) being applied to pins 16, 6, 18, 5, and 17 of the connector in the Create cargo bay.
Page 73
get_create_play_button [Category: Create Sensor Function] Format: get_create_play_button(); Returns 1 if the play button ( )is being pressed, 0 otherwise. > get_create_rbump [Category: Create Sensor Function] Format: get_create_rbump(); Returns 1 if right bumper is pressed, 0 otherwise. get_create_rcliff [Category: Create Sensor Function] Format: get_create_rcliff();...
get_create_battery_charging_state [Category: Create Battery Function] Format: get_create_battery_charging_state(); 0-not charging; 1-recondition charging; 2-full charging; 3-trickle charging; 4-waiting; 5-charge fault. This function is seldom used in practice. get_create_battery_current [Category: Create Battery Function] Format: get_create_battery_current(); Returns the current flow in mA. get_create_battery_voltage [Category: Create Battery Function] Format: get_create_battery_voltage();...
Page 75
create_power_led [Category: Create Music/LED Function] Format: void create_power_led(int color, brightness); The value 0 cases the I/O pwer LED to turn red, 255 to turn green. Brightness ranges from 0 to 255 with 0 representing off. get_create_song_number [Category: Create Music/LED Function] Format: get_create_song_number();...
Need help?
Do you have a question about the KIPR Link and is the answer not in the manual?
Questions and answers