My Second Robot. Anatomy of a Robot A robot consists of 3 independently moving parts: Vehicle - determines the direction in which the robot will move.

Slides:



Advertisements
Similar presentations
Robocode Some Methods and Ideas. Robot anatomy 101 Just like the real thing … it has a gun that rotates a radar on top that also rotates tank, gun and.
Advertisements

Robocode. What is Robocode? Robocode is an easy-to-use robotics battle simulator. You create a robot, put it onto a battlefield, and let it battle to.
Nawwaf Kharma.  Programming as Problem Solving with Applied Algorithms  Algorithm Design as Instruction selection, configuration and sequencing  The.
This Week Cover as much Robocode strategy as we can Monday: Robocode
Graduate Capstone Project Breaking Walls: Developing a Successful Robot in Robocode Chris Velez Summer 2011 Advisor :Dr. Xiang.
EVENT DRIVEN SCRIPTING Andrew Williams. Robot Scripting Language  In the lab we looked at some very simple examples of Robot Scripting Language (RSL)
Design, Implementation, & Impact Jeffrey Santos Hofstra University May, 2010.
Conditionals How do we solve tasks in which every particular of a task is not specifically known? – A robot needs the ability to survey its immediate environment.
Great teaching/ learning aid … OO Threading Packaging Inheritance Polymorphism Calling API code Event handling Inner classes Java docs How to duck… Consume.
The NXT is the brain of a MINDSTORMS® robot. It’s an intelligent, computer-controlled LEGO® brick that lets a MINDSTORMS robot come alive and perform.
SuperCorners. Problem The Corners sample robot has a simple strategy: first, move into a corner of the arena, and second sweep the gun back and forth.
How does Robocode work? In short it is a framework
Karel J Robot An introduction to BlueJ and Object- Oriented Programming.
CSE AI Game Programming. Installation 
1 Design and Discovery Robotics Wednesday May 10th 2006 Education Centre Drumcondra Design and Discovery Robotics Wednesday May 10th 2006 Education Centre.
Karel the Robot A Gentle Introduction to the Art of Programming.
CSE AI Game Programming. Installation 
Style Guidelines. Why do we need style?  Good programming style helps promote the readability, clarity and comprehensibility of your code.
Overview of Project 3 Slides are available at : Updated 1/28 Due Date for project has been extended to next Friday 2/6.
Assignments. AnatomyBot.java Create a robot that turns all of it parts independently (vehicle, gun, and radar). Turn the vehicle left 360 o Turn the gun.
1 Karel – Chapter 5 Conditionally Executing Instructions Note: Original slides provided by and modified for Mr. Smith’s AP Computer.
Tkinter Canvas.
Lesson No: 6 Introduction to Windows XP CHBT-01 Basic Micro process & Computer Operation.
1 Karel J Robot OOP approach to learning computer science “Its study involves development of the ability to abstract the essential features of a problem.
Chapter 9 Advanced Assembly Modeling Techniques. After completing this chapter, you will be able to perform the following: –Create sketch blocks –Create.
HUMAN CONTROLLED DEVICE WITH MACHINE INTERVENTION FOR COLLISION AVOIDANCE Jake KarlCSE321 Zac BergquistFALL 2010.
The Robot and the Wall Introduction to Pseudocode Your Name Goes Here.
Extending Karel’s Vocabulary This PPT originated with Dr. Judy Hankins Modifications have been done by Dr. Untch & Dr. Cripps.
Programming in Karel Eric Roberts CS 106A January 6, 2016.
Chapter 9 Advanced Assembly Modeling Techniques. After completing this chapter, you will be able to perform the following: –Create sketch blocks –Create.
Available at: – Program Functions to Accept Values Program Functions to Accept Values.
1 Chapter 5 - IF CH5 – Conditional Statements Flavor 1: if ( ) { } For now: these are method invokations (see next slide)
1 karel_part3_ifElse Conditional Statements or ELSE if ( ) { } else { }
Mile-long hurdle race Suppose that we want to program Karel to run a one-mile long hurdle race, where vertical wall sections represent hurdles. The hurdles.
Computer Science II 810:062 Section 01 Session 2 - Objects and Responsibilities.
(1) Introduction to Robocode Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences University of Hawaii Honolulu.
Robocode. Robocode: basics Coords. are (x,y), with bottom left as (0,0) Heading: degrees, straight up = 0, pos. clockwise (0
VB.NET and Databases. ADO.NET VB.Net allows you many ways to connect to a database. The technology used to interact with a database or data source is.
Barclays Robot Challenge Learn how to Program Robots.
Karel J Robot Chapter 5.
1 Chapter 5 Karel J Robot 2 Chapter 5 Chapter 5 Conditional Statements Flavor 1: if ( ) { } For now: these are method invocations (see next slide)
Advanced issues in Robotics and Programming Dr. Katerina G. Hadjifotinou Experimental Junior High School of the University of Macedonia.
Introduction to Programming using Java
VEX IQ Curriculum Smart Machines Lesson 09 Lesson Materials:
Mile-long hurdle race Suppose that we want to program Karel to run a one-mile long hurdle race, where vertical wall sections represent hurdles. The hurdles.
Lecture 10 Sensors.
Exploring Mathematical Relationships Module 5: Investigation 3
Eric Roberts and Jerry Cain
Winning Strategy in Programming Game Robocode
By Sanjay and Arvind Seshan
Copyright © 2008 by Helene G. Kershner
Copyright © 2008 by Helene G. Kershner
BEGINNER EV3 PROGRAMMING Lesson
Sensors and Logic Switches
MTAT , 2CP Seminar Ilja Livenson
ITK 168 Lecture 5 - Inheritance
BEGINNER PROGRAMMING LESSON
Find {image} and the angle between u and v to the nearest degree: u = < 7, -7 > and v = < -8, -9 > Select the correct answer: 1. {image}
LESSON 03 Turning In Place. LESSON 03 Turning In Place.
BEGINNER PROGRAMMING LESSON
slides courtesy of Eric Roberts
Warm Up- What is a robot? Describe in one sentence what you understand by the term ‘robot’ 2. What are the main parts of a robot? What do people do to.
> Other ways to navigate space
CH5 – Conditional Statements
One-Point Perspective Drawing and Space
Robotics Week 4 Functions and reusable code
KEYLESS ENTRY PUSH TO START BACK UP CAMERA.
Getting started with LEGO EV3 Mindstorms software
Mars Rover Challenge – Path around Olympus Mons (middle and early high school) Olympus Mons on the surface of Mars at 69,841 feet (more than twice the.
Robocode A robot is made up of 3 things:
Presentation transcript:

My Second Robot

Anatomy of a Robot A robot consists of 3 independently moving parts: Vehicle - determines the direction in which the robot will move Gun - determines the direction in which the robot will fire Radar - determines what the robot can see (if you turn on Visible scan arcs in options -> Preferences, this will give you a feel for how much a robot can see)

Turning By default, moving a component will result in all components ON TOP of it moving accordingly (e.g. if the gun turns 90 degrees left, the radar will turn 90 degrees left). However, you can set components to adjust themselves automatically so that they are independent of the movement of other components, using these methods: setAdjustGunForRobotTurn(boolean flag): If the flag is set to true, the gun will remain in the same direction while the vehicle turns. setAdjustRadarForRobotTurn(boolean flag): If the flag is set to true, the radar will remain in the same direction while the vehicle (and the gun) turns. setAdjustRadarForGunTurn(boolean flag): If the flag is set to true, the radar will remain in the same direction while the gun turns. It will also act as if setAdjustRadarForRobotTurn(true) has been called.

Basic Commands Below are the basic commands for moving the robot around, you can find more detailed definitions in the Robocode API.Robocode API turnRight(double degree) and turnLeft(double degree) turn the robot by a specified degree. ahead(double distance) and back(double distance) move the robot by the specified distance; these two methods return early if the robot hits a wall or another robot. turnGunRight(double degree) and turnGunLeft(double degree) turn the gun, independent of the vehicle's direction. turnRadarRight(double degree) and turnRadarLeft(double degree) turn the radar on top of the gun, independent of the gun's direction (and the vehicle's direction).

How to build a robot public class GenericRobot extends Robot { public void run() { while(true) { }

Useful Event-handlers onScannedRobot() - this method is called when the radar detects a robot. onHitByBullet() - this method is called when the robot is hit by a bullet. onHitRobot() - this method is called when your robot hits another robot. onHitWall() method; this method is called when your robot hits a wall.

Problem What does this robot do? import robocode.*; public class MySecondRobot extends Robot { public void run() { turnLeft(getHeading()); while(true) { ahead(1000); turnRight(90); } public void onScannedRobot(ScannedRobotEvent e) { fire(1); } public void onHitByBullet(HitByBulletEvent e) { turnLeft(180); }

Solution The robot begins by driving straight up (turnLeft(getHeading())). It turns right 90 degrees whenever it hits something, so it moves orthogonally in a large rectangle. If hit by a bullet it changes direction (turnLeft(180)).