Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dynamic_graph_bridge
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
Guilhem Saurel
dynamic_graph_bridge
Commits
ee435647
Commit
ee435647
authored
6 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Geometric simu uses ROS parameter /sot/dt
parent
e57af6b9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/dynamic_graph_bridge/sot_loader.hh
+5
-1
5 additions, 1 deletion
include/dynamic_graph_bridge/sot_loader.hh
src/geometric_simu.cpp
+2
-4
2 additions, 4 deletions
src/geometric_simu.cpp
src/sot_loader.cpp
+26
-5
26 additions, 5 deletions
src/sot_loader.cpp
with
33 additions
and
10 deletions
include/dynamic_graph_bridge/sot_loader.hh
+
5
−
1
View file @
ee435647
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include
<boost/program_options.hpp>
#include
<boost/program_options.hpp>
#include
<boost/foreach.hpp>
#include
<boost/foreach.hpp>
#include
<boost/format.hpp>
#include
<boost/format.hpp>
#include
<boost/thread/thread.hpp>
// ROS includes
// ROS includes
#include
"ros/ros.h"
#include
"ros/ros.h"
...
@@ -82,6 +83,9 @@ protected:
...
@@ -82,6 +83,9 @@ protected:
std
::
string
robot_desc_string_
;
std
::
string
robot_desc_string_
;
/// The thread running dynamic graph
boost
::
thread
thread_
;
// \brief Start control loop
// \brief Start control loop
virtual
void
startControlLoop
();
virtual
void
startControlLoop
();
...
@@ -92,7 +96,7 @@ protected:
...
@@ -92,7 +96,7 @@ protected:
public:
public:
SotLoader
();
SotLoader
();
~
SotLoader
()
{}
;
~
SotLoader
();
// \brief Create a thread for ROS and start the control loop.
// \brief Create a thread for ROS and start the control loop.
void
initializeRosNode
(
int
argc
,
char
*
argv
[]);
void
initializeRosNode
(
int
argc
,
char
*
argv
[]);
...
...
This diff is collapsed.
Click to expand it.
src/geometric_simu.cpp
+
2
−
4
View file @
ee435647
...
@@ -32,8 +32,6 @@ int main(int argc, char *argv[])
...
@@ -32,8 +32,6 @@ int main(int argc, char *argv[])
aSotLoader
.
initializeRosNode
(
argc
,
argv
);
aSotLoader
.
initializeRosNode
(
argc
,
argv
);
while
(
true
){
ros
::
spin
();
usleep
(
5000
);
return
0
;
}
}
}
This diff is collapsed.
Click to expand it.
src/sot_loader.cpp
+
26
−
5
View file @
ee435647
...
@@ -26,7 +26,6 @@
...
@@ -26,7 +26,6 @@
// POSIX.1-2001
// POSIX.1-2001
#include
<dlfcn.h>
#include
<dlfcn.h>
#include
<boost/thread/thread.hpp>
#include
<boost/thread/condition.hpp>
#include
<boost/thread/condition.hpp>
boost
::
condition_variable
cond
;
boost
::
condition_variable
cond
;
...
@@ -39,15 +38,30 @@ namespace po = boost::program_options;
...
@@ -39,15 +38,30 @@ namespace po = boost::program_options;
void
workThreadLoader
(
SotLoader
*
aSotLoader
)
void
workThreadLoader
(
SotLoader
*
aSotLoader
)
{
{
unsigned
period
=
1000
;
// micro seconds
if
(
ros
::
param
::
has
(
"/sot/dt"
))
{
double
periodd
;
ros
::
param
::
get
(
"/sot/dt"
,
periodd
);
period
=
unsigned
(
1e6
*
periodd
);
}
DataToLog
dataToLog
(
5000
);
while
(
aSotLoader
->
isDynamicGraphStopped
())
while
(
aSotLoader
->
isDynamicGraphStopped
())
{
{
usleep
(
5000
);
usleep
(
period
);
}
}
struct
timeval
start
,
stop
;
while
(
!
aSotLoader
->
isDynamicGraphStopped
())
while
(
!
aSotLoader
->
isDynamicGraphStopped
())
{
{
gettimeofday
(
&
start
,
0
);
aSotLoader
->
oneIteration
();
aSotLoader
->
oneIteration
();
usleep
(
5000
);
gettimeofday
(
&
stop
,
0
);
unsigned
long
long
dt
=
1000000
*
(
stop
.
tv_sec
-
start
.
tv_sec
)
+
(
stop
.
tv_usec
-
start
.
tv_usec
);
if
(
period
>
dt
)
{
usleep
(
period
-
(
unsigned
)
dt
);
}
}
}
cond
.
notify_all
();
cond
.
notify_all
();
ros
::
waitForShutdown
();
ros
::
waitForShutdown
();
...
@@ -62,15 +76,22 @@ SotLoader::SotLoader():
...
@@ -62,15 +76,22 @@ SotLoader::SotLoader():
torques_
(),
torques_
(),
baseAtt_
(),
baseAtt_
(),
accelerometer_
(
3
),
accelerometer_
(
3
),
gyrometer_
(
3
)
gyrometer_
(
3
),
thread_
()
{
{
readSotVectorStateParam
();
readSotVectorStateParam
();
initPublication
();
initPublication
();
}
}
SotLoader
::~
SotLoader
()
{
dynamic_graph_stopped_
=
true
;
thread_
.
join
();
}
void
SotLoader
::
startControlLoop
()
void
SotLoader
::
startControlLoop
()
{
{
boost
::
thread
thr
(
workThreadLoader
,
this
);
thread_
=
boost
::
thread
(
workThreadLoader
,
this
);
}
}
void
SotLoader
::
initializeRosNode
(
int
argc
,
char
*
argv
[])
void
SotLoader
::
initializeRosNode
(
int
argc
,
char
*
argv
[])
...
...
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