4 #include "worldbuilder.h"
6 #include <bits/stdc++.h>
10 #include <sys/types.h>
35 Logger(
const char * new_folder,
const char * _dir=
"/tmp",
const char * customName=
"/stats"){
36 init(new_folder, _dir, customName);
53 bool log(
const char * format, ...);
55 const char * get_fileName(){
72 std::string
file_dateTime(
const char* custom,
char name[80],
const char * addOn=NULL);
74 void init(
const char * new_folder,
const char * _dir=NULL,
const char * customName=
"/stats");
84 void print_graph(
const T& g,
const Disturbance & goal, std::vector <vertexDescriptor>plan,
const vertexDescriptor& c){
86 auto vs=boost::vertices(g);
87 for (
auto vi=vs.first; vi!=vs.second; vi++){
88 auto es=boost::out_edges(*vi, g);
92 for (vertexDescriptor vp:plan){
98 for (
auto ei=es.first; ei!=es.second; ei++){
99 if (*ei!=edgeDescriptor()){
100 os<<(*ei).m_target <<
"("<<g[(*ei)].probability<<
")";
103 os<<
"\t(x="<<g[*vi].endPose.p.x<<
", y= "<<g[*vi].endPose.p.y<<
", theta= "<<g[*vi].endPose.q.GetAngle()<<
")\n";
110 void graph_file(
const int &it,
const T &g,
const Disturbance &goal, std::vector<vertexDescriptor>&plan,
const vertexDescriptor &c)
113 sprintf(fileName,
"/tmp/graph%04i.txt", it);
114 FILE * f=fopen(fileName,
"w");
115 auto vs=boost::vertices(g);
116 for (
auto vi=vs.first; vi!=vs.second; vi++){
117 auto es=boost::out_edges(*vi, g);
121 for (vertexDescriptor vp:plan){
126 fprintf(f,
"%i -> ", (*vi));
127 for (
auto ei=es.first; ei!=es.second; ei++){
129 fprintf(f,
"%i (%f) ", (*ei).m_target, g[(*ei)].probability);
131 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());
135 b2Vec2 GetWorldPoints(b2Body*, b2Vec2 );
137 char * print_pose(
const b2Transform& p,
char * msg=NULL);
139 void print_matrix(
const cv::Mat &);
141 std::vector<b2Vec2> GetBodies( b2World*);
143 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], const char *addOn=NULL)
Creates filename name in format customdmy_hm.txt.
Definition: debug.cpp:3
bool log(const char *format,...)
Definition: debug.cpp:22
static const char * getSystemArchitecture()
Returns a string with system architecture.
Definition: debug.cpp:52
Logger(const char *new_folder, const char *_dir="/tmp", const char *customName="/stats")
Construct a new Logger object.
Definition: debug.h:35
Definition: disturbance.h:112
Contains the differences between the contiuous components of two hybrid states.
Definition: graphTools.h:142