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
664cff91
Commit
664cff91
authored
6 years ago
by
Olivier Stasse
Browse files
Options
Downloads
Patches
Plain Diff
Improve the computation of the initial time.
parent
f75ef1ab
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
talos_roscontrol_sot/src/log.cpp
+6
-4
6 additions, 4 deletions
talos_roscontrol_sot/src/log.cpp
talos_roscontrol_sot/src/log.hh
+2
-1
2 additions, 1 deletion
talos_roscontrol_sot/src/log.hh
with
8 additions
and
5 deletions
talos_roscontrol_sot/src/log.cpp
+
6
−
4
View file @
664cff91
...
@@ -52,10 +52,11 @@ void Log::init(unsigned int nbDofs, unsigned int length)
...
@@ -52,10 +52,11 @@ void Log::init(unsigned int nbDofs, unsigned int length)
nbDofs_
=
nbDofs
;
nbDofs_
=
nbDofs
;
length_
=
length
;
length_
=
length
;
StoredData_
.
init
(
nbDofs
,
length
);
StoredData_
.
init
(
nbDofs
,
length
);
struct
timeval
current
;
gettimeofday
(
&
current
,
0
);
timeorigin_
=
(
double
)
current
.
tv_sec
+
0.000001
*
((
double
)
current
.
tv_usec
);
gettimeofday
(
timeorigin_tv_
,
0
);
timeorigin_
=
(
double
)
timeorigin_tv_
.
tv_sec
+
0.000001
*
((
double
)
timeorigin_tv_
.
tv_usec
);
}
}
...
@@ -97,7 +98,8 @@ void Log::record(DataToLog &aDataToLog)
...
@@ -97,7 +98,8 @@ void Log::record(DataToLog &aDataToLog)
gettimeofday
(
&
current
,
0
);
gettimeofday
(
&
current
,
0
);
StoredData_
.
timestamp
[
lrefts_
]
=
StoredData_
.
timestamp
[
lrefts_
]
=
((
double
)
current
.
tv_sec
+
0.000001
*
(
double
)
current
.
tv_usec
)
-
timeorigin_
;
((
double
)(
current
.
tv_sec
-
time_origin_tv_
.
tv_sec
)
+
0.000001
*
(
double
)(
current
.
tv_usec
-
time_origin_tv_
.
tv_usec
));
StoredData_
.
duration
[
lrefts_
]
=
time_stop_it_
-
time_start_it_
;
StoredData_
.
duration
[
lrefts_
]
=
time_stop_it_
-
time_start_it_
;
...
...
This diff is collapsed.
Click to expand it.
talos_roscontrol_sot/src/log.hh
+
2
−
1
View file @
664cff91
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include
<vector>
#include
<vector>
#include
<string>
#include
<string>
#include
<sys/time.h>
namespace
rc_sot_system
{
namespace
rc_sot_system
{
...
@@ -62,8 +63,8 @@ namespace rc_sot_system {
...
@@ -62,8 +63,8 @@ namespace rc_sot_system {
// Circular buffer for all the data.
// Circular buffer for all the data.
DataToLog
StoredData_
;
DataToLog
StoredData_
;
double
timeorigin_
;
double
timeorigin_
;
struct
timeval
timeorigin_tv_
;
double
time_start_it_
;
double
time_start_it_
;
double
time_stop_it_
;
double
time_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