Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iri_htc_vive_tracker
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
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
labrobotica
ros
sensors
iri_htc_vive_tracker
Commits
6695ac26
Commit
6695ac26
authored
6 years ago
by
Laia Freixas Mateu
Browse files
Options
Downloads
Patches
Plain Diff
added more functions so that code is more readable
parent
d5c1fac2
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
include/htc_vive_tracker_alg_node.h
+6
-0
6 additions, 0 deletions
include/htc_vive_tracker_alg_node.h
src/htc_vive_tracker_alg_node.cpp
+20
-12
20 additions, 12 deletions
src/htc_vive_tracker_alg_node.cpp
with
26 additions
and
12 deletions
include/htc_vive_tracker_alg_node.h
+
6
−
0
View file @
6695ac26
...
...
@@ -141,7 +141,13 @@ class HtcViveTrackerAlgNode : public algorithm_base::IriBaseAlgorithm<HtcViveTra
// [test functions]
void
BroadcastPoseRotated
(
const
std
::
string
&
device_name
);
void
BroadcastAllPoses
(
void
);
void
PublishPoseOfDeviceToFollow
(
void
);
void
PrintAllDeviceNames
();
tf
::
Quaternion
ApplyRotationForIRIStandardCoordinates
(
const
tf
::
Quaternion
&
orig
);
};
...
...
This diff is collapsed.
Click to expand it.
src/htc_vive_tracker_alg_node.cpp
+
20
−
12
View file @
6695ac26
...
...
@@ -59,13 +59,8 @@ HtcViveTrackerAlgNode::~HtcViveTrackerAlgNode(void)
}
void
HtcViveTrackerAlgNode
::
mainNodeThread
(
void
)
{
// This function detects if a new device has been connected / disconnected
this
->
alg_
.
PollEvents
();
// For each device name
void
HtcViveTrackerAlgNode
::
BroadcastAllPoses
(
void
)
{
// For each device name
std
::
vector
<
std
::
string
>
names
;
if
(
this
->
alg_
.
GetDeviceNames
(
names
))
{
for
(
int
i
=
0
;
i
<
names
.
size
();
++
i
)
{
...
...
@@ -83,7 +78,11 @@ void HtcViveTrackerAlgNode::mainNodeThread(void)
}
}
if
(
this
->
frame_names_set
){
}
void
HtcViveTrackerAlgNode
::
PublishPoseOfDeviceToFollow
(
void
){
if
(
this
->
frame_names_set
){
tf
::
StampedTransform
stamped_transform
;
try
{
bool
is_transform_possible
=
this
->
tf_listener_
.
canTransform
(
this
->
source_frame_name_
,
this
->
target_frame_name_
,
ros
::
Time
(
0
));
...
...
@@ -102,13 +101,22 @@ void HtcViveTrackerAlgNode::mainNodeThread(void)
}
}
// [fill msg structures]
}
void
HtcViveTrackerAlgNode
::
mainNodeThread
(
void
)
{
// This function detects if a new device has been connected / disconnected
this
->
alg_
.
PollEvents
();
// This function broadcasts the poses of all devices detected
this
->
BroadcastAllPoses
();
// This function publishes the pose of the device in source_frame_name_
this
->
PublishPoseOfDeviceToFollow
();
// [fill srv structure and make request to the server]
// [fill action structure and make request to the action server]
// [publish messages]
}
/* [subscriber callbacks] */
...
...
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