Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RobotAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lennard Hofmann
RobotAPI
Commits
bf8826f4
Commit
bf8826f4
authored
8 years ago
by
Mirko Wächter
Browse files
Options
Downloads
Patches
Plain Diff
ft sim can now provide multiple sensors
parent
33d96c4f
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
source/RobotAPI/components/units/ForceTorqueUnitSimulation.cpp
+15
-9
15 additions, 9 deletions
...e/RobotAPI/components/units/ForceTorqueUnitSimulation.cpp
source/RobotAPI/components/units/ForceTorqueUnitSimulation.h
+6
-5
6 additions, 5 deletions
source/RobotAPI/components/units/ForceTorqueUnitSimulation.h
with
21 additions
and
14 deletions
source/RobotAPI/components/units/ForceTorqueUnitSimulation.cpp
+
15
−
9
View file @
bf8826f4
...
...
@@ -32,18 +32,20 @@ using namespace armarx;
void
ForceTorqueUnitSimulation
::
onInitForceTorqueUnit
()
{
int
intervalMs
=
getProperty
<
int
>
(
"IntervalMs"
).
getValue
();
std
::
string
sensorName
=
getProperty
<
std
::
string
>
(
"SensorName"
).
getValue
();
sensorNamesList
=
Split
(
getProperty
<
std
::
string
>
(
"SensorNames"
).
getValue
(),
","
);
for
(
auto
&
sensor
:
sensorNamesList
)
{
boost
::
trim
(
sensor
);
}
//std::vector<std::string> sensorNamesList;
//boost::split(sensorNamesList, sensorNames, boost::is_any_of(","));
//for(std::vector<std::string>::iterator s = sensorNamesList.begin(); s != sensorNamesList.end(); s++)
//{
// forces[*s] = new armarx::FramedDirection(Eigen::Vector3f(0, 0, 0), *s);
// torques[*s] = new armarx::FramedDirection(Eigen::Vector3f(0, 0, 0), *s);
// }
forces
=
new
armarx
::
FramedDirection
(
Eigen
::
Vector3f
(
0
,
0
,
0
),
sensorName
,
getProperty
<
std
::
string
>
(
"AgentName"
).
getValue
());
torques
=
new
armarx
::
FramedDirection
(
Eigen
::
Vector3f
(
0
,
0
,
0
),
sensorName
,
getProperty
<
std
::
string
>
(
"AgentName"
).
getValue
());
for
(
std
::
vector
<
std
::
string
>::
iterator
s
=
sensorNamesList
.
begin
();
s
!=
sensorNamesList
.
end
();
s
++
)
{
forces
[
*
s
]
=
new
armarx
::
FramedDirection
(
Eigen
::
Vector3f
(
0
,
0
,
0
),
*
s
,
getProperty
<
std
::
string
>
(
"AgentName"
).
getValue
());
torques
[
*
s
]
=
new
armarx
::
FramedDirection
(
Eigen
::
Vector3f
(
0
,
0
,
0
),
*
s
,
getProperty
<
std
::
string
>
(
"AgentName"
).
getValue
());
}
ARMARX_VERBOSE
<<
"Starting ForceTorqueUnitSimulation with "
<<
intervalMs
<<
" ms interval"
;
simulationTask
=
new
PeriodicTask
<
ForceTorqueUnitSimulation
>
(
this
,
&
ForceTorqueUnitSimulation
::
simulationFunction
,
intervalMs
,
false
,
"ForceTorqueUnitSimulation"
);
...
...
@@ -63,7 +65,11 @@ void ForceTorqueUnitSimulation::onExitForceTorqueUnit()
void
ForceTorqueUnitSimulation
::
simulationFunction
()
{
listenerPrx
->
reportSensorValues
(
getProperty
<
std
::
string
>
(
"SensorName"
).
getValue
(),
forces
,
torques
);
for
(
auto
&
sensor
:
sensorNamesList
)
{
listenerPrx
->
reportSensorValues
(
sensor
,
forces
[
sensor
],
torques
[
sensor
]);
}
//listenerPrx->reportSensorValues(forces);
//listenerPrx->reportSensorValues(torques);
...
...
This diff is collapsed.
Click to expand it.
source/RobotAPI/components/units/ForceTorqueUnitSimulation.h
+
6
−
5
View file @
bf8826f4
...
...
@@ -48,8 +48,9 @@ namespace armarx
ForceTorqueUnitSimulationPropertyDefinitions
(
std
::
string
prefix
)
:
ForceTorqueUnitPropertyDefinitions
(
prefix
)
{
defineRequiredProperty
<
std
::
string
>
(
"SensorName"
,
"simulated sensor name"
);
defineOptionalProperty
<
int
>
(
"IntervalMs"
,
10
,
"The time in milliseconds between two calls to the simulation method."
);
defineRequiredProperty
<
std
::
string
>
(
"SensorNames"
,
"simulated sensor name. seperated by comma"
);
defineRequiredProperty
<
std
::
string
>
(
"AgentName"
,
"name of the robot agent"
);
defineOptionalProperty
<
int
>
(
"IntervalMs"
,
50
,
"The time in milliseconds between two calls to the simulation method."
);
}
};
...
...
@@ -92,9 +93,9 @@ namespace armarx
virtual
PropertyDefinitionsPtr
createPropertyDefinitions
();
protected
:
armarx
::
FramedDirectionPtr
forces
;
armarx
::
FramedDirectionPtr
torques
;
std
::
map
<
std
::
string
,
armarx
::
FramedDirectionPtr
>
forces
;
std
::
map
<
std
::
string
,
armarx
::
FramedDirectionPtr
>
torques
;
Ice
::
StringSeq
sensorNamesList
;
PeriodicTask
<
ForceTorqueUnitSimulation
>::
pointer_type
simulationTask
;
};
}
...
...
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