Skip to content
Snippets Groups Projects
Commit 0e2732f8 authored by vahrenkamp's avatar vahrenkamp
Browse files

Reorganizing __func__ and throw statements, in order to support Windows VS

git-svn-id: http://svn.code.sf.net/p/simox/code/trunk@151 042f3d55-54a8-47e9-b7fb-15903f145c44
parent ee22cb02
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,7 @@ MatrixXf DifferentialIK::getJacobianMatrix(RobotNodePtr tcp, IKSolver::Cartesian
MatrixXf orientation = MatrixXf::Zero(3,nDoF);
if (!tcp) tcp = this->getDefaultTCP();
// THROW_VR_EXCEPTION_IF(!tcp,boost::format("No tcp defined in node set \"%1%\" of robot %2% (DifferentialIK::%3% )") % this->rns->getName() % this->rns->getRobot()->getName() % __func__);
// THROW_VR_EXCEPTION_IF(!tcp,boost::format("No tcp defined in node set \"%1%\" of robot %2% (DifferentialIK::%3% )") % this->rns->getName() % this->rns->getRobot()->getName() % BOOST_CURRENT_FUNCTION);
......
#include "LinkedCoordinate.h"
#include "Robot.h"
#include <boost/format.hpp>
#include <boost/current_function.hpp>
using namespace VirtualRobot;
using namespace boost;
......@@ -8,42 +9,42 @@ using namespace std;
void LinkedCoordinate::set( const RobotNodePtr &frame,const Eigen::Matrix4f &pose) throw(VirtualRobotException) {
void LinkedCoordinate::set( const RobotNodePtr &frame,const Eigen::Matrix4f &pose) {
if (!frame)
THROW_VR_EXCEPTION(format("RobotNodePtr not assigned (LinkedCoordinate::%1%)") % __func__);
THROW_VR_EXCEPTION(format("RobotNodePtr not assigned (LinkedCoordinate::%1%)") % BOOST_CURRENT_FUNCTION);
if (!this->robot->hasRobotNode( frame ) )
THROW_VR_EXCEPTION(format("Robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % frame->getName() % this->robot->getName() % __func__);
THROW_VR_EXCEPTION(format("Robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % frame->getName() % this->robot->getName() % BOOST_CURRENT_FUNCTION);
this->pose = pose;
this->frame = frame;
}
void LinkedCoordinate::set( const std::string &frame,const Eigen::Matrix4f &pose) throw(VirtualRobotException) {
void LinkedCoordinate::set( const std::string &frame,const Eigen::Matrix4f &pose) {
if (!this->robot->hasRobotNode( frame ) )
THROW_VR_EXCEPTION(format("Robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % frame % this->robot->getName() %__func__);
THROW_VR_EXCEPTION(format("Robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % frame % this->robot->getName() % BOOST_CURRENT_FUNCTION);
this->set(this->robot->getRobotNode(frame),pose);
}
void LinkedCoordinate::set( const std::string &frame,const Eigen::Vector3f &coordinate) throw(VirtualRobotException) {
void LinkedCoordinate::set( const std::string &frame,const Eigen::Vector3f &coordinate) {
Eigen::Matrix4f pose = Eigen::Matrix4f::Identity();
pose.block<3,1>(0,3) = coordinate;
this->set(frame,pose);
}
void LinkedCoordinate::set( const RobotNodePtr &frame,const Eigen::Vector3f &coordinate) throw(VirtualRobotException){
void LinkedCoordinate::set( const RobotNodePtr &frame,const Eigen::Vector3f &coordinate) {
Eigen::Matrix4f pose = Eigen::Matrix4f::Identity();
pose.block<3,1>(0,3) = coordinate;
this->set(frame,pose);
}
void LinkedCoordinate::changeFrame(const RobotNodePtr & destination) throw(VirtualRobotException){
void LinkedCoordinate::changeFrame(const RobotNodePtr & destination) {
if (!destination)
THROW_VR_EXCEPTION(format("RobotNodePtr not assigned (LinkedCoordinate::%1%)") % __func__);
THROW_VR_EXCEPTION(format("RobotNodePtr not assigned (LinkedCoordinate::%1%)") % BOOST_CURRENT_FUNCTION);
if (!this->robot->hasRobotNode( destination) )
THROW_VR_EXCEPTION(format("Robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % destination->getName() % this->robot->getName() % __func__);
THROW_VR_EXCEPTION(format("Robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % destination->getName() % this->robot->getName() % BOOST_CURRENT_FUNCTION);
if (!this->frame)
this->pose = Eigen::Matrix4f::Identity();
......@@ -53,24 +54,24 @@ void LinkedCoordinate::changeFrame(const RobotNodePtr & destination) throw(Virtu
this->frame = destination;
}
void LinkedCoordinate::changeFrame(const std::string & destination) throw(VirtualRobotException){
void LinkedCoordinate::changeFrame(const std::string & destination) {
if (!this->robot->hasRobotNode( destination) )
THROW_VR_EXCEPTION(format("Robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % destination % this->robot->getName() % __func__);
THROW_VR_EXCEPTION(format("Robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % destination % this->robot->getName() % BOOST_CURRENT_FUNCTION);
this->changeFrame(this->robot->getRobotNode(destination));
}
Eigen::Matrix4f LinkedCoordinate::getInFrame(const RobotNodePtr & destination) const throw(VirtualRobotException){
Eigen::Matrix4f LinkedCoordinate::getInFrame(const RobotNodePtr & destination) const {
if (!destination)
THROW_VR_EXCEPTION(format("RobotNodePtr not assigned (LinkedCoordinate::%1%)") % __func__);
THROW_VR_EXCEPTION(format("RobotNodePtr not assigned (LinkedCoordinate::%1%)") % BOOST_CURRENT_FUNCTION);
if (!this->robot->hasRobotNode( destination) )
THROW_VR_EXCEPTION(format("Robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % destination->getName() % this->robot->getName() % __func__);
THROW_VR_EXCEPTION(format("Robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % destination->getName() % this->robot->getName() % BOOST_CURRENT_FUNCTION);
return LinkedCoordinate::getCoordinateTransformation(this->frame,destination,this->robot) * this->pose;
}
Eigen::Matrix4f LinkedCoordinate::getInFrame(const std::string & destination) const throw(VirtualRobotException){
Eigen::Matrix4f LinkedCoordinate::getInFrame(const std::string & destination) const {
if (!this->robot->hasRobotNode( destination) )
THROW_VR_EXCEPTION(format("Robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % destination % this->robot->getName() % __func__);
THROW_VR_EXCEPTION(format("Robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % destination % this->robot->getName() % BOOST_CURRENT_FUNCTION);
return LinkedCoordinate::getCoordinateTransformation(this->frame,this->robot->getRobotNode( destination),this->robot) * this->pose;
}
......@@ -80,15 +81,15 @@ Eigen::Matrix4f LinkedCoordinate::getCoordinateTransformation(const RobotNodePtr
const RobotNodePtr &destination, const RobotPtr &robot){
if (!destination)
THROW_VR_EXCEPTION(format("Destination RobotNodePtr not assigned (LinkedCoordinate::%1%)") % __func__);
THROW_VR_EXCEPTION(format("Destination RobotNodePtr not assigned (LinkedCoordinate::%1%)") % BOOST_CURRENT_FUNCTION);
if (!origin)
THROW_VR_EXCEPTION(format("Origin RobotNodePtr not assigned (LinkedCoordinate::%1%)") % __func__);
THROW_VR_EXCEPTION(format("Origin RobotNodePtr not assigned (LinkedCoordinate::%1%)") % BOOST_CURRENT_FUNCTION);
if (!robot)
THROW_VR_EXCEPTION(format("RobotPtr not assigned (LinkedCoordinate::%1%)") % __func__);
THROW_VR_EXCEPTION(format("RobotPtr not assigned (LinkedCoordinate::%1%)") % BOOST_CURRENT_FUNCTION);
if (!robot->hasRobotNode( origin) )
THROW_VR_EXCEPTION(format("Origin robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % origin->getName() % robot->getName() % __func__);
THROW_VR_EXCEPTION(format("Origin robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % origin->getName() % robot->getName() % BOOST_CURRENT_FUNCTION);
if (!robot->hasRobotNode( destination) )
THROW_VR_EXCEPTION(format("Destination robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % destination->getName() % robot->getName() % __func__);
THROW_VR_EXCEPTION(format("Destination robot node\"%1%\" not a member of robot \"%2%\" (LinkedCoordinate::%3%)") % destination->getName() % robot->getName() % BOOST_CURRENT_FUNCTION);
// std::cout << "Destination: " << destination->getName() <<std::endl << "Origin: " << origin->getName() << std::endl;
// std::cout << "Destination:\n" << destination->getGlobalPose() <<std::endl << "Origin:\n" << origin->getGlobalPose() << std::endl;
......
......@@ -66,7 +66,7 @@ public:
* @details If you want to use a different format for the pose you can use these
* helper functions @sa EulerToMatrix4x4 and @sa QuaternionsToMatrix4x4
*/
void set(const RobotNodePtr &frame,const Eigen::Matrix4f &pose=Eigen::Matrix4f::Identity()) throw(VirtualRobotException);
void set(const RobotNodePtr &frame,const Eigen::Matrix4f &pose=Eigen::Matrix4f::Identity());
/** Sets the frame of reference and the coordinate relative to it.
* @param frame The name of the robot node that defines the reference frame of the coordinate.
......@@ -75,7 +75,7 @@ public:
* @details A homogeneous vector can be converted using Eigen::Vector4f::head<3>().
*/
void set(const RobotNodePtr &frame,const Eigen::Vector3f &position) throw(VirtualRobotException);
void set(const RobotNodePtr &frame,const Eigen::Vector3f &position);
/** Sets the frame of reference and the pose relative to it.
* @param frame The name of the robot node that defines the reference frame of the coordinate.
......@@ -86,7 +86,7 @@ public:
* @sa set(Eigen::Matrix4x4,const RobotNodePtr &)
*/
void set(const std::string &frame,const Eigen::Matrix4f &pose=Eigen::Matrix4f::Identity()) throw(VirtualRobotException);
void set(const std::string &frame,const Eigen::Matrix4f &pose=Eigen::Matrix4f::Identity());
/** Sets the frame of reference and the coordinate relative to it.
* @param frame The name of the robot node that defines the reference frame of the coordinate.
......@@ -95,7 +95,7 @@ public:
* @details A homogeneous vector can be previously converted using Eigen::Vector4f::head<3>().
*/
void set(const std::string &frame,const Eigen::Vector3f &position) throw(VirtualRobotException);
void set(const std::string &frame,const Eigen::Vector3f &position);
/** Returns a RobotNodePtr that contains the frame of reference the coordinate is defined in.
* @returns The reference or an empty RobotNodePtr is none has been defined.
......@@ -108,14 +108,15 @@ public:
* @details If iCoord::set has not been called before, the pose is set to the
* unit marix.
*/
void changeFrame(const std::string & frame) throw(VirtualRobotException);
void changeFrame(const std::string & frame);
/** Sets a new reference frame and performs a coordinate transformation into this new frame.
* @param frame A reference to the robot node that defines the new reference.
* @details If iCoord::set has not been called before, the pose is set to the
* unit marix.
* @throw VirtualRobotException An exception is thrown if frame is NULL.
*/
void changeFrame(const RobotNodePtr & frame) throw(VirtualRobotException);
void changeFrame(const RobotNodePtr & frame);
/** Performs \a only a coordinate transformation into a new frame of reference.
* @param frame The name of the robot node that defines the new reference.
......@@ -124,7 +125,7 @@ public:
* @returns A homogeneous matrix of the pose
* @sa getPose()
*/
Eigen::Matrix4f getInFrame(const std::string & frame) const throw(VirtualRobotException);
Eigen::Matrix4f getInFrame(const std::string & frame) const;
/** Performs \a only a coordinate transformation into a new frame of reference.
* @param frame A reference to the robot node that defines the new reference.
......@@ -133,8 +134,9 @@ public:
* @returns A homogeneous matrix of the pose
* @sa getPose()
* @details If you are only interested in the translational part use iCoord::getPosition() or Matrix4f::block<3,1>(0,3).
* @throw VirtualRobotException An exception is thrown if frame is NULL.
*/
Eigen::Matrix4f getInFrame(const RobotNodePtr & frame) const throw(VirtualRobotException);
Eigen::Matrix4f getInFrame(const RobotNodePtr & frame) const;
/** Returns the actual pose stored in this object.
* @details If you are only interested in the translational part use iCoord::getPosition() or Matrix4f::block<3,1>(0,3).
......
......@@ -57,10 +57,10 @@ protected:
/**
* This macro throws a VirtualRobot::VirtualRobotException and is the preferred
* way of creating and throwing these types of exceptions.
* The reported message is composed of the linenumber and the file in which
* the throw occured and is followed by the \a messageString parameter.
* The reported message is composed of the line number and the file in which
* the throw occurred and is followed by the \a messageString parameter.
*/
#define THROW_VR_EXCEPTION(messageString) do{std::stringstream s; s << __FILE__ << ":" << __LINE__ << ": " << __func__ << ": " << messageString; std::string er = s.str(); throw VirtualRobot::VirtualRobotException(er);}while(0);
#define THROW_VR_EXCEPTION(messageString) do{std::stringstream s; s << __FILE__ << ":" << __LINE__ << ": " << BOOST_CURRENT_FUNCTION << ": " << messageString; std::string er = s.str(); throw VirtualRobot::VirtualRobotException(er);}while(0);
/**
* This macro checks \a condition and calls THROW_VR_EXCEPTION
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment