00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _ROBOT_SIM_BASICENVIRONMENT_
00026 #define _ROBOT_SIM_BASICENVIRONMENT_
00027
00028 #include <robot/sim/sim>
00029
00030 #include <robot/sim/Environment>
00031
00032
00033 namespace robot {
00034 namespace sim {
00035
00036
00037
00038
00039
00040 class BasicEnvironment : public Environment
00041 {
00042 public:
00043 BasicEnvironment(ref<base::VFileSystem> fs, ref<base::Cache> cache, const String& name = "")
00044 : Environment(fs, cache, name) {}
00045
00046 BasicEnvironment(const BasicEnvironment& e)
00047 : Environment(e) {}
00048
00049 virtual String className() const { return String("BasicEnvironment"); }
00050
00051
00052 virtual ref<ToolDescription> newToolDescription() const = 0;
00053
00054
00055
00056 class Tool : public base::Named, public base::ReferencedObject
00057 {
00058 public:
00059 Tool(String name, ref<const robot::ToolDescription> toolDescription,
00060 const base::Point3& position,
00061 const base::Orient& orientation)
00062 : Named(name), toolDescription(toolDescription),
00063 position(position), orientation(orientation) {}
00064
00065 virtual String className() const { return String("Tool"); }
00066
00067 virtual ref<const robot::ToolDescription> getToolDescription() const { return toolDescription; }
00068 virtual const base::Point3& getPosition() const { return position; }
00069 virtual base::Point3& getPosition() { return position; }
00070 virtual const base::Orient& getOrientation() const { return orientation; }
00071 virtual base::Orient& getOrientation() { return orientation; }
00072
00073 protected:
00074 ref<const robot::ToolDescription> toolDescription;
00075 base::Point3 position;
00076 base::Orient orientation;
00077 };
00078
00079
00080 virtual ref<Tool> addTool(ref<const robot::ToolDescription> toolDescription,
00081 const base::Point3& position,
00082 const base::Orient& orientation) = 0;
00083
00084 virtual void removeTool(ref<Tool> tool) = 0;
00085
00086 virtual Int numTools() const = 0;
00087 virtual ref<Tool> getTool(Int i) = 0;
00088 virtual ref<const Tool> getTool(Int i) const = 0;
00089
00090
00091
00092 virtual void placeToolInProximity(ref<Tool> tool, ref<Robot> robot, Int manipulatorIndex=0) = 0;
00093
00094
00095
00096 class Obstacle : public base::ReferencedObject, public base::Named
00097 {
00098 public:
00099 enum ObstacleType { BoxObstacle, SphereObstacle };
00100
00101 Obstacle(base::Dimension3 dims,
00102 const base::Point3& position,
00103 const base::Orient& orientation)
00104 : type(BoxObstacle), dims(dims),
00105 position(position), orientation(orientation) {}
00106
00107 Obstacle(Real radius,
00108 const base::Point3& position,
00109 const base::Orient& orientation)
00110 : type(SphereObstacle), radius(radius),
00111 position(position), orientation(orientation) {}
00112
00113 virtual String className() const { return String("Obstacle"); }
00114
00115 void setName(const String& name) { Named::setName(name); }
00116
00117 ObstacleType type;
00118 base::Dimension3 dims;
00119 Real radius;
00120 base::Point3 position;
00121 base::Orient orientation;
00122 };
00123
00124
00125 virtual ref<Obstacle> addBoxObstacle(base::Dimension3 dim,
00126 const base::Point3& position,
00127 const base::Orient& orientation,
00128 const String& name="") = 0;
00129
00130 virtual ref<Obstacle> addSphereObstacle(Real radius,
00131 const base::Point3& position,
00132 const base::Orient& orientation,
00133 const String& name="") = 0;
00134
00135 virtual void removeObstacle(ref<Obstacle> obstacle) = 0;
00136
00137 virtual Int numObstacles() const = 0;
00138 virtual ref<Obstacle> getObstacle(Int i) = 0;
00139 virtual ref<const Obstacle> getObstacle(Int i) const = 0;
00140
00141 };
00142
00143
00144 }
00145 }
00146
00147 #endif