66
66
67
67
namespace moveit_visual_tools
68
68
{
69
+ const std::string LOGNAME = " visual_tools" ;
70
+
69
71
MoveItVisualTools::MoveItVisualTools (const std::string& base_frame, const std::string& marker_topic,
70
72
planning_scene_monitor::PlanningSceneMonitorPtr psm)
71
73
: RvizVisualTools::RvizVisualTools(base_frame, marker_topic)
@@ -86,11 +88,11 @@ bool MoveItVisualTools::loadPlanningSceneMonitor()
86
88
// Check if we already have one
87
89
if (psm_)
88
90
{
89
- ROS_WARN_STREAM_NAMED (name_ , " Will not load a new planning scene monitor when one has "
90
- " already been set for Visual Tools" );
91
+ ROS_WARN_STREAM_NAMED (LOGNAME , " Will not load a new planning scene monitor when one has "
92
+ " already been set for Visual Tools" );
91
93
return false ;
92
94
}
93
- ROS_DEBUG_STREAM_NAMED (name_ , " Loading planning scene monitor" );
95
+ ROS_DEBUG_STREAM_NAMED (LOGNAME , " Loading planning scene monitor" );
94
96
95
97
// Create tf transform buffer and listener
96
98
std::shared_ptr<tf2_ros::Buffer> tf_buffer = std::make_shared<tf2_ros::Buffer>();
@@ -112,14 +114,14 @@ bool MoveItVisualTools::loadPlanningSceneMonitor()
112
114
113
115
psm_->startPublishingPlanningScene (planning_scene_monitor::PlanningSceneMonitor::UPDATE_SCENE,
114
116
planning_scene_topic_);
115
- ROS_DEBUG_STREAM_NAMED (name_ , " Publishing planning scene on " << planning_scene_topic_);
117
+ ROS_DEBUG_STREAM_NAMED (LOGNAME , " Publishing planning scene on " << planning_scene_topic_);
116
118
117
119
planning_scene_monitor::LockedPlanningSceneRW planning_scene (psm_);
118
120
planning_scene->setName (" visual_tools_scene" );
119
121
}
120
122
else
121
123
{
122
- ROS_ERROR_STREAM_NAMED (name_ , " Planning scene not configured" );
124
+ ROS_ERROR_STREAM_NAMED (LOGNAME , " Planning scene not configured" );
123
125
return false ;
124
126
}
125
127
@@ -181,8 +183,8 @@ bool MoveItVisualTools::moveCollisionObject(const geometry_msgs::Pose& pose, con
181
183
collision_obj.primitive_poses .resize (1 );
182
184
collision_obj.primitive_poses [0 ] = pose;
183
185
184
- // ROS_INFO_STREAM_NAMED(name_ ,"CollisionObject: \n " << collision_obj);
185
- // ROS_DEBUG_STREAM_NAMED(name_ ,"Published collision object " << name);
186
+ // ROS_INFO_STREAM_NAMED(LOGNAME ,"CollisionObject: \n " << collision_obj);
187
+ // ROS_DEBUG_STREAM_NAMED(LOGNAME ,"Published collision object " << name);
186
188
return processCollisionObjectMsg (collision_obj, color);
187
189
}
188
190
@@ -242,7 +244,7 @@ bool MoveItVisualTools::loadEEMarker(const robot_model::JointModelGroup* ee_jmg,
242
244
// Get joint state group
243
245
if (ee_jmg == NULL ) // make sure EE_GROUP exists
244
246
{
245
- ROS_ERROR_STREAM_NAMED (name_ , " Unable to find joint model group with address" << ee_jmg);
247
+ ROS_ERROR_STREAM_NAMED (LOGNAME , " Unable to find joint model group with address" << ee_jmg);
246
248
return false ;
247
249
}
248
250
@@ -255,9 +257,9 @@ bool MoveItVisualTools::loadEEMarker(const robot_model::JointModelGroup* ee_jmg,
255
257
{
256
258
if (ee_joint_pos.size () != ee_jmg->getActiveJointModels ().size ())
257
259
{
258
- ROS_ERROR_STREAM_NAMED (name_ , " The number of joint positions given ("
259
- << ee_joint_pos.size () << " ) does not match the number of active joints in "
260
- << ee_jmg->getName () << " (" << ee_jmg->getActiveJointModels ().size () << " )" );
260
+ ROS_ERROR_STREAM_NAMED (LOGNAME , " The number of joint positions given ("
261
+ << ee_joint_pos.size () << " ) does not match the number of active joints in "
262
+ << ee_jmg->getName () << " (" << ee_jmg->getActiveJointModels ().size () << " )" );
261
263
return false ;
262
264
}
263
265
shared_robot_state_->setJointGroupPositions (ee_jmg, ee_joint_pos);
@@ -288,10 +290,10 @@ bool MoveItVisualTools::loadEEMarker(const robot_model::JointModelGroup* ee_jmg,
288
290
289
291
shared_robot_state_->getRobotMarkers (ee_markers_map_[ee_jmg], ee_link_names, marker_color, ee_jmg->getName (),
290
292
ros::Duration ());
291
- ROS_DEBUG_STREAM_NAMED (name_ , " Number of rviz markers in end effector: " << ee_markers_map_[ee_jmg].markers .size ());
293
+ ROS_DEBUG_STREAM_NAMED (LOGNAME , " Number of rviz markers in end effector: " << ee_markers_map_[ee_jmg].markers .size ());
292
294
293
295
const std::string& ee_parent_link_name = ee_jmg->getEndEffectorParentGroup ().second ;
294
- // ROS_DEBUG_STREAM_NAMED(name_ ,"EE Parent link: " << ee_parent_link_name);
296
+ // ROS_DEBUG_STREAM_NAMED(LOGNAME ,"EE Parent link: " << ee_parent_link_name);
295
297
const moveit::core::LinkModel* ee_parent_link = robot_model_->getLinkModel (ee_parent_link_name);
296
298
297
299
Eigen::Isometry3d ee_marker_global_transform = shared_robot_state_->getGlobalLinkTransform (ee_parent_link);
@@ -329,7 +331,7 @@ void MoveItVisualTools::loadTrajectoryPub(const std::string& display_planned_pat
329
331
330
332
// Trajectory paths
331
333
pub_display_path_ = nh_.advertise <moveit_msgs::DisplayTrajectory>(display_planned_path_topic, 10 , false );
332
- ROS_DEBUG_STREAM_NAMED (name_ , " Publishing MoveIt! trajectory on topic " << pub_display_path_.getTopic ());
334
+ ROS_DEBUG_STREAM_NAMED (LOGNAME , " Publishing MoveIt! trajectory on topic " << pub_display_path_.getTopic ());
333
335
334
336
// Wait for topic to be ready
335
337
if (blocking)
@@ -347,7 +349,7 @@ void MoveItVisualTools::loadRobotStatePub(const std::string& robot_state_topic,
347
349
348
350
// RobotState Message
349
351
pub_robot_state_ = nh_.advertise <moveit_msgs::DisplayRobotState>(robot_state_topic_, 1 );
350
- ROS_DEBUG_STREAM_NAMED (name_ , " Publishing MoveIt! robot state on topic " << pub_robot_state_.getTopic ());
352
+ ROS_DEBUG_STREAM_NAMED (LOGNAME , " Publishing MoveIt! robot state on topic " << pub_robot_state_.getTopic ());
351
353
352
354
// Wait for topic to be ready
353
355
if (blocking)
@@ -364,7 +366,7 @@ bool MoveItVisualTools::publishEEMarkers(const geometry_msgs::Pose& pose, const
364
366
{
365
367
if (!loadEEMarker (ee_jmg, ee_joint_pos))
366
368
{
367
- ROS_ERROR_STREAM_NAMED (name_ , " Unable to publish EE marker, unable to load EE markers" );
369
+ ROS_ERROR_STREAM_NAMED (LOGNAME , " Unable to publish EE marker, unable to load EE markers" );
368
370
return false ;
369
371
}
370
372
}
@@ -409,8 +411,8 @@ bool MoveItVisualTools::publishEEMarkers(const geometry_msgs::Pose& pose, const
409
411
bool MoveItVisualTools::publishGrasps (const std::vector<moveit_msgs::Grasp>& possible_grasps,
410
412
const robot_model::JointModelGroup* ee_jmg, double animate_speed)
411
413
{
412
- ROS_DEBUG_STREAM_NAMED (name_ , " Visualizing " << possible_grasps.size () << " grasps with EE joint model group "
413
- << ee_jmg->getName ());
414
+ ROS_DEBUG_STREAM_NAMED (LOGNAME , " Visualizing " << possible_grasps.size () << " grasps with EE joint model group "
415
+ << ee_jmg->getName ());
414
416
415
417
// Loop through all grasps
416
418
for (std::size_t i = 0 ; i < possible_grasps.size (); ++i)
@@ -429,8 +431,8 @@ bool MoveItVisualTools::publishGrasps(const std::vector<moveit_msgs::Grasp>& pos
429
431
bool MoveItVisualTools::publishAnimatedGrasps (const std::vector<moveit_msgs::Grasp>& possible_grasps,
430
432
const robot_model::JointModelGroup* ee_jmg, double animate_speed)
431
433
{
432
- ROS_DEBUG_STREAM_NAMED (name_ , " Visualizing " << possible_grasps.size () << " grasps with joint model group "
433
- << ee_jmg->getName () << " at speed " << animate_speed);
434
+ ROS_DEBUG_STREAM_NAMED (LOGNAME , " Visualizing " << possible_grasps.size () << " grasps with joint model group "
435
+ << ee_jmg->getName () << " at speed " << animate_speed);
434
436
435
437
// Loop through all grasps
436
438
for (std::size_t i = 0 ; i < possible_grasps.size (); ++i)
@@ -533,13 +535,13 @@ bool MoveItVisualTools::publishIKSolutions(const std::vector<trajectory_msgs::Jo
533
535
{
534
536
if (ik_solutions.empty ())
535
537
{
536
- ROS_WARN_STREAM_NAMED (name_ , " Empty ik_solutions vector passed into publishIKSolutions()" );
538
+ ROS_WARN_STREAM_NAMED (LOGNAME , " Empty ik_solutions vector passed into publishIKSolutions()" );
537
539
return false ;
538
540
}
539
541
540
542
loadSharedRobotState ();
541
543
542
- ROS_DEBUG_STREAM_NAMED (name_ , " Visualizing " << ik_solutions.size () << " inverse kinematic solutions" );
544
+ ROS_DEBUG_STREAM_NAMED (LOGNAME , " Visualizing " << ik_solutions.size () << " inverse kinematic solutions" );
543
545
544
546
// Apply the time to the trajectory
545
547
trajectory_msgs::JointTrajectoryPoint trajectory_pt_timed;
@@ -641,8 +643,8 @@ bool MoveItVisualTools::publishCollisionBlock(const geometry_msgs::Pose& block_p
641
643
collision_obj.primitive_poses .resize (1 );
642
644
collision_obj.primitive_poses [0 ] = block_pose;
643
645
644
- // ROS_INFO_STREAM_NAMED(name_ ,"CollisionObject: \n " << collision_obj);
645
- // ROS_DEBUG_STREAM_NAMED(name_ ,"Published collision object " << name);
646
+ // ROS_INFO_STREAM_NAMED(LOGNAME ,"CollisionObject: \n " << collision_obj);
647
+ // ROS_DEBUG_STREAM_NAMED(LOGNAME ,"Published collision object " << name);
646
648
return processCollisionObjectMsg (collision_obj, color);
647
649
}
648
650
@@ -684,7 +686,7 @@ bool MoveItVisualTools::publishCollisionCuboid(const geometry_msgs::Point& point
684
686
if (!collision_obj.primitives [0 ].dimensions [shape_msgs::SolidPrimitive::BOX_Z])
685
687
collision_obj.primitives [0 ].dimensions [shape_msgs::SolidPrimitive::BOX_Z] = rviz_visual_tools::SMALL_SCALE;
686
688
687
- // ROS_INFO_STREAM_NAMED(name_ ,"CollisionObject: \n " << collision_obj);
689
+ // ROS_INFO_STREAM_NAMED(LOGNAME ,"CollisionObject: \n " << collision_obj);
688
690
return processCollisionObjectMsg (collision_obj, color);
689
691
}
690
692
@@ -799,7 +801,7 @@ bool MoveItVisualTools::publishCollisionCylinder(const geometry_msgs::Pose& obje
799
801
collision_obj.primitive_poses .resize (1 );
800
802
collision_obj.primitive_poses [0 ] = object_pose;
801
803
802
- // ROS_INFO_STREAM_NAMED(name_ ,"CollisionObject: \n " << collision_obj);
804
+ // ROS_INFO_STREAM_NAMED(LOGNAME ,"CollisionObject: \n " << collision_obj);
803
805
return processCollisionObjectMsg (collision_obj, color);
804
806
}
805
807
@@ -816,14 +818,14 @@ bool MoveItVisualTools::publishCollisionMesh(const geometry_msgs::Pose& object_p
816
818
shapes::ShapeMsg shape_msg; // this is a boost::variant type from shape_messages.h
817
819
if (!mesh || !shapes::constructMsgFromShape (mesh, shape_msg))
818
820
{
819
- ROS_ERROR_STREAM_NAMED (name_ , " Unable to create mesh shape message from resource " << mesh_path);
821
+ ROS_ERROR_STREAM_NAMED (LOGNAME , " Unable to create mesh shape message from resource " << mesh_path);
820
822
return false ;
821
823
}
822
824
823
825
if (!publishCollisionMesh (object_pose, object_name, boost::get<shape_msgs::Mesh>(shape_msg), color))
824
826
return false ;
825
827
826
- ROS_DEBUG_NAMED (name_ , " Loaded mesh from '%s'" , mesh_path.c_str ());
828
+ ROS_DEBUG_NAMED (LOGNAME , " Loaded mesh from '%s'" , mesh_path.c_str ());
827
829
return true ;
828
830
}
829
831
@@ -1035,14 +1037,14 @@ bool MoveItVisualTools::loadCollisionSceneFromFile(const std::string& path, cons
1035
1037
}
1036
1038
else
1037
1039
{
1038
- ROS_WARN_STREAM_NAMED (name_ , " Unable to get locked planning scene RW" );
1040
+ ROS_WARN_STREAM_NAMED (LOGNAME , " Unable to get locked planning scene RW" );
1039
1041
return false ;
1040
1042
}
1041
1043
}
1042
- ROS_INFO_NAMED (name_ , " Loaded scene geometry from '%s'" , path.c_str ());
1044
+ ROS_INFO_NAMED (LOGNAME , " Loaded scene geometry from '%s'" , path.c_str ());
1043
1045
}
1044
1046
else
1045
- ROS_WARN_NAMED (name_ , " Unable to load scene geometry from '%s'" , path.c_str ());
1047
+ ROS_WARN_NAMED (LOGNAME , " Unable to load scene geometry from '%s'" , path.c_str ());
1046
1048
1047
1049
fin.close ();
1048
1050
@@ -1075,7 +1077,7 @@ bool MoveItVisualTools::publishContactPoints(const moveit::core::RobotState& rob
1075
1077
{
1076
1078
visualization_msgs::MarkerArray arr;
1077
1079
collision_detection::getCollisionMarkersFromContacts (arr, planning_scene->getPlanningFrame (), c_res.contacts );
1078
- ROS_INFO_STREAM_NAMED (name_ , " Completed listing of explanations for invalid states." );
1080
+ ROS_INFO_STREAM_NAMED (LOGNAME , " Completed listing of explanations for invalid states." );
1079
1081
1080
1082
// Check for markers
1081
1083
if (arr.markers .empty ())
@@ -1189,7 +1191,7 @@ bool MoveItVisualTools::publishTrajectoryPath(const moveit_msgs::RobotTrajectory
1189
1191
// Check if we have enough points
1190
1192
if (!trajectory_msg.joint_trajectory .points .size ())
1191
1193
{
1192
- ROS_WARN_STREAM_NAMED (name_ , " Unable to publish trajectory path because trajectory has zero points" );
1194
+ ROS_WARN_STREAM_NAMED (LOGNAME , " Unable to publish trajectory path because trajectory has zero points" );
1193
1195
return false ;
1194
1196
}
1195
1197
@@ -1215,7 +1217,7 @@ bool MoveItVisualTools::publishTrajectoryPath(const moveit_msgs::RobotTrajectory
1215
1217
{
1216
1218
duration = 0.05 * trajectory_msg.joint_trajectory .points .size ();
1217
1219
}
1218
- ROS_DEBUG_STREAM_NAMED (name_ , " Waiting for trajectory animation " << duration << " seconds" );
1220
+ ROS_DEBUG_STREAM_NAMED (LOGNAME , " Waiting for trajectory animation " << duration << " seconds" );
1219
1221
1220
1222
// Check if ROS is ok in intervals
1221
1223
double counter = 0 ;
@@ -1238,7 +1240,7 @@ bool MoveItVisualTools::publishTrajectoryLine(const moveit_msgs::RobotTrajectory
1238
1240
// Error check
1239
1241
if (!arm_jmg)
1240
1242
{
1241
- ROS_FATAL_STREAM_NAMED (name_ , " arm_jmg is NULL" );
1243
+ ROS_FATAL_STREAM_NAMED (LOGNAME , " arm_jmg is NULL" );
1242
1244
return false ;
1243
1245
}
1244
1246
@@ -1267,7 +1269,7 @@ bool MoveItVisualTools::publishTrajectoryLine(const robot_trajectory::RobotTraje
1267
1269
// Error check
1268
1270
if (!ee_parent_link)
1269
1271
{
1270
- ROS_FATAL_STREAM_NAMED (name_ , " ee_parent_link is NULL" );
1272
+ ROS_FATAL_STREAM_NAMED (LOGNAME , " ee_parent_link is NULL" );
1271
1273
return false ;
1272
1274
}
1273
1275
@@ -1282,7 +1284,7 @@ bool MoveItVisualTools::publishTrajectoryLine(const robot_trajectory::RobotTraje
1282
1284
// Error Check
1283
1285
if (tip_pose.translation ().x () != tip_pose.translation ().x ())
1284
1286
{
1285
- ROS_ERROR_STREAM_NAMED (name_ , " NAN DETECTED AT TRAJECTORY POINT i=" << i);
1287
+ ROS_ERROR_STREAM_NAMED (LOGNAME , " NAN DETECTED AT TRAJECTORY POINT i=" << i);
1286
1288
return false ;
1287
1289
}
1288
1290
@@ -1303,7 +1305,7 @@ bool MoveItVisualTools::publishTrajectoryLine(const moveit_msgs::RobotTrajectory
1303
1305
std::vector<const moveit::core::LinkModel*> tips;
1304
1306
if (!arm_jmg->getEndEffectorTips (tips))
1305
1307
{
1306
- ROS_ERROR_STREAM_NAMED (name_ , " Unable to get end effector tips from jmg" );
1308
+ ROS_ERROR_STREAM_NAMED (LOGNAME , " Unable to get end effector tips from jmg" );
1307
1309
return false ;
1308
1310
}
1309
1311
@@ -1331,7 +1333,7 @@ bool MoveItVisualTools::publishTrajectoryLine(const robot_trajectory::RobotTraje
1331
1333
std::vector<const moveit::core::LinkModel*> tips;
1332
1334
if (!arm_jmg->getEndEffectorTips (tips))
1333
1335
{
1334
- ROS_ERROR_STREAM_NAMED (name_ , " Unable to get end effector tips from jmg" );
1336
+ ROS_ERROR_STREAM_NAMED (LOGNAME , " Unable to get end effector tips from jmg" );
1335
1337
return false ;
1336
1338
}
1337
1339
@@ -1482,7 +1484,7 @@ void MoveItVisualTools::showJointLimits(robot_state::RobotStatePtr robot_state)
1482
1484
// Assume all joints have only one variable
1483
1485
if (joints[i]->getVariableCount () > 1 )
1484
1486
{
1485
- // ROS_WARN_STREAM_NAMED(name_ , "Unable to handle joints with more than one var, skipping '"
1487
+ // ROS_WARN_STREAM_NAMED(LOGNAME , "Unable to handle joints with more than one var, skipping '"
1486
1488
// << joints[i]->getName() << "'");
1487
1489
continue ;
1488
1490
}
@@ -1533,7 +1535,7 @@ planning_scene_monitor::PlanningSceneMonitorPtr MoveItVisualTools::getPlanningSc
1533
1535
{
1534
1536
if (!psm_)
1535
1537
{
1536
- ROS_INFO_STREAM_NAMED (name_ , " No planning scene passed into moveit_visual_tools, creating one." );
1538
+ ROS_INFO_STREAM_NAMED (LOGNAME , " No planning scene passed into moveit_visual_tools, creating one." );
1537
1539
loadPlanningSceneMonitor ();
1538
1540
ros::spinOnce ();
1539
1541
ros::Duration (1 ).sleep (); // TODO: is this necessary?
@@ -1573,7 +1575,8 @@ bool MoveItVisualTools::checkForVirtualJoint(const moveit::core::RobotState& rob
1573
1575
return true ;
1574
1576
}
1575
1577
1576
- bool MoveItVisualTools::applyVirtualJointTransform (moveit::core::RobotState& robot_state, const Eigen::Isometry3d& offset)
1578
+ bool MoveItVisualTools::applyVirtualJointTransform (moveit::core::RobotState& robot_state,
1579
+ const Eigen::Isometry3d& offset)
1577
1580
{
1578
1581
static const std::string VJOINT_NAME = " virtual_joint" ;
1579
1582
0 commit comments