Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
talos-metapkg-ros-control-sot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
talos-metapkg-ros-control-sot
Commits
3ee11b3a
Commit
3ee11b3a
authored
6 years ago
by
Olivier Stasse
Browse files
Options
Downloads
Patches
Plain Diff
Add duration log file to know the computation variation.
parent
3e095f1a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
talos_roscontrol_sot/src/log.cpp
+28
-1
28 additions, 1 deletion
talos_roscontrol_sot/src/log.cpp
talos_roscontrol_sot/src/log.hh
+6
-2
6 additions, 2 deletions
talos_roscontrol_sot/src/log.hh
with
34 additions
and
3 deletions
talos_roscontrol_sot/src/log.cpp
+
28
−
1
View file @
3ee11b3a
...
...
@@ -8,6 +8,7 @@
#include
<sstream>
#include
<fstream>
#include
<iostream>
#include
<iomanip>
using
namespace
std
;
using
namespace
rc_sot_system
;
...
...
@@ -29,6 +30,7 @@ void DataToLog::init(unsigned int nbDofs,long int length)
force_sensors
.
resize
(
4
*
6
*
length
);
temperatures
.
resize
(
nbDofs
*
length
);
timestamp
.
resize
(
length
);
duration
.
resize
(
length
);
for
(
unsigned
int
i
=
0
;
i
<
nbDofs
*
length
;
i
++
)
{
motor_angle
[
i
]
=
joint_angle
[
i
]
=
...
...
@@ -97,6 +99,8 @@ void Log::record(DataToLog &aDataToLog)
StoredData_
.
timestamp
[
lrefts_
]
=
((
double
)
current
.
tv_sec
+
0.000001
*
(
double
)
current
.
tv_usec
)
-
timeorigin_
;
StoredData_
.
duration
[
lrefts_
]
=
time_stop_it_
-
time_start_it_
;
lref_
+=
nbDofs_
;
lrefts_
++
;
if
(
lref_
>=
nbDofs_
*
length_
)
...
...
@@ -106,6 +110,25 @@ void Log::record(DataToLog &aDataToLog)
}
}
void
Log
::
start_it
()
{
struct
timeval
current
;
gettimeofday
(
&
current
,
0
);
time_start_it_
=
((
double
)
current
.
tv_sec
+
0.000001
*
(
double
)
current
.
tv_usec
)
-
timeorigin_
;
}
void
Log
::
stop_it
()
{
struct
timeval
current
;
gettimeofday
(
&
current
,
0
);
time_stop_it_
=
((
double
)
current
.
tv_sec
+
0.000001
*
(
double
)
current
.
tv_usec
)
-
timeorigin_
;
}
void
Log
::
save
(
std
::
string
&
fileName
)
{
std
::
string
suffix
(
"-mastate.log"
);
...
...
@@ -130,7 +153,10 @@ void Log::save(std::string &fileName)
suffix
=
"-temperatures.log"
;
saveVector
(
fileName
,
suffix
,
StoredData_
.
temperatures
,
nbDofs_
);
suffix
=
"-duration.log"
;
saveVector
(
fileName
,
suffix
,
StoredData_
.
duration
,
1
);
}
void
Log
::
saveVector
(
std
::
string
&
fileName
,
std
::
string
&
suffix
,
...
...
@@ -142,6 +168,7 @@ void Log::saveVector(std::string &fileName,std::string &suffix,
oss
<<
suffix
.
c_str
();
std
::
string
actualFileName
=
oss
.
str
();
ofstream
aof
(
actualFileName
.
c_str
());
aof
<<
std
::
setprecision
(
12
)
<<
std
::
setw
(
12
)
<<
std
::
setfill
(
'0'
);
if
(
aof
.
is_open
())
{
for
(
unsigned
long
int
i
=
0
;
i
<
length_
;
i
++
)
...
...
This diff is collapsed.
Click to expand it.
talos_roscontrol_sot/src/log.hh
+
6
−
2
View file @
3ee11b3a
...
...
@@ -37,6 +37,8 @@ namespace rc_sot_system {
// Timestamp
std
::
vector
<
double
>
timestamp
;
// Duration
std
::
vector
<
double
>
duration
;
DataToLog
();
void
init
(
unsigned
int
nbDofs
,
long
int
length
);
...
...
@@ -62,7 +64,8 @@ namespace rc_sot_system {
DataToLog
StoredData_
;
double
timeorigin_
;
double
time_start_it_
;
double
time_stop_it_
;
// Save one vector of information.
void
saveVector
(
std
::
string
&
filename
,
...
...
@@ -78,7 +81,8 @@ namespace rc_sot_system {
void
record
(
DataToLog
&
aDataToLog
);
void
save
(
std
::
string
&
fileName
);
void
start_it
();
void
stop_it
();
};
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment