4 #include "worldbuilder.h"
6 #include <bits/stdc++.h>
10 #include <sys/types.h>
36 Logger(
const char * new_folder,
const char * _dir=
"/tmp",
const char * customName=
"/stats",
bool dateOn=
true){
37 init(new_folder, _dir, customName, dateOn);
54 bool log(
const char * format, ...);
56 const char * get_fileName(){
78 void init(
const char * new_folder,
const char * _dir=NULL,
const char * customName=
"/stats",
bool dateOn=
false);
88 void print_graph(
const T& g,
const Disturbance & goal, std::vector <vertexDescriptor>plan,
const vertexDescriptor& c){
90 auto vs=boost::vertices(g);
91 for (
auto vi=vs.first; vi!=vs.second; vi++){
92 auto es=boost::out_edges(*vi, g);
96 for (vertexDescriptor vp:plan){
102 for (
auto ei=es.first; ei!=es.second; ei++){
103 if (*ei!=edgeDescriptor()){
104 os<<(*ei).m_target <<
"("<<g[(*ei)].probability<<
")";
107 os<<
"\t(x="<<g[*vi].endPose.p.x<<
", y= "<<g[*vi].endPose.p.y<<
", theta= "<<g[*vi].endPose.q.GetAngle()<<
")\n";
114 void graph_file(
const int &it,
const T &g,
const Disturbance &goal, std::vector<vertexDescriptor>&plan,
const vertexDescriptor &c)
117 sprintf(fileName,
"/tmp/graph%04i.txt", it);
118 FILE * f=fopen(fileName,
"w");
119 auto vs=boost::vertices(g);
120 for (
auto vi=vs.first; vi!=vs.second; vi++){
121 auto es=boost::out_edges(*vi, g);
125 for (vertexDescriptor vp:plan){
130 fprintf(f,
"%i -> ", (*vi));
131 for (
auto ei=es.first; ei!=es.second; ei++){
133 fprintf(f,
"%i (%f) ", (*ei).m_target, g[(*ei)].probability);
135 fprintf(f,
"\t(x=%.3f, y= %.3f, theta= %.3f)\n", g[*vi].endPose.p.x, g[*vi].endPose.p.y, g[*vi].endPose.q.GetAngle());
139 b2Vec2 GetWorldPoints(b2Body*, b2Vec2 );
141 char * print_pose(
const b2Transform& p,
char * msg=NULL);
143 void print_matrix(
const cv::Mat &);
145 std::vector<b2Vec2> GetBodies( b2World*);
147 void print_state_difference(
const StateDifference & sd, vertexDescriptor v, vertexDescriptor v1);
Class used to load data from the configurator.
Definition: debug.h:18
std::string file_dateTime(const char *custom, char name[80])
Creates filename with today's date and time, name in format customdmy_hm.txt.
Definition: debug.cpp:3
void init(const char *new_folder, const char *_dir=NULL, const char *customName="/stats", bool dateOn=false)
Definition: debug.cpp:37
bool log(const char *format,...)
Definition: debug.cpp:22
Logger(const char *new_folder, const char *_dir="/tmp", const char *customName="/stats", bool dateOn=true)
Construct a new Logger object.
Definition: debug.h:36
static const char * getSystemArchitecture()
Returns a string with system architecture.
Definition: debug.cpp:64
Definition: disturbance.h:114
Contains the differences between the contiuous components of two hybrid states.
Definition: graphTools.h:143