Unit 6: Robotics – LinkBot Letter Series (D)

Unit 6: Robotics – LinkBot Letter Series (D)
This is a continuation of the series of lessons for the Linkbot in RoboSim that
creates selected letters of the alphabet. These instructions are intended for you
to be exposed to basic commands that will enable you to construct every letter of
the alphabet and subsequently program the Linkbot for other tasks as devised
or assigned. These instructions are designed with designated start and end
points so that you can string together additional letter programs to spell your
name (or other designated word as will be assigned). Except for the first memo
line that identifies the program and your name, you are not required to type the
memo lines (although including them is recommended, they are for your
information and benefit). The memo lines do notify you when you are being
introduced to a new command and what that command is for.
Begin by opening the ChIDE program in your CSTEM folder and saving it as the
filename given (in this case Alphabet D). Key the programming text EXACTLY as
shown.
/* File: Alphabet D.ch
Drives the robot to trace the capital letter "D"
type your name here */
#include <linkbot.h>
CLinkbotI robot;
double speed1, speed3;
double radius =1.75;
double trackwidth = 3.69;
/* This connects to the paired robot and move to the zero position */
robot.connect();
robot.resetToZero();
robot.driveForward(400);
robot.move(95,NaN,95);
speed1 = 100;
speed3 = 50;
robot.setJointSpeeds(speed1, NaN, speed3);
robot.move(380,NaN,-190);
speed1 = 45;
speed3 = 45;
robot.setJointSpeeds(speed1, NaN, speed3);
robot.move(35,NaN,-35);
speed1 = 100;
speed3 = 50;
robot.setJointSpeeds(speed1, NaN, speed3);
Exploring Computer Science - Unit 6: Robotics § 01.3 Introduction –LinkBots in a Sim Environment PAGE 1
Unit 6: Robotics – LinkBot Letter Series (D)
robot.move(380,NaN,-190);
robot.delaySeconds(1.0);//delay 1.0 second
speed1 = 45;
speed3 = 45;
robot.setJointSpeeds(speed1, NaN, speed3);
robot.traceOff();
robot.drivexyTo(12, -2, radius, trackwidth);
robot.drivexyTo(12, 0, radius, trackwidth);
/* start next letter*/
Once you have keyed the complete program, run the program in RoboSim.
Troubleshoot any errors you have in your program and once your program has run
successfully, re-save your program in ChIDE.
When your program runs successfully, with the Linkbot at the endpoint, take a screen
shot that includes the ChIDE window and the RoboSim window and print.
For added protection and mobility of your file, copy the programming text from ChIDE,
paste it into a notepad file, and upload it to your GoogleDrive.
Exploring Computer Science - Unit 6: Robotics § 01.3 Introduction –LinkBots in a Sim Environment PAGE 2