6 #include "RigidObject.h" 7 #include <Klampt/View/ViewRobot.h> 8 #include <KrisLibrary/camera/camera.h> 9 #include <KrisLibrary/camera/viewport.h> 10 #include <KrisLibrary/GLdraw/GLLight.h> 27 typedef shared_ptr<Geometry::AnyCollisionGeometry3D> GeometryPtr;
28 typedef shared_ptr<GLDraw::GeometryAppearance> AppearancePtr;
37 bool SaveXML(
const char* fn,
const char* elementDir=NULL);
42 void InitCollisions();
43 void UpdateGeometry();
49 int GetID(
const string& name,
int link=-1)
const;
50 string GetName(
int id)
const;
59 int TerrainID(
int index)
const;
60 int RigidObjectID(
int index)
const;
61 int RobotID(
int index)
const;
62 int RobotLinkID(
int index,
int link)
const;
63 GeometryPtr GetGeometry(
int id);
64 AppearancePtr GetAppearance(
int id);
65 RigidTransform GetTransform(
int id)
const;
66 void SetTransform(
int id,
const RigidTransform& T);
68 int LoadRobot(
const string& fn);
69 int AddRobot(
const string& name,
RobotModel* robot=NULL);
70 void DeleteRobot(
const string& name);
72 ViewRobot* GetRobotView(
const string& name);
74 int LoadTerrain(
const string& fn);
75 int AddTerrain(
const string& name,
TerrainModel* terrain=NULL);
76 void DeleteTerrain(
const string& name);
79 int LoadRigidObject(
const string& fn);
81 void DeleteRigidObject(
const string& name);
85 int RayCast(
const Ray3D& r,Vector3& worldpt);
87 int RayCastIgnore(
const Ray3D& r,
const vector<int>& ignoreIDs,Vector3& worldpt);
89 int RayCastSelected(
const Ray3D& r,
const vector<int>& selectedIDs,Vector3& worldpt);
103 Camera::Camera camera;
104 Camera::Viewport viewport;
105 vector<GLDraw::GLLight> lights;
106 GLDraw::GLColor background;
109 vector<shared_ptr<RobotModel> > robots;
110 vector<shared_ptr<TerrainModel> > terrains;
111 vector<shared_ptr<RigidObjectModel> > rigidObjects;
113 vector<ViewRobot> robotViews;
Draws the robot (potentially color-coded)
Definition: ViewRobot.h:14
pair< int, int > IsRobotLink(int id) const
Returns the index of the robot link or -1,-1 otherwise.
bool SaveXML(const char *fn, const char *elementDir=NULL)
int IsRigidObject(int id) const
Returns the index of the rigid object or -1 otherwise.
void Copy(const WorldModel &other)
Performs a shallow copy of a WorldModel. Since it does not copy geometry, this operation is very fast...
A (static) rigid object that may be manipulated.
Definition: RigidObject.h:15
int IsTerrain(int id) const
Returns the index of the terrain or -1 otherwise.
int LoadElement(const string &fn)
int IsRobot(int id) const
Returns the index of the robot or -1 otherwise.
int RayCast(const Ray3D &r, Vector3 &worldpt)
Returns the ID of the entity the ray hits, or -1 if nothing was hit. Returns hit point in world frame...
A model of a static terrain with known friction.
Definition: Terrain.h:15
bool CanLoadElementExt(const char *ext) const
Returns true if the given extension is loadable as an element.
bool LoadXML(const char *fn)
The main robot type used in RobotSim.
Definition: Robot.h:83
int RayCastIgnore(const Ray3D &r, const vector< int > &ignoreIDs, Vector3 &worldpt)
Same as RayCast but ignores some IDs (see TerrainID, RigidObjectID, RobotID, RobotLinkID) ...
RobotModel * RayCastRobot(const Ray3D &r, int &body, Vector3 &localpt)
Ray casts only robots. Returns hit robot, link, and point in local frame.
int RayCastSelected(const Ray3D &r, const vector< int > &selectedIDs, Vector3 &worldpt)
Same as RayCast but only checks specified IDs (see TerrainID, RigidObjectID, RobotID, RobotLinkID)
Definition: ContactDistance.h:6
RigidObjectModel * RayCastObject(const Ray3D &r, Vector3 &localpt)
Ray casts only objects. Returns hit object and point in local frame.
The main world class containing multiple robots, objects, and static geometries (terrains). Lights and other viewport information may also be stored here.
Definition: World.h:24