extend rf2o namespace to class

This commit is contained in:
Jeremie Deray
2017-08-16 10:09:20 +02:00
parent 77fb8e3a86
commit fb5334d542
3 changed files with 13 additions and 3 deletions

View File

@@ -34,6 +34,7 @@
#include <unsupported/Eigen/MatrixFunctions> #include <unsupported/Eigen/MatrixFunctions>
namespace rf2o { namespace rf2o {
template <typename T> template <typename T>
inline int sign(T x) { return x<0 ? -1:1; } inline int sign(T x) { return x<0 ? -1:1; }
@@ -61,7 +62,6 @@ inline Eigen::Matrix<T, 3, 3> matrixYaw(const T yaw)
{ {
return matrixRollPitchYaw<T>(0, 0, yaw); return matrixRollPitchYaw<T>(0, 0, yaw);
} }
} // namespace rf2o
class CLaserOdometry2D class CLaserOdometry2D
{ {
@@ -175,4 +175,6 @@ protected:
void Reset(const Pose3d& ini_pose/*, CObservation2DRangeScan scan*/); void Reset(const Pose3d& ini_pose/*, CObservation2DRangeScan scan*/);
}; };
} /* namespace rf2o */
#endif // CLaserOdometry2D_H #endif // CLaserOdometry2D_H

View File

@@ -17,6 +17,8 @@
#include "rf2o_laser_odometry/CLaserOdometry2D.h" #include "rf2o_laser_odometry/CLaserOdometry2D.h"
namespace rf2o {
// -------------------------------------------- // --------------------------------------------
// CLaserOdometry2D // CLaserOdometry2D
//--------------------------------------------- //---------------------------------------------
@@ -951,3 +953,5 @@ void CLaserOdometry2D::PoseUpdate()
ang_speed = sum2 / last_m_ang_speeds.size(); ang_speed = sum2 / last_m_ang_speeds.size();
*/ */
} }
} /* namespace rf2o */

View File

@@ -20,6 +20,8 @@
#include <tf/transform_broadcaster.h> #include <tf/transform_broadcaster.h>
#include <tf/transform_listener.h> #include <tf/transform_listener.h>
namespace rf2o {
class CLaserOdometry2DNode : CLaserOdometry2D class CLaserOdometry2DNode : CLaserOdometry2D
{ {
public: public:
@@ -249,6 +251,8 @@ void CLaserOdometry2DNode::publish()
odom_pub.publish(odom); odom_pub.publish(odom);
} }
} /* namespace rf2o */
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// MAIN // MAIN
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
@@ -256,7 +260,7 @@ int main(int argc, char** argv)
{ {
ros::init(argc, argv, "RF2O_LaserOdom"); ros::init(argc, argv, "RF2O_LaserOdom");
CLaserOdometry2DNode myLaserOdomNode; rf2o::CLaserOdometry2DNode myLaserOdomNode;
ros::TimerOptions timer_opt; ros::TimerOptions timer_opt;
timer_opt.oneshot = false; timer_opt.oneshot = false;
@@ -264,7 +268,7 @@ int main(int argc, char** argv)
timer_opt.callback_queue = ros::getGlobalCallbackQueue(); timer_opt.callback_queue = ros::getGlobalCallbackQueue();
timer_opt.tracked_object = ros::VoidConstPtr(); timer_opt.tracked_object = ros::VoidConstPtr();
timer_opt.callback = boost::bind(&CLaserOdometry2DNode::process, &myLaserOdomNode, _1); timer_opt.callback = boost::bind(&rf2o::CLaserOdometry2DNode::process, &myLaserOdomNode, _1);
timer_opt.period = ros::Rate(myLaserOdomNode.freq).expectedCycleTime(); timer_opt.period = ros::Rate(myLaserOdomNode.freq).expectedCycleTime();
ros::Timer rf2o_timer = ros::NodeHandle("~").createTimer(timer_opt); ros::Timer rf2o_timer = ros::NodeHandle("~").createTimer(timer_opt);