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
b453cdc7
Commit
b453cdc7
authored
8 years ago
by
Fabian Paus
Browse files
Options
Downloads
Patches
Plain Diff
Hokuyo: Added angle offset
parent
c50a6037
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/drivers/HokuyoLaserUnit/HokuyoLaserUnit.cpp
+3
-3
3 additions, 3 deletions
source/RobotAPI/drivers/HokuyoLaserUnit/HokuyoLaserUnit.cpp
source/RobotAPI/drivers/HokuyoLaserUnit/HokuyoLaserUnit.h
+2
-0
2 additions, 0 deletions
source/RobotAPI/drivers/HokuyoLaserUnit/HokuyoLaserUnit.h
with
5 additions
and
3 deletions
source/RobotAPI/drivers/HokuyoLaserUnit/HokuyoLaserUnit.cpp
+
3
−
3
View file @
b453cdc7
...
@@ -35,6 +35,7 @@ void HokuyoLaserUnit::onInitComponent()
...
@@ -35,6 +35,7 @@ void HokuyoLaserUnit::onInitComponent()
topicName
=
getProperty
<
std
::
string
>
(
"LaserScannerTopicName"
).
getValue
();
topicName
=
getProperty
<
std
::
string
>
(
"LaserScannerTopicName"
).
getValue
();
offeringTopic
(
topicName
);
offeringTopic
(
topicName
);
updatePeriod
=
getProperty
<
int
>
(
"UpdatePeriod"
).
getValue
();
updatePeriod
=
getProperty
<
int
>
(
"UpdatePeriod"
).
getValue
();
angleOffset
=
getProperty
<
float
>
(
"AngleOffset"
).
getValue
();
std
::
string
deviceStrings
=
getProperty
<
std
::
string
>
(
"Devices"
).
getValue
();
std
::
string
deviceStrings
=
getProperty
<
std
::
string
>
(
"Devices"
).
getValue
();
std
::
vector
<
std
::
string
>
splitDeviceStrings
;
std
::
vector
<
std
::
string
>
splitDeviceStrings
;
...
@@ -147,7 +148,7 @@ void HokuyoLaserUnit::updateScanData()
...
@@ -147,7 +148,7 @@ void HokuyoLaserUnit::updateScanData()
for
(
int
stepIndex
=
0
;
stepIndex
<
lengthDataSize
;
++
stepIndex
)
for
(
int
stepIndex
=
0
;
stepIndex
<
lengthDataSize
;
++
stepIndex
)
{
{
LaserScanStep
step
;
LaserScanStep
step
;
step
.
angle
=
float
(
0.25
*
M_PI
/
180.0
*
stepIndex
);
step
.
angle
=
angleOffset
+
float
(
0.25
*
M_PI
/
180.0
*
stepIndex
);
step
.
distance
=
lengthDataSize
*
stepIndex
/
100.0
f
+
200.0
f
;
step
.
distance
=
lengthDataSize
*
stepIndex
/
100.0
f
+
200.0
f
;
scan
.
push_back
(
step
);
scan
.
push_back
(
step
);
}
}
...
@@ -179,8 +180,7 @@ void HokuyoLaserUnit::updateScanData()
...
@@ -179,8 +180,7 @@ void HokuyoLaserUnit::updateScanData()
for
(
int
stepIndex
=
0
;
stepIndex
<
lengthDataSize
;
++
stepIndex
)
for
(
int
stepIndex
=
0
;
stepIndex
<
lengthDataSize
;
++
stepIndex
)
{
{
LaserScanStep
step
;
LaserScanStep
step
;
// TODO: We need an angle offset for the sensor
step
.
angle
=
angleOffset
+
(
float
)
urg_step2rad
(
&
device
.
urg
,
stepIndex
);
// Convert steps to rad
step
.
angle
=
(
float
)
urg_step2rad
(
&
device
.
urg
,
stepIndex
);
// Convert steps to rad
step
.
distance
=
(
float
)
device
.
lengthData
[
stepIndex
];
// Data is already in mm
step
.
distance
=
(
float
)
device
.
lengthData
[
stepIndex
];
// Data is already in mm
scan
.
push_back
(
step
);
scan
.
push_back
(
step
);
}
}
...
...
This diff is collapsed.
Click to expand it.
source/RobotAPI/drivers/HokuyoLaserUnit/HokuyoLaserUnit.h
+
2
−
0
View file @
b453cdc7
...
@@ -46,6 +46,7 @@ namespace armarx
...
@@ -46,6 +46,7 @@ namespace armarx
{
{
defineOptionalProperty
<
std
::
string
>
(
"LaserScannerTopicName"
,
"LaserScans"
,
"Name of the laser scan topic."
);
defineOptionalProperty
<
std
::
string
>
(
"LaserScannerTopicName"
,
"LaserScans"
,
"Name of the laser scan topic."
);
defineOptionalProperty
<
int
>
(
"UpdatePeriod"
,
25
,
"Update period for laser scans"
);
defineOptionalProperty
<
int
>
(
"UpdatePeriod"
,
25
,
"Update period for laser scans"
);
defineOptionalProperty
<
float
>
(
"AngleOffset"
,
-
2.3561944902
,
"Offset is applied the raw angles before reporting them"
);
defineOptionalProperty
<
std
::
string
>
(
"Devices"
,
""
,
"List of devices in form of 'IP1,port1;IP2,port2;...'"
);
defineOptionalProperty
<
std
::
string
>
(
"Devices"
,
""
,
"List of devices in form of 'IP1,port1;IP2,port2;...'"
);
}
}
};
};
...
@@ -117,6 +118,7 @@ namespace armarx
...
@@ -117,6 +118,7 @@ namespace armarx
std
::
string
topicName
;
std
::
string
topicName
;
LaserScannerUnitListenerPrx
topic
;
LaserScannerUnitListenerPrx
topic
;
int
updatePeriod
=
25
;
int
updatePeriod
=
25
;
float
angleOffset
=
0.0
f
;
std
::
vector
<
HokuyoLaserScanDevice
>
devices
;
std
::
vector
<
HokuyoLaserScanDevice
>
devices
;
PeriodicTask
<
HokuyoLaserUnit
>::
pointer_type
task
;
PeriodicTask
<
HokuyoLaserUnit
>::
pointer_type
task
;
...
...
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