summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormasterm <devnull@localhost>2007-01-14 19:07:03 +0100
committermasterm <devnull@localhost>2007-01-14 19:07:03 +0100
commitd22cf4b33b7e9a3de5e4e3cb8aec617f739c465a (patch)
treeba72555863c75c3df9c36e4f5e48ed70759b7967
parentf2e4b847be5cbaecc4562f4ae9f75e9f7473ee12 (diff)
downloadrc2007-soccer-d22cf4b33b7e9a3de5e4e3cb8aec617f739c465a.tar
rc2007-soccer-d22cf4b33b7e9a3de5e4e3cb8aec617f739c465a.zip
+++ added soccer robot framework
-rw-r--r--source/Concept/Concept.vcproj208
-rw-r--r--source/Concept/defines.h91
-rw-r--r--source/Concept/engine.cpp1
-rw-r--r--source/Concept/engine.h19
-rw-r--r--source/Concept/io_module.cpp1
-rw-r--r--source/Concept/io_module.h29
-rw-r--r--source/Concept/main.cpp47
-rw-r--r--source/Concept/module.cpp0
-rw-r--r--source/Concept/module.h0
-rw-r--r--source/Concept/robot.cpp37
-rw-r--r--source/Concept/robot.h46
-rw-r--r--source/Concept/sensor.cpp1
-rw-r--r--source/Concept/sensor.h29
-rw-r--r--source/Concept/stdafx.h12
-rw-r--r--source/RoboCode.sln21
15 files changed, 542 insertions, 0 deletions
diff --git a/source/Concept/Concept.vcproj b/source/Concept/Concept.vcproj
new file mode 100644
index 0000000..61c34c2
--- /dev/null
+++ b/source/Concept/Concept.vcproj
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="Concept"
+ ProjectGUID="{556125BE-937F-4A2B-89C7-B086575BE0F0}"
+ RootNamespace="Concept"
+ Keyword="ManagedCProj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ ManagedExtensions="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG"
+ MinimalRebuild="FALSE"
+ BasicRuntimeChecks="0"
+ RuntimeLibrary="1"
+ WarningLevel="3"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\$(ProjectName).exe"
+ LinkIncremental="2"
+ GenerateDebugInformation="TRUE"
+ AssemblyDebug="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="2"
+ ManagedExtensions="TRUE">
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions="WIN32;NDEBUG"
+ MinimalRebuild="FALSE"
+ RuntimeLibrary="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ OutputFile="$(OutDir)\$(ProjectName).exe"
+ LinkIncremental="1"
+ GenerateDebugInformation="TRUE"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
+ <File
+ RelativePath=".\main.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
+ <File
+ RelativePath=".\defines.h">
+ </File>
+ <File
+ RelativePath=".\stdafx.h">
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
+ </Filter>
+ <Filter
+ Name="Modules"
+ Filter="">
+ <Filter
+ Name="IO_Module"
+ Filter="">
+ <Filter
+ Name="Source Files"
+ Filter="">
+ <File
+ RelativePath=".\io_module.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="">
+ <File
+ RelativePath=".\io_module.h">
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Engine"
+ Filter="">
+ <Filter
+ Name="Source Files"
+ Filter="">
+ <File
+ RelativePath=".\engine.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="">
+ <File
+ RelativePath=".\engine.h">
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Robot"
+ Filter="">
+ <Filter
+ Name="Source Files"
+ Filter="">
+ <File
+ RelativePath=".\robot.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="">
+ <File
+ RelativePath=".\robot.h">
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Sensor"
+ Filter="">
+ <Filter
+ Name="Source Files"
+ Filter="">
+ <File
+ RelativePath=".\sensor.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="">
+ <File
+ RelativePath=".\sensor.h">
+ </File>
+ </Filter>
+ </Filter>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/source/Concept/defines.h b/source/Concept/defines.h
new file mode 100644
index 0000000..698163a
--- /dev/null
+++ b/source/Concept/defines.h
@@ -0,0 +1,91 @@
+#ifndef _DEFINES_H
+#define _DEFINES_H
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+//Integer definition
+#ifndef int8
+ #ifdef __int8
+ #define int8 __int8
+ #else
+ #define int8 char
+ #endif
+#endif
+
+#ifndef int16
+ #ifdef __int16
+ #define int16 __int16
+ #else
+ #define int16 int
+ #endif
+#endif
+
+#ifndef int32
+ #ifdef __int32
+ #define int32 __int32
+ #else
+ #define int32 long
+ #endif
+#endif
+
+#ifndef int64
+ #ifdef __int64
+ #define int64 __int64
+ #else
+ #define int64 long long
+ #endif
+#endif
+
+//Unsigned
+#ifndef uint8
+#define uint8 unsigned int8
+#endif
+
+#ifndef uint16
+#define uint16 unsigned int16
+#endif
+
+#ifndef uint32
+#define uint32 unsigned int32
+#endif
+
+#ifndef uint64
+#define uint64 unsigned int64
+#endif
+
+//Sensor types
+enum SensorTypes
+{
+ SENSOR_TYPE_ANALOG,
+ SENSOR_TYPE_DIGITAL,
+};
+
+//IO Module Names
+enum IOModuleNames
+{
+ //General
+ IO_START,
+
+ //Engines
+ IO_ENGINE_START = IO_START,
+
+ IO_ENGINE_DRIVE_LEFT = IO_ENGINE_START,
+ IO_ENGINE_DRIVE_RIGHT,
+ IO_ENGINE_DRIVE_BACK,
+
+ IO_ENGINE_END,
+
+ //Sensors
+ IO_SENSOR_START = IO_ENGINE_END,
+
+ IO_SENSOR_MOUSE = IO_SENSOR_START,
+
+ IO_SENSOR_END,
+
+ //General
+ IO_END = IO_SENSOR_END,
+};
+
+#endif \ No newline at end of file
diff --git a/source/Concept/engine.cpp b/source/Concept/engine.cpp
new file mode 100644
index 0000000..11856cc
--- /dev/null
+++ b/source/Concept/engine.cpp
@@ -0,0 +1 @@
+#include "engine.h" \ No newline at end of file
diff --git a/source/Concept/engine.h b/source/Concept/engine.h
new file mode 100644
index 0000000..406d46e
--- /dev/null
+++ b/source/Concept/engine.h
@@ -0,0 +1,19 @@
+#ifndef _ENGINE_H
+#define _ENGINE_H
+
+#include "stdafx.h"
+
+class Engine : public IO_Module
+{
+public:
+ Engine()
+ {
+ }
+
+ Engine(uint32 engineId)
+ {
+ this->moduleId = engineId;
+ }
+};
+
+#endif \ No newline at end of file
diff --git a/source/Concept/io_module.cpp b/source/Concept/io_module.cpp
new file mode 100644
index 0000000..93f78ae
--- /dev/null
+++ b/source/Concept/io_module.cpp
@@ -0,0 +1 @@
+#include "io_module.h" \ No newline at end of file
diff --git a/source/Concept/io_module.h b/source/Concept/io_module.h
new file mode 100644
index 0000000..8aa7ef7
--- /dev/null
+++ b/source/Concept/io_module.h
@@ -0,0 +1,29 @@
+#ifndef _MODULE_H
+#define _MODULE_H
+
+#include "defines.h"
+
+class IO_Module
+{
+public:
+ IO_Module(uint32 moduleId)
+ {
+ this->moduleId = moduleId;
+ }
+
+ IO_Module(){}
+
+protected:
+ uint32 moduleId;
+
+public:
+
+ uint32 GetId()
+ {
+ return moduleId;
+ }
+
+
+};
+
+#endif \ No newline at end of file
diff --git a/source/Concept/main.cpp b/source/Concept/main.cpp
new file mode 100644
index 0000000..6305a1e
--- /dev/null
+++ b/source/Concept/main.cpp
@@ -0,0 +1,47 @@
+#include "stdafx.h"
+
+int main()
+{
+ //Init our robot
+ Robot* localRobot = new Robot();
+
+ //Init Engines
+ for(uint8 i = IO_ENGINE_START; i < IO_ENGINE_END; i++)
+ {
+ Engine* newEngine = new Engine(i);
+ localRobot->AddModule(newEngine);
+ newEngine = NULL;
+ }
+
+ //Init Sensors
+ for(uint8 i = IO_SENSOR_START; i < IO_SENSOR_END; i++)
+ {
+ SensorTypes newSensorType;
+
+ switch(i)
+ {
+ //Cases when sensor is digital:
+ // newSensorType = SENSOR_TYPE_DIGITAL;
+ // break;
+
+ //Other cases
+ default:
+ newSensorType = SENSOR_TYPE_ANALOG;
+ break;
+ }
+
+ Sensor* newSensor = new Sensor(i, newSensorType);
+ localRobot->AddModule(newSensor);
+ newSensor = NULL;
+ }
+
+ //Run
+ while(true)
+ {
+ localRobot->Update();
+ }
+
+ //Cleanup
+ delete localRobot;
+ localRobot = NULL;
+} \ No newline at end of file
diff --git a/source/Concept/module.cpp b/source/Concept/module.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/Concept/module.cpp
diff --git a/source/Concept/module.h b/source/Concept/module.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/Concept/module.h
diff --git a/source/Concept/robot.cpp b/source/Concept/robot.cpp
new file mode 100644
index 0000000..768554e
--- /dev/null
+++ b/source/Concept/robot.cpp
@@ -0,0 +1,37 @@
+#include "robot.h"
+
+//-----------------------------------------------------------------------------
+Robot::~Robot()
+{
+ while(!modules.empty())
+ {
+ moduleMap::iterator iter = modules.begin();
+ delete iter->second;
+ modules.erase(iter);
+ }
+}
+
+//-----------------------------------------------------------------------------
+bool Robot::AddModule(IO_Module* newModule)
+{
+ moduleMap::iterator itr = modules.find(newModule->GetId());
+ if(itr != modules.end())
+ return false;
+
+ modules[newModule->GetId()] = newModule;
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+bool Robot::RemoveModule(IO_Module* oldModule)
+{
+ return RemoveModule(oldModule->GetId());
+}
+
+//-----------------------------------------------------------------------------
+void Robot::Update()
+{
+ //insert code here
+}
+
+//--- EOF --- \ No newline at end of file
diff --git a/source/Concept/robot.h b/source/Concept/robot.h
new file mode 100644
index 0000000..543f1ed
--- /dev/null
+++ b/source/Concept/robot.h
@@ -0,0 +1,46 @@
+#ifndef _ROBOT_H
+#define _ROBOT_H
+
+#include "stdafx.h"
+
+class IO_Module;
+class Sensor;
+class Engine;
+
+class Robot
+{
+public:
+ ~Robot();
+
+private:
+ typedef hash_map<uint32, IO_Module*> moduleMap;
+ moduleMap modules;
+
+public:
+ bool AddModule(IO_Module* newModule);
+
+ template <class T> T* GetModule(uint32 moduleId)
+ {
+ moduleMap::const_iterator itr = modules.find(moduleId);
+ if(itr == modules.end())
+ return NULL;
+ else
+ return ((T*)itr->second);
+ }
+
+ bool RemoveModule(uint32 moduleId)
+ {
+ moduleMap::iterator itr = modules.find(moduleId);
+ if(itr == modules.end())
+ return false;
+
+ modules.erase(itr);
+ return true;
+ }
+
+ bool RemoveModule(IO_Module* oldModule);
+
+ void Update();
+};
+
+#endif \ No newline at end of file
diff --git a/source/Concept/sensor.cpp b/source/Concept/sensor.cpp
new file mode 100644
index 0000000..b9b4936
--- /dev/null
+++ b/source/Concept/sensor.cpp
@@ -0,0 +1 @@
+#include "sensor.h" \ No newline at end of file
diff --git a/source/Concept/sensor.h b/source/Concept/sensor.h
new file mode 100644
index 0000000..23e40e9
--- /dev/null
+++ b/source/Concept/sensor.h
@@ -0,0 +1,29 @@
+#ifndef _SENSOR_H
+#define _SENSOR_H
+
+#include "stdafx.h"
+
+class Sensor : public IO_Module
+{
+public:
+ Sensor()
+ {
+ }
+
+ Sensor(uint32 sensorId, SensorTypes sensorType)
+ {
+ this->moduleId = sensorId;
+ this->sensorType = sensorType;
+ }
+
+protected:
+ SensorTypes sensorType;
+
+public:
+ SensorTypes GetType()
+ {
+ return sensorType;
+ }
+};
+
+#endif \ No newline at end of file
diff --git a/source/Concept/stdafx.h b/source/Concept/stdafx.h
new file mode 100644
index 0000000..0a5a81e
--- /dev/null
+++ b/source/Concept/stdafx.h
@@ -0,0 +1,12 @@
+#include <iostream>
+#include <stdlib.h>
+#include <string>
+#include <hash_map>
+
+using namespace std;
+
+#include "defines.h"
+#include "io_module.h"
+#include "sensor.h"
+#include "engine.h"
+#include "robot.h" \ No newline at end of file
diff --git a/source/RoboCode.sln b/source/RoboCode.sln
new file mode 100644
index 0000000..59f2d66
--- /dev/null
+++ b/source/RoboCode.sln
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Concept", "Concept\Concept.vcproj", "{556125BE-937F-4A2B-89C7-B086575BE0F0}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {556125BE-937F-4A2B-89C7-B086575BE0F0}.Debug.ActiveCfg = Debug|Win32
+ {556125BE-937F-4A2B-89C7-B086575BE0F0}.Debug.Build.0 = Debug|Win32
+ {556125BE-937F-4A2B-89C7-B086575BE0F0}.Release.ActiveCfg = Release|Win32
+ {556125BE-937F-4A2B-89C7-B086575BE0F0}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal