Skip to content
Snippets Groups Projects
Commit 59551679 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Wrapp functions() inside namespace wolf{}, and add using namespace wolf; inside main()

parent 8f61af3e
No related branches found
No related tags found
No related merge requests found
Showing
with 50 additions and 5 deletions
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
// EIGEN // EIGEN
//#include <Eigen/CholmodSupport> //#include <Eigen/CholmodSupport>
namespace wolf {
// inserts the sparse matrix 'ins' into the sparse matrix 'original' in the place given by 'row' and 'col' integers // inserts the sparse matrix 'ins' into the sparse matrix 'original' in the place given by 'row' and 'col' integers
void insertSparseBlock(const Eigen::SparseMatrix<WolfScalar>& ins, Eigen::SparseMatrix<WolfScalar>& original, const unsigned int& row, const unsigned int& col) void insertSparseBlock(const Eigen::SparseMatrix<WolfScalar>& ins, Eigen::SparseMatrix<WolfScalar>& original, const unsigned int& row, const unsigned int& col)
{ {
...@@ -27,10 +28,13 @@ void insertSparseBlock(const Eigen::SparseMatrix<WolfScalar>& ins, Eigen::Sparse ...@@ -27,10 +28,13 @@ void insertSparseBlock(const Eigen::SparseMatrix<WolfScalar>& ins, Eigen::Sparse
original.makeCompressed(); original.makeCompressed();
} }
}
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
using namespace wolf;
//Welcome message //Welcome message
std::cout << std::endl << " ========= WOLF IMPORTED .graph TEST ===========" << std::endl << std::endl; std::cout << std::endl << " ========= WOLF IMPORTED .graph TEST ===========" << std::endl << std::endl;
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "iri-algorithms/laser_scan_utils/corner_detector.h" #include "iri-algorithms/laser_scan_utils/corner_detector.h"
#include "iri-algorithms/laser_scan_utils/entities.h" #include "iri-algorithms/laser_scan_utils/entities.h"
namespace wolf {
//function travel around //function travel around
void motionCampus(unsigned int ii, Cpose3d & pose, double& displacement_, double& rotation_) void motionCampus(unsigned int ii, Cpose3d & pose, double& displacement_, double& rotation_)
{ {
...@@ -49,9 +50,12 @@ void motionCampus(unsigned int ii, Cpose3d & pose, double& displacement_, double ...@@ -49,9 +50,12 @@ void motionCampus(unsigned int ii, Cpose3d & pose, double& displacement_, double
pose.moveForward(displacement_); pose.moveForward(displacement_);
pose.rt.setEuler(pose.rt.head() + rotation_, pose.rt.pitch(), pose.rt.roll()); pose.rt.setEuler(pose.rt.head() + rotation_, pose.rt.pitch(), pose.rt.roll());
} }
}
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
using namespace wolf;
std::cout << "\n ========= 2D Robot with odometry and 2 LIDARs ===========\n"; std::cout << "\n ========= 2D Robot with odometry and 2 LIDARs ===========\n";
// USER INPUT ============================================================================================ // USER INPUT ============================================================================================
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
//main //main
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
using namespace wolf;
std::cout << std::endl << "CaptureLaser2D class test" << std::endl; std::cout << std::endl << "CaptureLaser2D class test" << std::endl;
std::cout << "========================================================" << std::endl; std::cout << "========================================================" << std::endl;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "iri-algorithms/laser_scan_utils/corner_detector.h" #include "iri-algorithms/laser_scan_utils/corner_detector.h"
#include "iri-algorithms/laser_scan_utils/entities.h" #include "iri-algorithms/laser_scan_utils/entities.h"
namespace wolf {
//function travel around //function travel around
void motionCampus(unsigned int ii, Cpose3d & pose, double& displacement_, double& rotation_) void motionCampus(unsigned int ii, Cpose3d & pose, double& displacement_, double& rotation_)
{ {
...@@ -48,9 +49,12 @@ void motionCampus(unsigned int ii, Cpose3d & pose, double& displacement_, double ...@@ -48,9 +49,12 @@ void motionCampus(unsigned int ii, Cpose3d & pose, double& displacement_, double
pose.moveForward(displacement_); pose.moveForward(displacement_);
pose.rt.setEuler(pose.rt.head() + rotation_, pose.rt.pitch(), pose.rt.roll()); pose.rt.setEuler(pose.rt.head() + rotation_, pose.rt.pitch(), pose.rt.roll());
} }
}
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
using namespace wolf;
std::cout << "\n ========= 2D Robot with odometry and 2 LIDARs ===========\n"; std::cout << "\n ========= 2D Robot with odometry and 2 LIDARs ===========\n";
// USER INPUT ============================================================================================ // USER INPUT ============================================================================================
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
int main() int main()
{ {
using namespace wolf;
std::cout << std::endl << "Eigen Quatenrnion test" << std::endl; std::cout << std::endl << "Eigen Quatenrnion test" << std::endl;
WolfScalar q1[4]; WolfScalar q1[4];
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
using namespace wolf;
/** /**
if (argc != 2 || atoi(argv[1]) < 0 || atoi(argv[1]) > 1) if (argc != 2 || atoi(argv[1]) < 0 || atoi(argv[1]) > 1)
{ {
......
...@@ -17,6 +17,7 @@ int main(){ ...@@ -17,6 +17,7 @@ int main(){
using namespace Eigen; using namespace Eigen;
using namespace std; using namespace std;
using namespace wolf;
VectorXs x(22); VectorXs x(22);
MatrixXs M(1,12); // matrix dimensions do not matter, just storage size. MatrixXs M(1,12); // matrix dimensions do not matter, just storage size.
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
int main() int main()
{ {
using namespace wolf;
// time // time
TimeStamp t0, t; TimeStamp t0, t;
t0.setToNow(); t0.setToNow();
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "wolf_problem.h" #include "wolf_problem.h"
//namespaces //namespaces
namespace wolf {
using namespace std; using namespace std;
//id count init //id count init
...@@ -92,9 +93,12 @@ class MeasurementN : public NodeLinked<FrameN,NodeTerminus> ...@@ -92,9 +93,12 @@ class MeasurementN : public NodeLinked<FrameN,NodeTerminus>
}; };
} // namespace wolf
int main() int main()
{ {
using namespace wolf;
cout << endl << "Node class test" << endl; cout << endl << "Node class test" << endl;
cout << "========================================================" << endl; cout << "========================================================" << endl;
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
int main (void) int main (void)
{ {
using namespace wolf;
// 3D // 3D
StateBlock* pp = new StateBlock(3); StateBlock* pp = new StateBlock(3);
StateQuaternion* op = new StateQuaternion; StateQuaternion* op = new StateQuaternion;
......
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
#include <list> #include <list>
namespace wolf{
}
// BASE CLASSES // BASE CLASSES
/** /**
...@@ -230,11 +232,15 @@ class SenNode : public Sen, public ChildOf<VehNode>, public Bot ...@@ -230,11 +232,15 @@ class SenNode : public Sen, public ChildOf<VehNode>, public Bot
virtual ~SenNode() { } virtual ~SenNode() { }
}; };
} // namespace wolf
///////////////////// /////////////////////
// IMPLEMENTATIONS, here to avoid incomplete types and unwanted #includes // IMPLEMENTATIONS, here to avoid incomplete types and unwanted #includes
///////////////////// /////////////////////
#include <iostream> #include <iostream>
namespace wolf {
using namespace std; using namespace std;
template<class Child> template<class Child>
...@@ -291,8 +297,12 @@ void VehNode::print() ...@@ -291,8 +297,12 @@ void VehNode::print()
unsigned int N::id_count_ = 0; unsigned int N::id_count_ = 0;
} // namespace wolf
int main() int main()
{ {
using namespace wolf;
// Create all nodes with up-pointers already set up // Create all nodes with up-pointers already set up
VehNode V; VehNode V;
SenNode S0(&V), S1(&V); SenNode S0(&V), S1(&V);
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
using namespace wolf;
//Welcome message //Welcome message
std::cout << std::endl << " ========= WOLF IMPORTED .graph TEST ===========" << std::endl << std::endl; std::cout << std::endl << " ========= WOLF IMPORTED .graph TEST ===========" << std::endl << std::endl;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
// EIGEN // EIGEN
//#include <Eigen/CholmodSupport> //#include <Eigen/CholmodSupport>
namespace wolf{
// inserts the sparse matrix 'ins' into the sparse matrix 'original' in the place given by 'row' and 'col' integers // inserts the sparse matrix 'ins' into the sparse matrix 'original' in the place given by 'row' and 'col' integers
void insertSparseBlock(const Eigen::SparseMatrix<WolfScalar>& ins, Eigen::SparseMatrix<WolfScalar>& original, const unsigned int& row, const unsigned int& col) void insertSparseBlock(const Eigen::SparseMatrix<WolfScalar>& ins, Eigen::SparseMatrix<WolfScalar>& original, const unsigned int& row, const unsigned int& col)
{ {
...@@ -27,10 +28,12 @@ void insertSparseBlock(const Eigen::SparseMatrix<WolfScalar>& ins, Eigen::Sparse ...@@ -27,10 +28,12 @@ void insertSparseBlock(const Eigen::SparseMatrix<WolfScalar>& ins, Eigen::Sparse
original.makeCompressed(); original.makeCompressed();
} }
}
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
using namespace wolf;
//Welcome message //Welcome message
std::cout << std::endl << " ========= WOLF IMPORTED .graph TEST ===========" << std::endl << std::endl; std::cout << std::endl << " ========= WOLF IMPORTED .graph TEST ===========" << std::endl << std::endl;
......
...@@ -18,7 +18,9 @@ ...@@ -18,7 +18,9 @@
// EIGEN // EIGEN
//#include <Eigen/CholmodSupport> //#include <Eigen/CholmodSupport>
namespace wolf{
// inserts the sparse matrix 'ins' into the sparse matrix 'original' in the place given by 'row' and 'col' integers // inserts the sparse matrix 'ins' into the sparse matrix 'original' in the place given by 'row' and 'col' integers
}
void insertSparseBlock(const Eigen::SparseMatrix<WolfScalar>& ins, Eigen::SparseMatrix<WolfScalar>& original, const unsigned int& row, const unsigned int& col) void insertSparseBlock(const Eigen::SparseMatrix<WolfScalar>& ins, Eigen::SparseMatrix<WolfScalar>& original, const unsigned int& row, const unsigned int& col)
{ {
for (int k=0; k<ins.outerSize(); ++k) for (int k=0; k<ins.outerSize(); ++k)
...@@ -27,10 +29,12 @@ void insertSparseBlock(const Eigen::SparseMatrix<WolfScalar>& ins, Eigen::Sparse ...@@ -27,10 +29,12 @@ void insertSparseBlock(const Eigen::SparseMatrix<WolfScalar>& ins, Eigen::Sparse
original.makeCompressed(); original.makeCompressed();
} }
}
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
using namespace wolf;
//Welcome message //Welcome message
std::cout << std::endl << " ========= WOLF IMPORTED .graph TEST ===========" << std::endl << std::endl; std::cout << std::endl << " ========= WOLF IMPORTED .graph TEST ===========" << std::endl << std::endl;
......
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
//Wolf includes //Wolf includes
#include "wolf_manager.h" #include "wolf_manager.h"
namespace wolf {
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
using namespace wolf;
//Welcome message //Welcome message
std::cout << std::endl << " ========= WOLF TREE test ===========" << std::endl << std::endl; std::cout << std::endl << " ========= WOLF TREE test ===========" << std::endl << std::endl;
...@@ -57,4 +57,3 @@ int main(int argc, char** argv) ...@@ -57,4 +57,3 @@ int main(int argc, char** argv)
return 0; return 0;
} }
} // namespace wolf
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