45 JointCalibrationController::JointCalibrationController()
46 : robot_(NULL), last_publish_time_(0),
47 actuator_(NULL), joint_(NULL)
61 std::string joint_name;
69 ROS_ERROR(
"Could not find joint %s (namespace: %s)",
75 ROS_ERROR(
"Joint %s has no calibration reference position specified (namespace: %s)",
81 std::string actuator_name;
89 ROS_ERROR(
"Could not find actuator %s (namespace: %s)",
94 bool force_calibration =
false;
101 if (force_calibration)
103 ROS_INFO(
"Joint %s will be recalibrated, but was already calibrated at offset %f",
108 ROS_INFO(
"Joint %s is already calibrated at offset %f",
115 ROS_INFO(
"Joint %s is not yet calibrated", joint_name.c_str());
119 std::string transmission_name;
127 ROS_ERROR(
"Could not find transmission %s (namespace: %s)",
140 ROS_ERROR(
"No rising or falling edge is specified for calibration of joint %s. Note that the reference_position is not used any more", joint_name.c_str());
144 ROS_ERROR(
"Both rising and falling edge are specified for non-continuous joint %s. This is not supported.", joint_name.c_str());
149 ROS_ERROR(
"Negative search velocity is not supported for joint %s. Making the search velocity positive.", joint_name.c_str());
155 ROS_DEBUG(
"Using positive search velocity for joint %s", joint_name.c_str());
160 ROS_DEBUG(
"Using negative search velocity for joint %s", joint_name.c_str());
164 ROS_DEBUG(
"Using positive search velocity for joint %s", joint_name.c_str());
192 pr2_controllers_msgs::QueryCalibrationState::Response& resp)
241 ROS_ERROR(
"Joint hit the falling edge instead of the rising edge. Calibrating again...");
PLUGINLIB_EXPORT_CLASS(my_controller_ns::MyControllerClass, pr2_controller_interface::Controller)
ros::ServiceServer is_calibrated_srv_
double last_calibration_rising_edge_
boost::shared_ptr< pr2_mechanism_model::Transmission > getTransmission(const std::string &name) const
pr2_hardware_interface::Actuator * actuator_
ros::Time last_publish_time_
pr2_mechanism_model::RobotState * robot_
virtual bool init(pr2_mechanism_model::RobotState *robot, ros::NodeHandle &n)
boost::scoped_ptr< realtime_tools::RealtimePublisher< std_msgs::Empty > > pub_calibrated_
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
boost::shared_ptr< const urdf::Joint > joint_
boost::shared_ptr< pr2_mechanism_model::Transmission > transmission_
pr2_mechanism_model::JointState * joint_
void setCommand(double cmd)
bool isCalibrated(pr2_controllers_msgs::QueryCalibrationState::Request &req, pr2_controllers_msgs::QueryCalibrationState::Response &resp)
const std::string & getNamespace() const
JointState * getJointState(const std::string &name)
virtual ~JointCalibrationController()
double reference_position_
bool getParam(const std::string &key, std::string &s) const
pr2_hardware_interface::Actuator * getActuator(const std::string &name) const
double original_position_
bool calibration_reading_
controller::JointVelocityController vc_
bool init(pr2_mechanism_model::RobotState *robot, const std::string &joint_name, const control_toolbox::Pid &pid)