41 CasterCalibrationController::CasterCalibrationController()
43 joint_(NULL), wheel_l_joint_(NULL), wheel_r_joint_(NULL), last_publish_time_(0)
49 for (
size_t i = 0; i <
fake_as.size(); ++i)
51 for (
size_t i = 0; i <
fake_js.size(); ++i)
62 std::string joint_name;
70 ROS_ERROR(
"Could not find joint %s (namespace: %s)",
76 ROS_ERROR(
"No calibration reference position specified for joint %s (namespace: %s)",
88 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());
92 ROS_ERROR(
"Both rising and falling edge are specified for non-continuous joint %s. This is not supported.", joint_name.c_str());
97 ROS_WARN(
"Negative search velocity is not supported for joint %s. Making the search velocity positve.", joint_name.c_str());
103 ROS_DEBUG(
"Using positive search velocity for joint %s", joint_name.c_str());
108 ROS_DEBUG(
"Using negative search velocity for joint %s", joint_name.c_str());
112 ROS_DEBUG(
"Using positive search velocity for joint %s", joint_name.c_str());
122 ROS_ERROR(
"Could not find joint %s (namespace: %s)",
134 ROS_ERROR(
"Could not find joint %s (namespace: %s)",
141 std::string actuator_name;
149 ROS_ERROR(
"Could not find actuator %s (namespace: %s)",
154 bool force_calibration =
false;
162 if (force_calibration)
164 ROS_INFO(
"Joint %s will be recalibrated, but was already calibrated at offset %f",
177 ROS_INFO(
"Joint %s is not yet calibrated", joint_name.c_str());
182 std::string transmission_name;
190 ROS_ERROR(
"Could not find transmission %s (namespace: %s)",
227 pr2_controllers_msgs::QueryCalibrationState::Response& resp)
265 ROS_ERROR(
"Caster hit the falling edge instead of the rising edge. Calibrating again...");
271 if (switch_state_ ==
true)
pr2_mechanism_model::JointState * wheel_r_joint_
PLUGINLIB_EXPORT_CLASS(my_controller_ns::MyControllerClass, pr2_controller_interface::Controller)
ros::Time last_publish_time_
double last_calibration_rising_edge_
boost::shared_ptr< pr2_mechanism_model::Transmission > getTransmission(const std::string &name) const
~CasterCalibrationController()
pr2_mechanism_model::JointState * joint_
pr2_mechanism_model::JointState * wheel_l_joint_
std::vector< pr2_mechanism_model::JointState * > fake_js
pr2_mechanism_model::RobotState * robot_
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
boost::shared_ptr< const urdf::Joint > joint_
boost::scoped_ptr< realtime_tools::RealtimePublisher< std_msgs::Empty > > pub_calibrated_
std::vector< pr2_hardware_interface::Actuator * > fake_as
virtual bool init(pr2_mechanism_model::RobotState *robot, ros::NodeHandle &n)
boost::shared_ptr< pr2_mechanism_model::Transmission > transmission_
bool isCalibrated(pr2_controllers_msgs::QueryCalibrationState::Request &req, pr2_controllers_msgs::QueryCalibrationState::Response &resp)
const std::string & getNamespace() const
bool original_switch_state_
JointState * getJointState(const std::string &name)
double last_calibration_falling_edge_
ros::ServiceServer is_calibrated_srv_
double reference_position_
controller::CasterController cc_
bool getParam(const std::string &key, std::string &s) const
bool init(pr2_mechanism_model::RobotState *robot_state, const std::string &caster_joint, const std::string &wheel_l_joint, const std::string &wheel_r_joint, const control_toolbox::Pid &caster_pid, const control_toolbox::Pid &wheel_pid)
double original_position_
pr2_hardware_interface::Actuator * getActuator(const std::string &name) const
bool calibration_reading_
pr2_hardware_interface::Actuator * actuator_