SimObject.cpp
Go to the documentation of this file.
1 #ifdef MUJOCO_PHYSICS_WORLD
2 #include "SimObject.h"
3 
4 #include <VirtualRobot/math/Helpers.h>
5 
7 
8 #include <MujocoX/libraries/Simulation/Data.h>
9 
10 
11 using namespace mujoco;
12 
14 {
15 }
16 
17 SimObject::SimObject(const std::string& name) : body(name), geom(name)
18 {
19 }
20 
21 SimObject::SimObject(VirtualRobot::SceneObjectPtr sceneObject) :
22  body(sceneObject->getName()), geom(sceneObject->getName()), sceneObject(sceneObject)
23 {
24 }
25 
26 void
27 SimObject::update(Model& model)
28 {
29  body.update(model);
30  geom.update(model);
31 }
32 
33 void
34 SimObject::updateSceneObjectPose(const Data& data, float lengthScaling)
35 {
36  ARMARX_CHECK(sceneObject);
37  Eigen::Matrix4f pose = data.getBodyPose(body);
38  math::Helpers::Position(pose) *= lengthScaling;
39  sceneObject->setGlobalPose(pose);
40 }
41 
42 const std::string&
43 SimObject::name() const
44 {
45  return body.name();
46 }
47 
48 
49 #endif
mujoco
Definition: SimObject.h:7
GfxTL::Matrix4f
MatrixXX< 4, 4, float > Matrix4f
Definition: MatrixXX.h:650
ARMARX_CHECK
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
Definition: ExpressionException.h:82
SimObject.h
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
mujoco::SimObject::SimObject
SimObject()
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:68
ExpressionException.h
scene3D::SceneObjectPtr
boost::intrusive_ptr< SceneObject > SceneObjectPtr
Definition: PointerDefinitions.h:40
armarx::navigation::core::Position
Eigen::Vector3f Position
Definition: basic_types.h:36