Representation.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_PHYSICS_REPRESENTATION_H
#define SURGSIM_PHYSICS_REPRESENTATION_H
#include <string>
#include <typeindex>
#include "SurgSim/Framework/Representation.h"
#include "SurgSim/Math/Vector.h"
#include "SurgSim/Physics/ConstraintType.h"
namespace SurgSim
{
namespace DataStructures
{
struct Location;
}
namespace Framework
{
class Logger;
}
namespace Collision
{
class Representation;
}
namespace Physics
{
class Constraint;
class ConstraintData;
class ConstraintImplementation;
class Localization;
class Representation : public SurgSim::Framework::Representation
{
public:
explicit Representation(const std::string& name);
virtual ~Representation();
virtual void resetState();
size_t getNumDof() const;
void setIsGravityEnabled(bool isGravityEnabled);
bool isGravityEnabled() const;
void setIsDrivingSceneElementPose(bool isDrivingSceneElementPose);
bool isDrivingSceneElementPose();
virtual void beforeUpdate(double dt);
virtual void update(double dt);
virtual void afterUpdate(double dt);
virtual std::shared_ptr<Localization> createLocalization(const SurgSim::DataStructures::Location& location);
virtual void applyCorrection(double dt, const Eigen::VectorBlock<SurgSim::Math::Vector>& deltaVelocity);
std::shared_ptr<SurgSim::Collision::Representation> getCollisionRepresentation() const;
virtual void setCollisionRepresentation(std::shared_ptr<SurgSim::Collision::Representation> representation);
std::shared_ptr<ConstraintImplementation> getConstraintImplementation(SurgSim::Physics::ConstraintType type);
protected:
void setNumDof(size_t numDof);
const SurgSim::Math::Vector3d& getGravity() const;
std::shared_ptr<SurgSim::Collision::Representation> m_collisionRepresentation;
void driveSceneElementPose(const SurgSim::Math::RigidTransform3d& pose);
private:
Representation(const Representation&);
Representation& operator =(const Representation&);
const SurgSim::Math::Vector3d m_gravity;
size_t m_numDof;
bool m_isGravityEnabled;
bool m_isDrivingSceneElementPose;
std::shared_ptr<SurgSim::Framework::Logger> m_logger;
};
}; // namespace Physics
}; // namespace SurgSim
#endif // SURGSIM_PHYSICS_REPRESENTATION_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Physics::Representation::m_isGravityEnabled
bool m_isGravityEnabled
Gravity enabled flag.
Definition: Representation.h:162
SurgSim::Physics::Representation::m_collisionRepresentation
std::shared_ptr< SurgSim::Collision::Representation > m_collisionRepresentation
This entity&#39;s collision representation, these are usually very specific to the physics representation...
Definition: Representation.h:141
SurgSim::Physics::Representation
The Representation class defines the base class for all physics objects.
Definition: Representation.h:53
SurgSim::DataStructures::Location
A Location defines a local position w.r.t.
Definition: Location.h:39
SurgSim::Physics::Representation::m_numDof
size_t m_numDof
Number of degrees of freedom for this representation.
Definition: Representation.h:159
ConstraintType.h
Representation.h
SurgSim::Physics::Representation::m_isDrivingSceneElementPose
bool m_isDrivingSceneElementPose
Is this representation driving the sceneElement pose.
Definition: Representation.h:165
SurgSim::Math::RigidTransform3d
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
Vector.h
Definitions of small fixed-size vector types.
SurgSim::Physics::Representation::m_logger
std::shared_ptr< SurgSim::Framework::Logger > m_logger
Logger for this class.
Definition: Representation.h:168
SurgSim::Physics::Representation::m_gravity
const SurgSim::Math::Vector3d m_gravity
Gravity vector.
Definition: Representation.h:156
SurgSim::Framework::Representation
Representations are manifestations of a SceneElement.
Definition: Representation.h:33
SurgSim::Physics::ConstraintType
ConstraintType
Definition: ConstraintType.h:24
SurgSim::Math::Vector3d
Eigen::Matrix< double, 3, 1 > Vector3d
A 3D vector of doubles.
Definition: Vector.h:57