Skip to content

Commit

Permalink
fixing problems with urdfdom_headers 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wjwwood committed Mar 5, 2014
1 parent 55affbe commit 09bc0e0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ find_package(Eigen REQUIRED)

catkin_python_setup()

if(NOT OGRE_OV_LIBRARIES_ABS)
set(OGRE_OV_LIBRARIES_ABS ${OGRE_OV_LIBRARIES})
endif()

catkin_package(
INCLUDE_DIRS
src
Expand Down
42 changes: 41 additions & 1 deletion src/rviz/robot/robot_link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@

namespace fs=boost::filesystem;

#ifndef ROS_PACKAGE_NAME
# define ROS_PACKAGE_NAME "rviz"
#endif

namespace rviz
{

Expand Down Expand Up @@ -178,7 +182,7 @@ RobotLink::RobotLink( Robot* robot,
alpha_property_ = new FloatProperty( "Alpha", 1,
"Amount of transparency to apply to this link.",
link_property_, SLOT( updateAlpha() ), this );

trail_property_ = new Property( "Show Trail", false,
"Enable/disable a 2 meter \"ribbon\" which follows this link.",
link_property_, SLOT( updateTrail() ), this );
Expand Down Expand Up @@ -646,6 +650,7 @@ void RobotLink::createEntityForGeometryElement(const urdf::LinkConstPtr& link, c
void RobotLink::createCollision(const urdf::LinkConstPtr& link)
{
bool valid_collision_found = false;
#if URDF_MAJOR_VERSION == 0 && URDF_MINOR_VERSION == 2
std::map<std::string, boost::shared_ptr<std::vector<boost::shared_ptr<urdf::Collision> > > >::const_iterator mi;
for( mi = link->collision_groups.begin(); mi != link->collision_groups.end(); mi++ )
{
Expand All @@ -668,6 +673,23 @@ void RobotLink::createCollision(const urdf::LinkConstPtr& link)
}
}
}
#else
std::vector<boost::shared_ptr<urdf::Collision> >::const_iterator vi;
for( vi = link->collision_array.begin(); vi != link->collision_array.end(); vi++ )
{
boost::shared_ptr<urdf::Collision> collision = *vi;
if( collision && collision->geometry )
{
Ogre::Entity* collision_mesh = NULL;
createEntityForGeometryElement( link, *collision->geometry, collision->origin, collision_node_, collision_mesh );
if( collision_mesh )
{
collision_meshes_.push_back( collision_mesh );
valid_collision_found = true;
}
}
}
#endif

if( !valid_collision_found && link->collision && link->collision->geometry )
{
Expand All @@ -685,6 +707,7 @@ void RobotLink::createCollision(const urdf::LinkConstPtr& link)
void RobotLink::createVisual(const urdf::LinkConstPtr& link )
{
bool valid_visual_found = false;
#if URDF_MAJOR_VERSION == 0 && URDF_MINOR_VERSION == 2
std::map<std::string, boost::shared_ptr<std::vector<boost::shared_ptr<urdf::Visual> > > >::const_iterator mi;
for( mi = link->visual_groups.begin(); mi != link->visual_groups.end(); mi++ )
{
Expand All @@ -707,6 +730,23 @@ void RobotLink::createVisual(const urdf::LinkConstPtr& link )
}
}
}
#else
std::vector<boost::shared_ptr<urdf::Visual> >::const_iterator vi;
for( vi = link->visual_array.begin(); vi != link->visual_array.end(); vi++ )
{
boost::shared_ptr<urdf::Visual> visual = *vi;
if( visual && visual->geometry )
{
Ogre::Entity* visual_mesh = NULL;
createEntityForGeometryElement( link, *visual->geometry, visual->origin, visual_node_, visual_mesh );
if( visual_mesh )
{
visual_meshes_.push_back( visual_mesh );
valid_visual_found = true;
}
}
}
#endif

if( !valid_visual_found && link->visual && link->visual->geometry )
{
Expand Down

0 comments on commit 09bc0e0

Please sign in to comment.