PickBeeperToWall

Dependencies:   HCSR

Files at this revision

API Documentation at this revision

Comitter:
bulmecisco
Date:
Fri Apr 17 06:59:34 2015 +0000
Parent:
8:e7f74f072564
Commit message:
Robot class added for objectBertl simulation program compatibility; You can use KPP-Files with some additions - see Robot.cpp

Changed in this revision

Robot.cpp Show annotated file Show diff for this revision Revisions of this file
Robot.h Show annotated file Show diff for this revision Revisions of this file
const.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Robot.cpp	Fri Apr 17 06:59:34 2015 +0000
@@ -0,0 +1,82 @@
+/***********************************
+name:   Robot.cpp    Version: 1.0
+author: PE HTL BULME
+email:  pe@bulme.at
+WIKI:   https://developer.mbed.org/teams/BERTL_CHEL_18/code/ur_Bertl/
+description:
+        Implementation Robot for objectivRobot
+        
+The following lines have to be added or changed to the *.kpp file:
+
+#include "Robot.h"
+#include "mbed.h"
+#include "const.h"
+
+class Bertl : public Robot  // public
+{
+    public:
+       Bertl(int x, int y, int d, int b){}; // dumy constrctor with same name as the class name
+       
+rest as in KPP-file:
+see in objectBertl/projects/L1_Ex1.KPP
+
+***********************************/
+#include "mbed.h"
+#include "Robot.h"
+#include "ur_Bertl.h"
+
+//Robot::Robot(int x, int y, char[] dir, int beeper) : ur_Robot(){}
+
+void Robot :: move()   // Definieren
+{
+    Move();
+}
+
+void Robot :: turnLeft()
+{
+    TurnLeft();
+}
+
+void Robot :: pickBeeper()
+{
+    PickBeeper();
+}
+
+void Robot :: putBeeper()
+{
+    PutBeeper();
+}
+
+bool Robot :: frontIsClear()
+{
+    return FrontIsClear();
+}
+
+bool Robot :: nextToABeeper()      //is there one or more beepers in the same corner? 
+{
+    return NextToABeeper();
+}
+bool Robot :: nextToARobot()        //is there another robot in the corner?
+{
+    return false;
+}
+bool Robot :: facingNorth()         //is the robot facing North?
+{
+    return true;
+}
+bool Robot :: facingSouth()      // is the robot facing South?
+{
+    return true;
+}
+bool Robot :: facingEast()       // is the robot facing East?
+{
+    return true;
+}
+bool Robot :: facingWest()       // is the robot facing West?
+{
+    return true;
+}
+bool Robot :: anyBeepersInBeeperBag()    //are there any beepers in the bag?
+{
+    return AnyBeeperInBag();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Robot.h	Fri Apr 17 06:59:34 2015 +0000
@@ -0,0 +1,35 @@
+/***********************************
+name:   Robot.h      Version: 0.1
+author: PE HTL BULME
+email:  pe@bulme.at
+WIKI:   https://developer.mbed.org/teams/BERTL_CHEL_18/code/ur_Bertl/
+description:
+        Definition portion of a new Robot class for objectivRobot
+         
+***********************************/
+#include "mbed.h"
+#include "ur_Bertl.h"
+#include "string"
+
+#ifndef ROBOT_H
+#define ROBOT_H
+
+class Robot : public ur_Bertl
+{
+public:
+    Robot() {};
+    Robot(int x, int y, int dir, int beeper) {}
+    void move();          // nur Deklaration - Prototyping
+    void turnLeft();
+    bool frontIsClear();
+    void pickBeeper();
+    void putBeeper();
+    bool nextToABeeper();      //is there one or more beepers in the same corner?
+    bool nextToARobot();        //is there another robot in the corner?
+    bool facingNorth();         //is the robot facing North?
+    bool facingSouth();      // is the robot facing South?
+    bool facingEast();       // is the robot facing East?
+    bool facingWest();       // is the robot facing West?
+    bool anyBeepersInBeeperBag();    //are there any beepers in the bag?
+};
+#endif
\ No newline at end of file
--- a/const.h	Mon Apr 13 15:28:10 2015 +0000
+++ b/const.h	Fri Apr 17 06:59:34 2015 +0000
@@ -1,10 +1,11 @@
 /*! \file const.h
 \brief A Documented file.
-* name:   const.h    Version: 1.0 \n
+* name:   const.h    Version: 2.0 \n
 * author: PE HTL BULME \n
 * email:  pe@bulme.at \n
 * description:
-*    Constants for ur_Bertl The Robot
+*   Constants for ur_Bertl The Robot
+*   Constant for Robot from objectiv Robot added
 */
 #ifndef CONST_H
 #define CONST_H
@@ -56,6 +57,10 @@
 const int addr = 0x40;       // I2C-address PCA9555
 const int PERIOD = 20;       // PWM period
 const int PULSWIDTH = 5;     // PWN pulswidth
+const int East = 1; 
+const int West = 2; 
+const int North = 3;
+const int South = 4;
 
 
 #endif
\ No newline at end of file