41 std::string query_service_name = root_nh.
resolveName(
"gripper_grasp_status");
43 ROS_INFO_STREAM(
"katana gripper grasp query service started on topic " << query_service_name);
45 std::string gripper_grasp_posture_controller = root_nh.
resolveName(
"gripper_grasp_posture_controller");
49 ROS_INFO_STREAM(
"katana gripper grasp hand posture action server started on topic " << gripper_grasp_posture_controller);
60 ROS_INFO(
"Moving gripper to position: %f", goal->command.position);
65 control_msgs::GripperCommandResult result;
67 result.reached_goal =
false;
68 result.stalled =
false;
70 if (moveJointSuccess && fabs(result.position - goal->command.position) <
goal_threshold_)
73 result.reached_goal =
true;
76 else if (moveJointSuccess && fabs(result.position - goal->command.position) >
goal_threshold_)
79 result.stalled =
true;
84 ROS_WARN(
"Goal position (%f) outside gripper range. Or some other stuff happened.", goal->command.position);
92 control_msgs::QueryTrajectoryState::Response &response)
94 response.position.resize(1);
static const double GRIPPER_OPENING_CLOSING_DURATION
The maximum time it takes to open or close the gripper.
void executeCB(const control_msgs::GripperCommandGoalConstPtr &goal)
double goal_threshold_
A difference in desired goal angle and actual goal angle above this value indicates that the goal was...
std::string resolveName(const std::string &name, bool remap=true) const
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
void setSucceeded(const Result &result=Result(), const std::string &text=std::string(""))
boost::shared_ptr< AbstractKatana > katana_
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
actionlib::SimpleActionServer< control_msgs::GripperCommandAction > * action_server_
Action server for the grasp posture action.
void setAborted(const Result &result=Result(), const std::string &text=std::string(""))
#define ROS_INFO_STREAM(args)
virtual ~KatanaGripperGraspController()
const size_t GRIPPER_INDEX
The motor index of the gripper (used in all vectors – e.g., motor_angles_)
KatanaGripperGraspController(boost::shared_ptr< AbstractKatana > katana)
ros::ServiceServer query_srv_
Server for the posture query service.
bool serviceCallback(control_msgs::QueryTrajectoryState::Request &request, control_msgs::QueryTrajectoryState::Response &response)