CBC v2 Using the CBC.

Slides:



Advertisements
Similar presentations
An Introduction to C Adam Gleitman – IAP 2014.
Advertisements

Add and Use a Sensor & Autonomous For FIRST Robotics
Servos The material presented is taken from a variety of sources including:
Photos and Sensor Instructions
Autonomy using Encoders Intro to Robotics. Goal Our new task is to navigate a labyrinth. But this time we will NOT use motor commands in conjunction with.
Computer Science 10/06/20151 iRobot Create Command Interface CPSC /CPSC Rob Kremer Department of Computer Science University of Calgary.
Motor control drive in circles Pragmas configure motors Turning right in function of time Turning left in function of time Main program starts from here.
Right Face Introductory Presentation. Opening Activity How can you use this to make a right turn program? This is your program from Full Speed Ahead to.
©2006 CSUC Institute for Research in Intelligent Systems Introduction to Coding June 15, 2006.
IR SENSORS AND ENCODERS. LCDs Timothy Friez Class # 2.
1 ©2006 INSciTE Lab Two Task: Make the program from Lab One (Move forward 5 rotations and turn right 90 degrees) into a MyBlock.
iRobot Create Introduction Assembled from various online resources
Your Python program uses the create library. It supplies functions that send commands: to your laptop’s Bluetooth radio, then to the BAM on the Create,
Program ultrasonic range sensor in autonomous mode
Programming Concepts Part B Ping Hsu. Functions A function is a way to organize the program so that: – frequently used sets of instructions or – a set.
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class 2.
Members (from left to right): Rachel Bevill, Brae Bower, Samantha Cherbonneau, Professor Ahmadi, Anthony Contreras.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering 1 Hsu/Youssefi.
Robotics Overview of NXT-G Actuators in Mindstorms. Touch sensor Labwork: Right turn. Touch/bump. [Explore move versus Motor Move mini & motor mini. Motor*.]
Sound, Touch Sensor, and Motors. Wheeled Vehicles Using the Pilot class: –Constructor Pilot(float wheelDiameter, float trackWidth,Motor leftMotor, Motor.
7.2 V battery pack and charger Put the battery in the charger station at the end of the lab. period. Red light indicates charging. Ken Youssefi Introduction.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering –Intro to the Robotics –Introducing the IC –Discuss.
The George Washington University Department of ECE ECE 1010 Intro: Electrical & Computer Engineering –Introducing KIPR Link/Interface and Set-up –Continuation.
The Handy Board Bryan Valentini General Robotics 2003.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 4.
Servos The material presented is taken from a variety of sources including:
The George Washington University Electrical & Computer Engineering Department ECE 002 Dr. S. Ahmadi Class3/Lab 2.
Physics 211 Second Sample Exam Fall 2004 Professors Aaron Dominguez and Gregory Snow Please print your name _______________________________________________________________.
Vex Robotics program three: using motors and sensors together.
Casne.ncl.ac.uk Taking care of the CrumbleBot Please do NOT stress the robot's motors 1.Do NOT push the robot 2.Do NOT hold the.
MEH108 - Intro. To Engineering Applications KOU Electronics and Communications Engineering.
Istituto Tecnico Industriale A.Monaco EURLAB Object Detection Object Detection by Ultrasonic How to install and program a ultra sonic sensor with Arduino.
Forward Until Near Stop when near a wall.
Python Programming Module 4 Sensors and Loops Python Programming, 2/e1.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Dr. S. Ahmadi Class 4.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Rotational Motion WHS Lee Wignall.
The George Washington University Department of ECE ECE Intro: Electrical & Computer Engineering Intro to the Robotics Introducing the IC Discuss.
Lecture 10 Sensors.
Introduction to Servos
Module 2 Controlling a Lego EV3 Robot
BASIC Stamp II Programming for Descartes Robots
VEX Motors & Servos J.M. Gabrielse.
Servos The material presented is taken from a variety of sources including:
Introducing KIPR Link/Interface and Set-up
Servos The material presented is taken from a variety of sources including:
Programming Part 2 Mod Kit
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Basics for Robotics Programming
Servos The material presented is taken from a variety of sources including:
IMDL Summer 2007: RoBeDeS by David Ladolcetta.
PROMGRAMING YOUR ROBOT
BEGINNER PROGRAMMING LESSON
Introductory Presentation
By Sanjay and Arvind Seshan
Learning Outcomes Understand While Loop
Sasha Popov November 16, 2018 iRobot Create.
Appendix D: Trigonometry
ЧПУ Delta Electronics G-коды. Примеры
BEGINNER PROGRAMMING LESSON
Introduction to RobotC
Lesson 3: Sensor Wait-for’s Programming Solutions
SENSORS.
Robotics Week 3 beginning wheel control
Coding Edbot Dream with Scratch
Compiled from various Internet sources Presented by Mr. Hatfield
VEX Drag Race Your name, date, hour.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
BEGINNER PROGRAMMING LESSON
LEGO MINDSTORMS NXT PROGRAMMING
Presentation transcript:

CBC v2 Using the CBC

Using Servos

Library Functions for Servos enable_servos(): Enables power to the servo ports. This must be called before set_servo_position() to move a servo. When this function is called, the servo will default to position 1024 unless instructed to move elsewhere before enable_servos() is called. disable_servos(): Disables power to servo ports. This is useful when you want to conserve battery life. Your servo will be at the mercy of any external forces and will not hold its position when disabled. set_servo_position(<port#>, <position>): Moves a servo plugged in a port to a position. Position ranges from 0 to 2047. The servo will immediately move to position, unless impeded by external force. Call the enable_servos() function before using this function.

Using Motors

Motor Functions ao(): motor(<motor#>,<power>): Turns on a motor at a scaled PWM percentage. Power levels range from 100 (full forward) to -100 (full backward). mav(<motor#>,<velocity>): Move At Velocity moves a motor at a velocity indefinitely. Velocities range from -1000 to 1000 ticks per second. mrp(<motor#>,<velocity>,<position>): Move Relative Position moves a motor at a velocity from the current position to the current position plus the new position. Velocities range from 0 to 1000 ticks per second, and the position is a Long. bmd(): Block Motor Done does not return until the previous mrp or mtp command finishes. ao(): All Off turns off power to all motor ports.

Other Functions sleep(<seconds>): Returns after a time equal to or slightly greater than the argument in seconds. Seconds is a Float. printf(<string>,<arg1>,<arg2>,…): Prints the string to the screen. If the string contains % codes then the arguments after the string will be printed in place of the % codes in the format specified by the code. See the Appendix for the full list of % codes. beep(): Creates a beep sound.

Using the iRobot

iRobot Create Global Variables gc_lbump – Left front bump sensor, 0 = no bump, 1 = bump gc_rbump – Right front bump sensor, 0 = no bump, 1 = bump gc_distance – Distance traveled since last requested in mm, between -32768 and 32768 gc_angle – Angle rotated since last request, clockwise is negative, between -32768 and 32768 gc_lcliff – Left cliff sensor, 0 = no cliff, 1 = cliff gc_lfcliff – Left front cliff sensor, 0 = no cliff, 1 = cliff gc_rfcliff – Right cliff sensor, 0 = no cliff, 1 = cliff gc_rcliff – Right front cliff sensor, 0 = no cliff, 1 = cliff

iRobot Create Functions create_connect(); Connects the CBC v2 to the iRobot Create. Call this function first. By default the iRobot Create will be in “safe mode”. create_disconnect(); Disconnects the CBC v2 from the iRobot Create. Call this function at the end of the program, otherwise the CBC v2 will remain connected to the iRobot Create and if you rerun your program you will not be able to communicate with the iRobot Create. create_sensor_update(); Calls all of the sensor functions, updating all Create global variables. create_stop(); Stops the drive wheels. create_drive(<speed>,<radius>); Drives in an arc at a set speed. Speed range is 20-500mm/s, radius is in mm. create_drive_direct(<left motor speed>,<right motor speed>); Specifies individual left and right motor speeds from 20-500 mm/s.

Sample Program using the iRobot Create /* This is a program to make the iRobot Create drive in a circle with a radius of 0.25 meters at a speed of 200 mm/sec for 10 seconds and prints the distance traveled around the circle and the angle that the turn covered*/ int main() { create_connect(); create_sensor_update(); gc_distance = 0; gc_total_angle = 0; create_drive(200, 250); sleep(10); create_stop(); printf("distance = %d\n", gc_distance); printf("angle = %d\n", gc_total_angle); create_disconnect(); kissSimPause(); }