pr2_gripper_sensor_controller.cpp
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2008, Willow Garage, Inc.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/or other materials provided
17  * with the distribution.
18  * * Neither the name of the Willow Garage nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *
35  * \author Joe Romano
36  *********************************************************************/
37 //@author Joe Romano
38 //@email joeromano@gmail.com
39 //@brief Controller to read data from the sensors on the pr2 gripper
40 // (accelerometer in palm, pressure arrays on the fingers, and
41 // encoder in the hand) and publish higher-level useful processed
42 // information about them, as well as perform low-level control
43 // tasks to control the gripper based on these signals in real-time.
44 //
45 // This controller is inteded to be interacted with through its
46 // action interface, pr2_gripper_sensor_action.
47 
51 #include <std_srvs/Empty.h>
52 
53 
54 using namespace pr2_gripper_sensor_controller;
55 
56 
70 {
71 
72  // get a handle to the hardware interface
73  pr2_hardware_interface::HardwareInterface* hardwareInterface = robot->model_->hw_;
74  if(!hardwareInterface)
75  {
76  ROS_ERROR("Perhaps Something wrong with the hardware interface pointer!!!!");
77  }
78 
79  // get a handle to our accelerometer
80  std::string accelerometer_name;
81  if(!n.getParam("accelerometer_name", accelerometer_name))
82  {
83  ROS_ERROR("No accelerometer given in namespace: '%s')", n.getNamespace().c_str());
84  return false;
85  }
86  pr2_hardware_interface::Accelerometer* accelerometerHandle = hardwareInterface->getAccelerometer(accelerometer_name);
87 
88  if(!accelerometerHandle)
89  {
90  ROS_ERROR("PR2GripperSensorController could not find sensor named '%s'", accelerometer_name.c_str());
91  return false;
92  }
93  myAccelerationObserver = new accelerationObserver(accelerometerHandle);
94 
95  // get a handle to our left finger pressure sensors
96  std::string leftFinger_pressureSensor_name;
97  if(!n.getParam("left_pressure_sensor_name", leftFinger_pressureSensor_name))
98  {
99  ROS_ERROR("No accelerometer given in namespace: '%s')", n.getNamespace().c_str());
100  return false;
101  }
102  pr2_hardware_interface::PressureSensor* leftFinger_pressureSensorHandle = hardwareInterface->getPressureSensor(leftFinger_pressureSensor_name);
103  if(!leftFinger_pressureSensorHandle)
104  {
105  ROS_ERROR("PR2GripperSensorController could not find sensor named '%s'", leftFinger_pressureSensor_name.c_str());
106  return false;
107  }
108 
109  // get a handle to our right finger pressure sensors
110  std::string rightFinger_pressureSensor_name;
111  if(!n.getParam("right_pressure_sensor_name", rightFinger_pressureSensor_name))
112  {
113  ROS_ERROR("No accelerometer given in namespace: '%s')", n.getNamespace().c_str());
114  return false;
115  }
116  pr2_hardware_interface::PressureSensor* rightFinger_pressureSensorHandle = hardwareInterface->getPressureSensor(rightFinger_pressureSensor_name);
117  if(!rightFinger_pressureSensorHandle)
118  {
119  ROS_ERROR("PR2GripperSensorController could not find sensor named '%s'", rightFinger_pressureSensor_name.c_str());
120  return false;
121  }
122  myPressureObserver = new pressureObserver(leftFinger_pressureSensorHandle, rightFinger_pressureSensorHandle);
123 
124  // get a handle to our desired joint
125  std::string joint_name;
126  if (!n.getParam("joint_name", joint_name))
127  {
128  ROS_ERROR("No joint given in namespace: '%s')", n.getNamespace().c_str());
129  return false;
130  }
131  pr2_mechanism_model::JointState* joint_state_ = robot->getJointState(joint_name);
132  if (!joint_state_)
133  {
134  ROS_ERROR("PR2GripperSensorController could not find joint named '%s'", joint_name.c_str());
135  return false;
136  }
137 
138  n.param("publish_skip", publish_skip, 1);
139 
140  // instantiate our gripper action object and pass it handles to our joint_state_controller and observer objects
142 
143  return true;
144 }
145 
146 
158 bool PR2GripperSensorController::reloadParams(std_srvs::Empty::Request& req,std_srvs::Empty::Response& resp)
159 {
160  if(!nodeHandle.getParam("close_speed", servo_velocity))
161  ROS_ERROR("No close_speed given in namespace: '%s')", nodeHandle.getNamespace().c_str());
163  if(servo_velocity > 0)
164  {
165  ROS_ERROR("Incorrect sign on close_speed (negative speed is impossible), setting to 0!");
166  servo_velocity = 0;
167  }
168 
169  if(!nodeHandle.getParam("max_joint_effort", max_effort))
170  ROS_ERROR("No max_joint_effort given in namespace: '%s')", nodeHandle.getNamespace().c_str());
172 
173  if(!nodeHandle.getParam("fingertip_force_limit", fingertip_force_limit))
174  ROS_ERROR("No fingertip_force_limit given in namespace: '%s')", nodeHandle.getNamespace().c_str());
177 
178  if(!nodeHandle.getParam("deformation_limit", deformation_limit))
179  ROS_ERROR("No deformation_limit given in namespace: '%s')", nodeHandle.getNamespace().c_str());
181 
182  if(!nodeHandle.getParam("slip_servo_start_force", fingertip_start_force))
183  ROS_ERROR("No slip_servo_start_force given in namespace: '%s')", nodeHandle.getNamespace().c_str());
185 
186  if(!nodeHandle.getParam("force_lightest", myPressureObserver->forceLightest))
187  ROS_ERROR("No force_lightest given in namespace: '%s')", nodeHandle.getNamespace().c_str());
188 
189  if(!nodeHandle.getParam("hp_force_trigger", myPressureObserver->hpForceTrigger))
190  ROS_ERROR("No hpForceTrigger given in namespace: '%s')", nodeHandle.getNamespace().c_str());
191 
192  if(!nodeHandle.getParam("force_servo_force_tolerance", myGripperController->force_servo_force_tolerance))
193  ROS_ERROR("No force_servo_force_tolerance given in namespace: '%s')", nodeHandle.getNamespace().c_str());
194 
195  if(!nodeHandle.getParam("force_servo_velocity_tolerance", force_servo_velocity_tolerance))
196  ROS_ERROR("No force_servo_velocity_tolerance given in namespace: '%s')", nodeHandle.getNamespace().c_str());
197 
198  if(!nodeHandle.getParam("position_servo_position_tolerance", force_servo_velocity_tolerance))
199  ROS_ERROR("No position_servo_position_tolerance given in namespace: '%s')", nodeHandle.getNamespace().c_str());
200 
201 
202  return true;
203 
204 }
205 
206 
207 
222 {
223  // make the below true if you want to publish raw data messages (debug mode)
224  publish_raw_data = false;
225 
226  // store the node and robot handle
227  assert(robot);
228  nodeHandle = n;
229  robotHandle = robot;
230 
231  // initialize handles to our sensors and joints
232  bool success = this->initializeHandles(robot, n);
233  loop_count_ = 0;
234 
235  // initially place our controller into disabled mode
236  control_mode = rt_state_def.DISABLED;
237 
238  // seed the timer
239  last_time_ = robot->getTime();
240 
241  //publish our services
242  updateZeros_srv_ = n.advertiseService("zero_fingertip_sensors", &PR2GripperSensorController::updateZeros, this);
245 
246  //setup our publisher for raw data information (only if flag is set)
247  if(publish_raw_data)
248  {
250  }
251 
252  //setup our publisher for joint and motor effort state information
254 
255  //setup our publisher for contact state information
257 
258  //setup our publisher for place state information
260 
261  //setup our publisher for slip state information
263 
264  //setup our publisher for force state information
266 
267  // setup our callback to handle position command requests
268  sub_command_ = n.subscribe<pr2_controllers_msgs::Pr2GripperCommand>("command", 1, &PR2GripperSensorController::positionCB, this);
269 
270  // setup our callback to handle find_contact command requests
271  sub_findcontact_command_ = n.subscribe<pr2_gripper_sensor_msgs::PR2GripperFindContactCommand>("find_contact", 1, &PR2GripperSensorController::findContactCB, this);
272 
273  // setup our callback to handle event_detector command requests
274  sub_event_detector_command_ = n.subscribe<pr2_gripper_sensor_msgs::PR2GripperEventDetectorCommand>("event_detector", 1, &PR2GripperSensorController::eventDetectorCB, this);
275 
276  // setup our callback to handle slip_servo command requests
277  sub_slipservo_command_ = n.subscribe<pr2_gripper_sensor_msgs::PR2GripperSlipServoCommand>("slip_servo", 1, &PR2GripperSensorController::slipServoCB, this);
278 
279  // setup our callback to handle force_servo command requests
280  sub_forceservo_command_ = n.subscribe<pr2_gripper_sensor_msgs::PR2GripperForceServoCommand>("force_servo", 1, &PR2GripperSensorController::forceServoCB, this);
281 
282  // upate the zero offset of our pressure sensors
283  std_srvs::Empty::Request req;
284  std_srvs::Empty::Response rsp;
285  updateZeros(req,rsp);
286 
287  // load our params from the param server
288  reloadParams(req,rsp);
289 
290  return success;
291 
292 }
293 
294 
295 
305 {
306 
307  // update our timing information
308  ros::Time time = robotHandle->getTime();
309  ros::Duration dt = time - last_time_;
310 
311  // do some sanity checks to see that we have a valid robot handle
312  assert(robotHandle != NULL);
313 
314  //----------------------------------------
315  // Begin State Machine
316 
317  //disabled (do nothing) mode
318  if(control_mode == rt_state_def.DISABLED){}
319 
320  // position control mode
321  else if(control_mode == rt_state_def.POSITION_SERVO)
322  {
323  // use a zero velocity goal in our position controller to have the robot
324  // gently decelerate when the position error gets small (could be current vel. instead)
326  // keep moving our posiiton marker to avoid deformation_limit errors
328  }
329 
330  // force control mode
331  else if(control_mode == rt_state_def.FORCE_SERVO)
332  {
333  //if we have reached some epsilon of our target force
334  // and the gripper is still then set consider the force contact stable
337 
338  {
339  // require the same force for 250ms
340  if(findContact_delay > 250)
341  stable_force = true;
343  }
344  }
345 
346  // find contact mode
347  else if(control_mode == rt_state_def.FIND_CONTACT)
348  {
349  // if we have not yet met the contact requirements
351  {
352  contact_success = false;
353  // make sure our velocity integral term is starting at our current position in case of contact
355  // keep moving our posiiton marker to avoid deformation_limit errors
357  }
358  // else if we have met the contact requirements
359  else
360  {
361 
362  // for 50 ms after contact
363  if(contactCounter < 50)
364  {
366 
367  // keep track of the highest contact force we've applied
369 
370  // hold our position
372  }
373 
374  else
375  {
377  stable_contact = true;
378  control_mode = rt_state_def.POSITION_SERVO;
379  }
380 
381  contactCounter++;
382  contact_success = true;
383  }
384  }
385 
386  // if in slip servo control mode
387  else if(control_mode == rt_state_def.SLIP_SERVO)
389 
390 
391  // else somehow we ended up with some other value for mode (should not be possible)
392  else
393  {
394  ROS_ERROR("PR2_GRIPPER_SENSOR_CONTROLLER ENTERED A BAD STATE MACHINE STATE");
396  // try to recover by setting the control mode to "disabled"
397  control_mode = rt_state_def.DISABLED;
398  }
399 
400  // End State Machine
401  //----------------------------------------
402 
403  //----------------------------------------
404  // Non-state machine controller updating
405 
406  // update our placement variables
408  placedState = true;
409 
410  // update zeros mode
411  if(update_zeros == true)
413 
414  //----------------------------------------
415  // Begin Feedback publication
416 
417  // publish information every nth cycle
418  if(loop_count_ % publish_skip == 0)
419  {
421  {
422  controller_state_publisher_->msg_.header.stamp = time;
427  controller_state_publisher_->msg_.time_step = dt.toSec();
429 
430  controller_state_publisher_->unlockAndPublish();
431  }
432 
434  {
435  contact_state_publisher_->msg_.stamp = time;
436  contact_state_publisher_->msg_.left_fingertip_pad_contact = myPressureObserver->left_contact;
437  contact_state_publisher_->msg_.right_fingertip_pad_contact = myPressureObserver->right_contact;
442  contact_state_publisher_->msg_.rtstate.realtime_controller_state = control_mode;
443  contact_state_publisher_->msg_.contact_conditions_met = stable_contact;
444 
445 
446  contact_state_publisher_->unlockAndPublish();
447  }
448 
450  {
451  slip_state_publisher_->msg_.stamp = time;
453  slip_state_publisher_->msg_.left_fingertip_pad_force = myPressureObserver->padForce_left_cur_nonbiased;
454  slip_state_publisher_->msg_.right_fingertip_pad_force = myPressureObserver->padForce_right_cur_nonbiased;
456  slip_state_publisher_->msg_.slip_detected = myGripperController->slip_flag;
457  slip_state_publisher_->msg_.fingertip_force_limit_reached = myGripperController->force_limit_flag;
458  slip_state_publisher_->msg_.deformation_limit_reached = myGripperController->deformation_limit_flag;
460  slip_state_publisher_->msg_.rtstate.realtime_controller_state = control_mode;
461 
462  slip_state_publisher_->unlockAndPublish();
463  }
464 
466  {
467  force_state_publisher_->msg_.stamp = time;
471  force_state_publisher_->msg_.force_achieved = stable_force;
472  force_state_publisher_->msg_.rtstate.realtime_controller_state = control_mode;
473 
474  force_state_publisher_->unlockAndPublish();
475  }
476 
478  {
479  event_detector_state_publisher_->msg_.stamp = time;
480  event_detector_state_publisher_->msg_.trigger_conditions_met = placedState;
483  event_detector_state_publisher_->msg_.acceleration_vector[0] = myAccelerationObserver->aX_bp;
484  event_detector_state_publisher_->msg_.acceleration_vector[1] = myAccelerationObserver->aY_bp;
485  event_detector_state_publisher_->msg_.acceleration_vector[2] = myAccelerationObserver->aZ_bp;
486 
487  event_detector_state_publisher_->unlockAndPublish();
488  }
489  }
490 
491  // publish information every nth cycle
492  if(loop_count_ % publish_skip == 0)
493  {
494  if(publish_raw_data)
495  {
496  raw_data_publisher_->msg_.stamp = time;
499  raw_data_publisher_->msg_.left_finger_pad_force_filtered = myPressureObserver->padForce_left_cur;
500  raw_data_publisher_->msg_.right_finger_pad_force_filtered = myPressureObserver->padForce_right_cur;
501  raw_data_publisher_->msg_.left_finger_pad_forces = myPressureObserver->pressure_current_zerod.pressure_left;
502  raw_data_publisher_->msg_.right_finger_pad_forces = myPressureObserver->pressure_current_zerod.pressure_right;
503  raw_data_publisher_->msg_.left_finger_pad_forces_filtered = myPressureObserver->pressure_cur_bias.pressure_left;
504  raw_data_publisher_->msg_.right_finger_pad_forces_filtered = myPressureObserver->pressure_cur_bias.pressure_right;
508  raw_data_publisher_->msg_.acc_x_filtered = myAccelerationObserver->aX_bp;
509  raw_data_publisher_->msg_.acc_y_filtered = myAccelerationObserver->aY_bp;
510  raw_data_publisher_->msg_.acc_z_filtered = myAccelerationObserver->aZ_bp;
513 
514  raw_data_publisher_->unlockAndPublish();
515  }
516  }
517 
518  // End Feedback publication
519  //----------------------------------------
520 
521  // update our gripper action, as well as our accelerometer and pressure states with it
523 
524  // increment our counter and store the time
525  loop_count_++;
526  last_time_ = time;
527 }
528 
536 {
537  // turn the motors off before stopping
539 }
540 
541 
542 
556 bool PR2GripperSensorController::updateZeros(std_srvs::Empty::Request& req,std_srvs::Empty::Response& resp)
557 {
558  ROS_INFO("Updating zeros....");
559  update_zeros = true;
560  ros::Duration(0.25).sleep();
561  update_zeros = false;
562  ROS_INFO(".... zeros finished updating");
563 
564  return true;
565 }
566 
567 
580 bool PR2GripperSensorController::stopMotorOutput(std_srvs::Empty::Request& req,std_srvs::Empty::Response& resp)
581 {
582  ROS_INFO("Stopping gripper command output.");
583  control_mode = rt_state_def.DISABLED;
584 
585  return true;
586 }
587 
588 
594 {
595  findContact_delay = 0;
596  stable_force = false;
597 
598  // reinitialize force ramp state
600 
602 
603  // reinialize the grasp contact states
604  stable_contact = false;
605 
606  // reinitialize the contact forces
610 
611  // reset several important variables
616 
618 
619 }
620 
621 
630 void PR2GripperSensorController::positionCB(const pr2_controllers_msgs::Pr2GripperCommandConstPtr& msg)
631 {
633 
634  // store the message data
635  servo_position = msg->position;
636  max_effort = msg->max_effort;
638 
639 
640  // put the max effort value commanded by the user back on the param server
641  nodeHandle.setParam("max_joint_effort", max_effort);
642 
643 
644  // change the controller state
645  control_mode = rt_state_def.POSITION_SERVO;
646 
647  ROS_INFO("Gripper Position Servo to: %f", servo_position);
648 }
649 
650 
659 void PR2GripperSensorController::findContactCB(const pr2_gripper_sensor_msgs::PR2GripperFindContactCommandConstPtr& msg)
660 {
662  {
663  ROS_ERROR("REFUSING TO FIND CONTACT - PRESSURE SENSOR HAS ZERO READING AND MAY BE MALFUNCTIONING!");
664  return;
665  }
666 
668  contactCounter = 0;
669 
670  // copy over the data from our message
671  contacts_desired = msg->contact_conditions;
672 
673  // reinialize the grasp contact states
676 
677  // change the controller state
678  control_mode = rt_state_def.FIND_CONTACT;
679 
680 }
681 
682 
691 void PR2GripperSensorController::eventDetectorCB(const pr2_gripper_sensor_msgs::PR2GripperEventDetectorCommandConstPtr& msg)
692 {
693  placeConditions = msg->trigger_conditions;
694  acc_trigger = msg->acceleration_trigger_magnitude;
695  slip_trigger = msg->slip_trigger_magnitude;
696 
697  placedState = false;
700 }
701 
709 void PR2GripperSensorController::slipServoCB(const pr2_gripper_sensor_msgs::PR2GripperSlipServoCommandConstPtr& msg)
710 {
712  {
713  ROS_ERROR("REFUSING TO SLIP SERVO - PRESSURE SENSOR HAS ZERO READING AND MAY BE MALFUNCTIONING!");
714  return;
715  }
716 
718 
719  // check if the user wanted to use the default force or input a force level
720  if(fingertip_start_force <= 0.0)
722  else
724 
725  // change the controller state
726  control_mode = rt_state_def.SLIP_SERVO;
727 
728  ROS_INFO("Starting Slip Servo with: %f N", myGripperController->servoForce);
729 }
730 
731 
741 void PR2GripperSensorController::forceServoCB(const pr2_gripper_sensor_msgs::PR2GripperForceServoCommandConstPtr& msg)
742 {
744  {
745  ROS_ERROR("REFUSING TO FORCE SERVO - PRESSURE SENSOR HAS ZERO READING AND MAY BE MALFUNCTIONING!");
746  return;
747  }
748 
750 
751  if(msg->fingertip_force >= 0)
752  servo_force = -(msg->fingertip_force);
753  else
754  servo_force = 0.0;
755 
756  // change the controller state
757  control_mode = rt_state_def.FORCE_SERVO;
758 
759  ROS_INFO("Starting Force Servo with: %f N", servo_force);
760 }
761 
762 
763 // Register controller to pluginlib
double servo_force
the force we want to servo our controller to
PLUGINLIB_EXPORT_CLASS(my_controller_ns::MyControllerClass, pr2_controller_interface::Controller)
int control_mode
the current/desired control mode we want the controller state machine to be in
Accelerometer * getAccelerometer(const std::string &name) const
bool publish_raw_data
flag to indicate whether we want to publish raw data or not
double force_servo_force_tolerance
boost::scoped_ptr< realtime_tools::RealtimePublisher< pr2_gripper_sensor_msgs::PR2GripperFindContactData > > contact_state_publisher_
find_contact real-time publisher
int placeConditions
storage container for the conditions we want to use in event_detector
bool reloadParams(std_srvs::Empty::Request &req, std_srvs::Empty::Response &resp)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
double fingertip_start_force
the force we want to start seroing to on the fingertips
double servo_position
the position we want to servo our controller to
int contacts_desired
the contact state we want when we search for contact on the fingers
double padForce_left_cur_nonbiased
bool sleep() const
bool positionServo(double desiredPos, double desiredVel)
void positionCB(const pr2_controllers_msgs::Pr2GripperCommandConstPtr &msg)
bool stopMotorOutput(std_srvs::Empty::Request &req, std_srvs::Empty::Response &resp)
pr2_hardware_interface::HardwareInterface * hw_
boost::scoped_ptr< realtime_tools::RealtimePublisher< pr2_gripper_sensor_msgs::PR2GripperSensorRawData > > raw_data_publisher_
raw data real-time publisher
pr2_gripper_sensor_msgs::PR2GripperPressureData pressure_cur_bias
int contactCounter
counter to delay a certain amount of tmie after contact
double slip_trigger
value to use as trigger for slip detection (event_detector)
bool grabObject(double close_speed, int contactsDesired)
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
int findContact_delay
counter to track how long a force is stable for
boost::scoped_ptr< realtime_tools::RealtimePublisher< pr2_gripper_sensor_msgs::PR2GripperSlipServoData > > slip_state_publisher_
slip_servo real-time publisher
pr2_mechanism_model::JointState * jointState
double max_effort
the max effort to allow our controller to use
accelerationObserver * myAccelerationObserver
accelerometer observer object
double fingertip_force_limit
the limit we do not want to exceed when force servoing
void slipServoCB(const pr2_gripper_sensor_msgs::PR2GripperSlipServoCommandConstPtr &msg)
double gripper_state_now_measured_effort
boost::scoped_ptr< realtime_tools::RealtimePublisher< pr2_gripper_sensor_msgs::PR2GripperEventDetectorData > > event_detector_state_publisher_
place publisher and listener
bool update_zeros
bool to signal whether we are currently updating our zeros or not
virtual bool init(pr2_mechanism_model::RobotState *robot, ros::NodeHandle &n)
bool place(int placeConditions, double acc_trigger, double slip_trigger)
bool forceServo2(double desired_Force)
double acc_trigger
value to use as trigger for acceleration detection (event_detector)
#define ROS_INFO(...)
bool updateZeros(std_srvs::Empty::Request &req, std_srvs::Empty::Response &resp)
bool param(const std::string &param_name, T &param_val, const T &default_val) const
boost::scoped_ptr< realtime_tools::RealtimePublisher< pr2_gripper_sensor_msgs::PR2GripperForceServoData > > force_state_publisher_
force_servo real-time publisher
const std::string & getNamespace() const
PressureSensor * getPressureSensor(const std::string &name) const
void forceServoCB(const pr2_gripper_sensor_msgs::PR2GripperForceServoCommandConstPtr &msg)
bool stable_contact
state variable to indicate whether our contact has been held enough
gripperController * myGripperController
gripper action object to control our gripper
pr2_gripper_sensor_msgs::PR2GripperPressureData pressure_current_zerod
JointState * getJointState(const std::string &name)
pressureObserver * myPressureObserver
pressure observer object to do analysis on the incoming pressure sensor data
int publish_skip
skip count when publishing controller information
bool getParam(const std::string &key, std::string &s) const
void findContactCB(const pr2_gripper_sensor_msgs::PR2GripperFindContactCommandConstPtr &msg)
boost::scoped_ptr< realtime_tools::RealtimePublisher< pr2_controllers_msgs::JointControllerState > > controller_state_publisher_
position data real-time publisher
double force_servo_velocity_tolerance
the tolerance on velocity to consider a force stable
bool stable_force
flag to indicate a stable force is achieved
pr2_mechanism_model::RobotState * robotHandle
our robot state handle
bool initializeHandles(pr2_mechanism_model::RobotState *robot, ros::NodeHandle &n)
const pr2_gripper_sensor_msgs::PR2GripperSensorRTState rt_state_def
object that defines states of our controller
double padForce_right_cur_nonbiased
#define ROS_ERROR(...)
void setParam(const std::string &key, const XmlRpc::XmlRpcValue &v) const
double servo_velocity
the velocity we would like our controller to servo to
void eventDetectorCB(const pr2_gripper_sensor_msgs::PR2GripperEventDetectorCommandConstPtr &msg)
double deformation_limit
the max allowable deformation for our controller
bool placedState
state flag to indicate when event_detector succceded
bool contact_success
flag to indicate whether the fingers found contact or not


pr2_gripper_sensor_controller
Author(s): Joe Romano
autogenerated on Wed Apr 1 2020 03:58:23