@@ -45,22 +45,22 @@ namespace cost_functions
4545 // Create cost function
4646 return [](const moveit::core::RobotState& robot_state, const planning_interface::MotionPlanRequest& request,
4747 const planning_scene::PlanningSceneConstPtr& planning_scene) {
48-
49- std::vector< double > joint_pos;
50- robot_state. copyJointGroupPositions (request. group_name , joint_pos);
51- for ( auto const val : joint_pos) {
52- std::cout << " Joint pos: " << val << std::endl;
53- }
48+ std::vector< double > joint_pos;
49+ robot_state. copyJointGroupPositions (request. group_name , joint_pos) ;
50+ for ( auto const val : joint_pos)
51+ {
52+ std::cout << " Joint pos: " << val << std::endl;
53+ }
5454 auto const shortest_distance_to_collision = planning_scene->distanceToCollisionUnpadded (robot_state);
5555
5656 // Return cost based on shortest_distance if the robot is not in contact or penetrated a collision object
5757 if (shortest_distance_to_collision > 0.0 )
5858 {
59- std::cout << " Cost: " << 1.0 / shortest_distance_to_collision << std::endl;
59+ std::cout << " Cost: " << 1.0 / shortest_distance_to_collision << std::endl;
6060 // The closer the collision object the higher the cost
6161 return 1.0 / shortest_distance_to_collision;
6262 }
63- std::cout << " Cost: " << std::numeric_limits<double >::infinity () << std::endl;
63+ std::cout << " Cost: " << std::numeric_limits<double >::infinity () << std::endl;
6464 return std::numeric_limits<double >::infinity (); // Return a max cost cost by default
6565 };
6666}
0 commit comments