Sensing.cpp
Go to the documentation of this file.00001 /* ============================================================ 00002 * 00003 * This file is a part of RCI project 00004 * 00005 * Copyright (C) 2011 by Arne Nordmann <anordman at cor-lab dot uni-bielefeld dot de> 00006 * 00007 * This file may be licensed under the terms of the 00008 * GNU Lesser General Public License Version 3 (the ``LGPL''), 00009 * or (at your option) any later version. 00010 * 00011 * Software distributed under the License is distributed 00012 * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either 00013 * express or implied. See the LGPL for the specific language 00014 * governing rights and limitations. 00015 * 00016 * You should have received a copy of the LGPL along with this 00017 * program. If not, go to http://www.gnu.org/licenses/lgpl.html 00018 * or write to the Free Software Foundation, Inc., 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00020 * 00021 * The development of this software was supported by: 00022 * CoR-Lab, Research Institute for Cognition and Robotics 00023 * Bielefeld University 00024 * 00025 * ============================================================ */ 00026 00027 #include "Sensing.h" 00028 00029 namespace rci { 00030 00031 void Sensing::update() { 00032 throw std::runtime_error("Not implemented."); 00033 } 00034 00035 cca::DataTransferObjectPtr Sensing::get() const { 00036 throw std::runtime_error("Not implemented."); 00037 } 00038 00039 Sensing::Sensing() { 00040 } 00041 00042 Sensing::~Sensing() { 00043 } 00044 00045 JointAnglesPtr PositionSensing::getJointPosition() const { 00046 return _latestJointPosition; 00047 } 00048 00049 void PositionSensing::updateJointPosition(JointAnglesPtr angle) { 00050 this->_latestJointPosition = angle; 00051 } 00052 00053 PositionSensing::PositionSensing(unsigned int dimension) : 00054 _latestJointPosition( 00055 new JointAngles(nemo::RealVector(nemo::dim(dimension), 0.0))) { 00056 } 00057 00058 PositionSensing::~PositionSensing() { 00059 } 00060 00061 JointVelocitiesPtr VelocitySensing::getVelocity() const { 00062 return _latestJointVelocity; 00063 } 00064 00065 void VelocitySensing::updateJointVelocity(JointVelocitiesPtr vel) { 00066 this->_latestJointVelocity = vel; 00067 } 00068 00069 VelocitySensing::VelocitySensing(unsigned int dimension) : 00070 _latestJointVelocity( 00071 new JointVelocities( 00072 nemo::RealVector(nemo::dim(dimension), 0.0))) { 00073 } 00074 VelocitySensing::~VelocitySensing() { 00075 } 00076 00077 PressurePtr PressureSensing::getPressure() const { 00078 return _latestPressureValues; 00079 } 00080 00081 PressureSensing::PressureSensing(unsigned int dimension) : 00082 _latestPressureValues( 00083 new Pressure(nemo::RealVector(nemo::dim(dimension), 0.0))) { 00084 } 00085 00086 PressureSensing::~PressureSensing() { 00087 } 00088 00089 LengthPtr LengthSensing::getLength() const { 00090 return _latestLengthValues; 00091 } 00092 00093 LengthSensing::LengthSensing(unsigned int dimension) : 00094 _latestLengthValues( 00095 new Length(nemo::RealVector(nemo::dim(dimension), 0.0))) { 00096 } 00097 LengthSensing::~LengthSensing() { 00098 } 00099 00100 ForcesPtr ForceSensing::getForces() const { 00101 if (!forces) { 00102 throw std::runtime_error( 00103 "[ForceSensing::getForces] No forces received yet!"); 00104 } 00105 return forces; 00106 } 00107 00108 void ForceSensing::updateForces(ForcesPtr force) { 00109 if (!force) { 00110 throw std::runtime_error( 00111 "[ForceSensing::updateForces] Null Pointer Exception!"); 00112 } 00113 if (!forces) { 00114 forces = ForcesPtr(new Forces(*force)); 00115 } else { 00116 forces->setValues(force->asDoubleVector()); 00117 } 00118 } 00119 00120 ForceSensing::ForceSensing() : 00121 forces(new Forces(nemo::RealVector(nemo::dim(3), 0.0))) { 00122 } 00123 ForceSensing::~ForceSensing() { 00124 } 00125 00126 JointTorquesPtr TorqueSensing::getTorque() const { 00127 if (!torques) { 00128 throw std::runtime_error( 00129 "[TorqueSensing::getTorque] No torques received yet!"); 00130 } 00131 return torques; 00132 } 00133 00134 void TorqueSensing::updateTorque(JointTorquesPtr torque) { 00135 if (!torque) { 00136 throw std::runtime_error( 00137 "[TorqueSensing::updateTorque] Null Pointer Exception!"); 00138 } 00139 this->torques->setValue(0, torque->asDouble(0)); 00140 } 00141 00142 TorqueSensing::TorqueSensing(unsigned int dimension) : 00143 torques(new JointTorques(nemo::RealVector(nemo::dim(dimension), 0.0))) { 00144 } 00145 00146 TorqueSensing::~TorqueSensing() { 00147 } 00148 00149 PowerPtr PowerSensing::getPower() const { 00150 return power; 00151 } 00152 00153 PowerSensing::PowerSensing(unsigned int dimension) : 00154 power(new Power(nemo::RealVector(nemo::dim(dimension), 0.0))) { 00155 } 00156 00157 PowerSensing::~PowerSensing() { 00158 } 00159 00160 }
Generated on Thu Aug 2 14:02:47 2012 for RCI by 1.6.3