Go to the documentation of this file.
27 #include <SimDynamics/DynamicsEngine/DynamicsEngine.h>
28 #include <SimDynamics/DynamicsWorld.h>
29 #include <SimDynamics/DynamicsEngine/BulletEngine/BulletEngine.h>
30 #include <SimDynamics/DynamicsEngine/DynamicsRobot.h>
31 #include <SimDynamics/DynamicsEngine/DynamicsObject.h>
32 #include <SimDynamics/DynamicsEngine/BulletEngine/BulletRobotLogger.h>
34 #include <btBulletDynamicsCommon.h>
35 #include <LinearMath/btQuickprof.h>
38 #include <Eigen/Geometry>
41 #include <ArmarXSimulation/interface/simulator/SimulatorInterface.h>
66 void actuateRobotJoints(
const std::string& robotName,
const std::map< std::string, float>& angles,
const std::map< std::string, float>& velocities)
override;
67 void actuateRobotJointsPos(
const std::string& robotName,
const std::map< std::string, float>& angles)
override;
68 void actuateRobotJointsVel(
const std::string& robotName,
const std::map< std::string, float>& velocities)
override;
72 void applyForceRobotNode(
const std::string& robotName,
const std::string& robotNodeName,
const Eigen::Vector3f& force)
override;
73 void applyTorqueRobotNode(
const std::string& robotName,
const std::string& robotNodeName,
const Eigen::Vector3f& torque)
override;
75 void applyForceObject(
const std::string& objectName,
const Eigen::Vector3f& force)
override;
76 void applyTorqueObject(
const std::string& objectName,
const Eigen::Vector3f& torque)
override;
78 bool hasObject(
const std::string& instanceName)
override;
82 bool hasRobot(
const std::string& robotName)
override;
83 bool hasRobotNode(
const std::string& robotName,
const std::string& robotNodeName)
override;
84 float getRobotMass(
const std::string& robotName)
override;
87 float getRobotJointAngle(
const std::string& robotName,
const std::string& nodeName)
override;
97 float getRobotMaxTorque(
const std::string& robotName,
const std::string& nodeName)
override;
98 void setRobotMaxTorque(
const std::string& robotName,
const std::string& nodeName,
float maxTorque)
override;
102 Eigen::Vector3f
getRobotLinearVelocity(
const std::string& robotName,
const std::string& nodeName)
override;
105 void setRobotLinearVelocity(
const std::string& robotName,
const std::string& robotNodeName,
const Eigen::Vector3f& vel)
override;
106 void setRobotAngularVelocity(
const std::string& robotName,
const std::string& robotNodeName,
const Eigen::Vector3f& vel)
override;
133 SimDynamics::BulletEnginePtr
getEngine();
135 std::vector<VirtualRobot::SceneObjectPtr>
getObjects()
override;
138 SimDynamics::DynamicsObjectPtr
getObject(
const std::string& objectName);
143 void enableLogging(
const std::string& robotName,
const std::string& logFile)
override;
145 armarx::DistanceInfo
getRobotNodeDistance(
const std::string& robotName,
const std::string& robotNodeName1,
const std::string& robotNodeName2)
override;
146 armarx::DistanceInfo
getDistance(
const std::string& robotName,
const std::string& robotNodeName,
const std::string& worldObjectName)
override;
148 std::vector<SimDynamics::DynamicsEngine::DynamicsContactInfo>
copyContacts()
override;
154 std::map<std::string, VirtualRobot::RobotPtr>
getRobots()
override;
155 virtual SimDynamics::DynamicsRobotPtr
getDynamicRobot(
const std::string& robotName);
160 void setRobotNodeSimType(
const std::string& robotName,
const std::string& robotNodeName, VirtualRobot::SceneObject::Physics::SimulationType simType)
override;
161 void setObjectSimType(
const std::string& objectName, VirtualRobot::SceneObject::Physics::SimulationType simType)
override;
169 bool objectGraspedEngine(
const std::string& robotName,
const std::string& robotNodeName,
const std::string& objectName,
Eigen::Matrix4f& storeLocalTransform)
override;
172 bool objectReleasedEngine(
const std::string& robotName,
const std::string& robotNodeName,
const std::string& objectName)
override;
177 void setupFloorEngine(
bool enable,
const std::string& floorTexture)
override;
185 Eigen::Vector3f& linearVelocity,
186 Eigen::Vector3f& angularVelocity)
override;
203 std::vector<SimDynamics::DynamicsEngine::DynamicsContactInfo>
contacts;
223 SimDynamics::DynamicsObjectPtr
getFirstDynamicsObject(
const std::string& robotName,
const std::string& nodeName);
225 bool synchronizeRobotNodePoses(
const std::string& robotName, std::map<std::string, armarx::PoseBasePtr>& objMap)
override;
void applyTorqueObject(const std::string &objectName, const Eigen::Vector3f &torque) override
void setObjectPose(const std::string &objectName, const Eigen::Matrix4f &globalPose) override
bool synchronizeSceneObjectPoses(VirtualRobot::SceneObjectPtr currentObjEngine, std::map< std::string, armarx::PoseBasePtr > &objMap) override
~BulletPhysicsWorld() override
void actuateRobotJoints(const std::string &robotName, const std::map< std::string, float > &angles, const std::map< std::string, float > &velocities) override
std::shared_ptr< BulletPhysicsWorld > BulletPhysicsWorldPtr
bool addRobotEngine(VirtualRobot::RobotPtr robot, double pid_p, double pid_i, double pid_d, const std::string &filename, bool staticRobot, bool selfCollisions) override
armarx::DistanceInfo getDistance(const std::string &robotName, const std::string &robotNodeName, const std::string &worldObjectName) override
SimDynamics::BulletEnginePtr getEngine()
Eigen::Vector3f getRobotLinearVelocity(const std::string &robotName, const std::string &nodeName) override
float getRobotJointLimitLo(const std::string &robotName, const std::string &nodeName) override
bool objectGraspedEngine(const std::string &robotName, const std::string &robotNodeName, const std::string &objectName, Eigen::Matrix4f &storeLocalTransform) override
create a joint
VirtualRobot::RobotPtr robot
bool synchronizeSimulationDataEngine() override
void setRobotAngularVelocity(const std::string &robotName, const std::string &robotNodeName, const Eigen::Vector3f &vel) override
int getFixedTimeStepMS() override
SimDynamics::DynamicsWorldPtr dynamicsWorld
ForceTorqueDataSeq getRobotForceTorqueSensors(const std::string &robotName) override
bool removeObstacleEngine(const std::string &name) override
std::vector< VirtualRobot::SceneObjectPtr > getObjects() override
void stepPhysicsRealTime() override
Perform one simulation step.
bool getRobotStatus(const std::string &robotName, NameValueMap &jointAngles, NameValueMap &jointVelocities, NameValueMap &jointTorques, Eigen::Vector3f &linearVelocity, Eigen::Vector3f &angularVelocity) override
float maxRealTimeSimSpeed
Eigen::Vector3f getRobotAngularVelocity(const std::string &robotName, const std::string &nodeName) override
The SimulatedWorld class encapsulates the whole physics simulation and the corresponding data.
void setRobotMaxTorque(const std::string &robotName, const std::string &nodeName, float maxTorque) override
float getRobotJointLimitHi(const std::string &robotName, const std::string &nodeName) override
void stepStaticRobots(double deltaInSeconds)
void applyTorqueRobotNode(const std::string &robotName, const std::string &robotNodeName, const Eigen::Vector3f &torque) override
void stepPhysicsFixedTimeStep() override
Perform one simulation step.
std::vector< std::string > getRobotNames() override
std::vector< SimDynamics::DynamicsObjectPtr > getDynamicObjects()
SimDynamics::DynamicsObjectPtr getFirstDynamicsObject(const std::string &robotName, const std::string &nodeName)
void setupFloorEngine(bool enable, const std::string &floorTexture) override
float getRobotMaxTorque(const std::string &robotName, const std::string &nodeName) override
void setRobotLinearVelocityRobotRootFrame(const std::string &robotName, const std::string &robotNodeName, const Eigen::Vector3f &vel) override
bool updateForceTorqueSensor(ForceTorqueInfo &ftInfo) override
void activateObject(const std::string &objectName) override
bool synchronizeObjects() override
bool synchronizeRobotNodePoses(const std::string &robotName, std::map< std::string, armarx::PoseBasePtr > &objMap) override
void setRobotAngularVelocityRobotRootFrame(const std::string &robotName, const std::string &robotNodeName, const Eigen::Vector3f &vel) override
void actuateRobotJointsVel(const std::string &robotName, const std::map< std::string, float > &velocities) override
Eigen::Matrix4f getObjectPose(const std::string &objectName) override
btScalar getDeltaTimeMicroseconds()
SimDynamics::DynamicsObjectPtr getObject(const std::string &objectName)
bool hasRobot(const std::string &robotName) override
bool removeRobotEngine(const std::string &robotName) override
VirtualRobot::RobotPtr getRobot(const std::string &robotName) override
void enableLogging(const std::string &robotName, const std::string &logFile) override
std::map< std::string, float > getRobotJointVelocities(const std::string &robotName) override
std::map< std::string, float > targetVelocities
VirtualRobot::RobotPtr adaptRobotToWorld(VirtualRobot::RobotPtr robot) override
const KinematicUnitDatafieldCreator jointVelocities("jointVelocities")
int getContactCount() override
float getRobotJointVelocity(const std::string &robotName, const std::string &nodeName) override
bool hasObject(const std::string &instanceName) override
int bulletFixedTimeStepMS
std::vector< SimDynamics::DynamicsObjectPtr > dynamicsObjects
SimDynamics::BulletRobotLoggerPtr robotLogger
Eigen::Matrix4f getRobotPose(const std::string &robotName) override
float getRobotJointAngle(const std::string &robotName, const std::string &nodeName) override
void setRobotPose(const std::string &robotName, const Eigen::Matrix4f &globalPose) override
void actuateRobotJointsPos(const std::string &robotName, const std::map< std::string, float > &angles) override
const KinematicUnitDatafieldCreator jointAngles("jointAngles")
FramedPosePtr toFramedPose(const Eigen::Matrix4f &globalPose, const std::string &robotName, const std::string &frameName) override
toFramedPose Constructs a framed pose
std::map< std::string, float > getRobotJointTorques(const std::string &robotName) override
MatrixXX< 4, 4, float > Matrix4f
std::vector< SimDynamics::DynamicsEngine::DynamicsContactInfo > copyContacts() override
SimDynamics::BulletEnginePtr bulletEngine
void actuateRobotJointsTorque(const std::string &robotName, const std::map< std::string, float > &torques) override
void applyForceRobotNode(const std::string &robotName, const std::string &robotNodeName, const Eigen::Vector3f &force) override
void setObjectSimType(const std::string &objectName, VirtualRobot::SceneObject::Physics::SimulationType simType) override
void setRobotNodeSimType(const std::string &robotName, const std::string &robotNodeName, VirtualRobot::SceneObject::Physics::SimulationType simType) override
The BulletPhysicsWorld class encapsulates the whole physics simulation and the corresponding data.
std::vector< std::string > getObstacleNames() override
bool addObstacleEngine(VirtualRobot::SceneObjectPtr o, VirtualRobot::SceneObject::Physics::SimulationType simType) override
boost::intrusive_ptr< SceneObject > SceneObjectPtr
virtual void initialize(int stepSizeMS, int bulletFixedTimeStepMS, int bulletFixedTimeStepMaxNrLoops, float maxRealTimeSimSpeed=1, bool floorPlane=false, std::string floorTexture=std::string())
std::map< std::string, VirtualRobot::RobotPtr > getRobots() override
Eigen::Matrix4f getRobotNodePose(const std::string &robotName, const std::string &robotNodeName) override
VirtualRobot::SceneObjectPtr getFloor() override
bool objectReleasedEngine(const std::string &robotName, const std::string &robotNodeName, const std::string &objectName) override
remove a joint
const KinematicUnitDatafieldCreator jointTorques("jointTorques")
SimDynamics::DynamicsRobotPtr dynamicsRobot
armarx::DistanceInfo getRobotNodeDistance(const std::string &robotName, const std::string &robotNodeName1, const std::string &robotNodeName2) override
void setRobotLinearVelocity(const std::string &robotName, const std::string &robotNodeName, const Eigen::Vector3f &vel) override
int bulletFixedTimeStepMaxNrLoops
SimDynamics::DynamicsObjectPtr getDynamicsObject(const std::string &objectName)
bool hasRobotNode(const std::string &robotName, const std::string &robotNodeName) override
std::map< std::string, float > getRobotJointAngles(const std::string &robotName) override
std::vector< SimDynamics::DynamicsEngine::DynamicsContactInfo > contacts
virtual SimDynamics::DynamicsRobotPtr getDynamicRobot(const std::string &robotName)
float getRobotMass(const std::string &robotName) override
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::map< std::string, DynamicsRobotInfo > dynamicRobots
std::shared_ptr< class Robot > RobotPtr
void applyForceObject(const std::string &objectName, const Eigen::Vector3f &force) override