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_TESTBASICENVIRONMENT_
00026 #define _ROBOT_SIM_TESTBASICENVIRONMENT_
00027
00028 #include <robot/sim/sim>
00029
00030 #include <robot/sim/BasicEnvironment>
00031
00032 #include <robot/TestRobot>
00033
00034 #include <list>
00035
00036
00037 namespace robot {
00038 namespace sim {
00039
00040
00041
00042
00043
00044 class TestBasicEnvironment : public robot::sim::BasicEnvironment
00045 {
00046 public:
00047 TestBasicEnvironment(ref<base::VFileSystem> fs, ref<base::Cache> cache, const String& name = "");
00048
00049 virtual String className() const { return String("TestBasicEnvironment"); }
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 virtual ref<RobotDescription> newRobotDescription() const
00060 { return ref<RobotDescription>(NewObj RobotDescription()); }
00061
00062 virtual ref<Robot> addRobot(ref<const robot::RobotDescription> robotDescription,
00063 const base::Point3& position,
00064 const base::Orient& orientation,
00065 bool anchored = false);
00066
00067 virtual void removeRobot(ref<robot::Robot> robot);
00068
00069 virtual Int numRobots() const { return robots.size(); }
00070 virtual ref<Robot> getRobot(Int i) { return base::elementAt(robots,i); }
00071
00072
00073
00074 virtual ref<Tool> addTool(ref<const robot::ToolDescription> toolDescription,
00075 const base::Point3& position,
00076 const base::Orient& orientation);
00077
00078 virtual void removeTool(ref<Tool> tool);
00079
00080 virtual Int numTools() const { return tools.size(); };
00081 virtual ref<Tool> getTool(Int i) { return base::elementAt(tools,i); }
00082 virtual ref<const Tool> getTool(Int i) const { return base::elementAt(tools,i); }
00083
00084
00085 virtual void placeToolInProximity(ref<Tool> tool, ref<Robot> robot, Int manipulatorIndex=0);
00086
00087
00088
00089
00090 virtual ref<Obstacle> addBoxObstacle(base::Dimension3 dim,
00091 const base::Point3& position,
00092 const base::Orient& orientation,
00093 const String& name="");
00094
00095 virtual ref<Obstacle> addSphereObstacle(Real radius,
00096 const base::Point3& position,
00097 const base::Orient& orientation,
00098 const String& name="");
00099
00100 virtual void removeObstacle(ref<Obstacle> obstacle);
00101
00102 virtual Int numObstacles() const { return obstacles.size(); }
00103 virtual ref<Obstacle> getObstacle(Int i) { return base::elementAt(obstacles,i); }
00104 virtual ref<const Obstacle> getObstacle(Int i) const { return base::elementAt(obstacles,i); }
00105
00106
00107
00108 virtual void preSimulate();
00109 virtual void simulateForSimTime(const base::Time& dt);
00110
00111
00112 virtual bool formatSupported(const String format, Real version = 1.0, ExternalizationType type = IO) const;
00113 virtual void externalize(base::Externalizer& e, const String format = "", Real version = 1.0);
00114
00115 protected:
00116 typedef reflist<robot::TestRobot> RobotList;
00117 typedef reflist<Tool> ToolList;
00118 typedef reflist<Obstacle> ObstacleList;
00119
00120 RobotList robots;
00121 ToolList tools;
00122 ObstacleList obstacles;
00123
00124 };
00125
00126
00127 }
00128 }
00129
00130 #endif