Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
panda_simulation
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
CeTI
ROS
ROS Packages
panda_simulation
Commits
a640a57d
Commit
a640a57d
authored
5 years ago
by
Johannes Mey
Browse files
Options
Downloads
Patches
Plain Diff
use correct orientation in gazebo display of safety zones
parent
b35c39e2
Branches
Branches containing commit
Tags
0.3.4
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/SafetyZones/GazeboZoneSpawner.cpp
+7
-3
7 additions, 3 deletions
src/SafetyZones/GazeboZoneSpawner.cpp
with
7 additions
and
3 deletions
src/SafetyZones/GazeboZoneSpawner.cpp
+
7
−
3
View file @
a640a57d
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#include
<gazebo_msgs/SpawnModel.h>
// for spawning stuff in gazebo
#include
<gazebo_msgs/SpawnModel.h>
// for spawning stuff in gazebo
#include
<ros/ros.h>
#include
<ros/ros.h>
#include
<ros/package.h>
#include
<ros/package.h>
#include
<tf/tf.h>
void
GazeboZoneSpawner
::
spawnCollisionBox
(
shape_msgs
::
SolidPrimitive
shape
,
geometry_msgs
::
Pose
pose
)
{
void
GazeboZoneSpawner
::
spawnCollisionBox
(
shape_msgs
::
SolidPrimitive
shape
,
geometry_msgs
::
Pose
pose
)
{
if
(
shape
.
type
!=
shape
.
BOX
)
{
if
(
shape
.
type
!=
shape
.
BOX
)
{
...
@@ -27,8 +28,13 @@ void GazeboZoneSpawner::spawnCollisionBox(shape_msgs::SolidPrimitive shape, geom
...
@@ -27,8 +28,13 @@ void GazeboZoneSpawner::spawnCollisionBox(shape_msgs::SolidPrimitive shape, geom
auto
poseElement
=
visualElement
->
GetElement
(
"pose"
);
auto
poseElement
=
visualElement
->
GetElement
(
"pose"
);
auto
sizeElement
=
visualElement
->
GetElement
(
"geometry"
)
->
GetElement
(
"box"
)
->
GetElement
(
"size"
);
auto
sizeElement
=
visualElement
->
GetElement
(
"geometry"
)
->
GetElement
(
"box"
)
->
GetElement
(
"size"
);
tf
::
Quaternion
rot
;
rot
.
setValue
(
pose
.
orientation
.
x
,
pose
.
orientation
.
y
,
pose
.
orientation
.
z
,
pose
.
orientation
.
w
);
double
roll
,
pitch
,
yaw
;
tf
::
Matrix3x3
(
rot
).
getRPY
(
roll
,
pitch
,
yaw
);
std
::
ostringstream
poseStream
;
std
::
ostringstream
poseStream
;
poseStream
<<
pose
.
position
.
x
<<
" "
<<
pose
.
position
.
y
<<
" "
<<
pose
.
position
.
z
<<
"
0 0 0"
;
poseStream
<<
pose
.
position
.
x
<<
" "
<<
pose
.
position
.
y
<<
" "
<<
pose
.
position
.
z
<<
"
"
<<
roll
<<
" "
<<
pitch
<<
" "
<<
yaw
;
poseElement
->
Set
(
poseStream
.
str
());
poseElement
->
Set
(
poseStream
.
str
());
ROS_INFO_NAMED
(
"GazeboZoneSpawner"
,
"Set pose in SDF file to '%s'."
,
poseElement
->
GetValue
()
->
GetAsString
().
c_str
());
ROS_INFO_NAMED
(
"GazeboZoneSpawner"
,
"Set pose in SDF file to '%s'."
,
poseElement
->
GetValue
()
->
GetAsString
().
c_str
());
...
@@ -39,8 +45,6 @@ void GazeboZoneSpawner::spawnCollisionBox(shape_msgs::SolidPrimitive shape, geom
...
@@ -39,8 +45,6 @@ void GazeboZoneSpawner::spawnCollisionBox(shape_msgs::SolidPrimitive shape, geom
ROS_INFO_NAMED
(
"GazeboZoneSpawner"
,
"Set size in SDF file to '%s'."
,
sizeElement
->
GetValue
()
->
GetAsString
().
c_str
());
ROS_INFO_NAMED
(
"GazeboZoneSpawner"
,
"Set size in SDF file to '%s'."
,
sizeElement
->
GetValue
()
->
GetAsString
().
c_str
());
// FIXME orientation is currently ignored
ros
::
NodeHandle
n
;
ros
::
NodeHandle
n
;
ros
::
ServiceClient
client
=
n
.
serviceClient
<
gazebo_msgs
::
SpawnModel
>
(
"/gazebo/spawn_sdf_model"
);
ros
::
ServiceClient
client
=
n
.
serviceClient
<
gazebo_msgs
::
SpawnModel
>
(
"/gazebo/spawn_sdf_model"
);
gazebo_msgs
::
SpawnModel
spawnService
;
gazebo_msgs
::
SpawnModel
spawnService
;
...
...
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