Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include <uwsim/UWSimUtils.h>
00014 #include <uwsim/PressureSensor.h>
00015
00016 #include <osg/PositionAttitudeTransform>
00017
00018 double PressureSensor::getMeasurement()
00019 {
00020
00021 boost::shared_ptr<osg::Matrix> rMs = getWorldCoords(node_);
00022 osg::Matrixd lMs = *rMs * osg::Matrixd::inverse(rMl_);
00023
00024
00025 static boost::normal_distribution<> normal(0, std_);
00026 static boost::variate_generator<boost::mt19937&, boost::normal_distribution<> > var_nor(rng_, normal);
00027
00028 return lMs.getTrans().z() + var_nor();
00029 }
00030
00031 int PressureSensor::getTFTransform(tf::Pose & pose, std::string & parent){
00032 parent=parentLinkName;
00033 pose.setOrigin(tf::Vector3(parent_->asTransform()->asPositionAttitudeTransform()->getPosition().x(),
00034 parent_->asTransform()->asPositionAttitudeTransform()->getPosition().y(),
00035 parent_->asTransform()->asPositionAttitudeTransform()->getPosition().z()));
00036 pose.setRotation( tf::Quaternion(parent_->asTransform()->asPositionAttitudeTransform()->getAttitude().x(),
00037 parent_->asTransform()->asPositionAttitudeTransform()->getAttitude().y(),
00038 parent_->asTransform()->asPositionAttitudeTransform()->getAttitude().z(),
00039 parent_->asTransform()->asPositionAttitudeTransform()->getAttitude().w()));
00040 return 1;
00041
00042 }