Go to the documentation of this file.00001
00027 #ifndef _SRH_FAKE_JOINT_CALIBRATION_CONTROLLER_
00028 #define _SRH_FAKE_JOINT_CALIBRATION_CONTROLLER_
00029
00030 #include "ros/node_handle.h"
00031 #include "ros_ethercat_model/robot_state.hpp"
00032 #include "velocity_controllers/joint_velocity_controller.h"
00033 #include "realtime_tools/realtime_publisher.h"
00034 #include "std_msgs/Empty.h"
00035 #include "controller_interface/controller.h"
00036 #include <boost/smart_ptr.hpp>
00037
00038
00039 namespace controller
00040 {
00041
00042 class SrhFakeJointCalibrationController : public controller_interface::Controller<ros_ethercat_model::RobotState>
00043 {
00044 public:
00045 SrhFakeJointCalibrationController();
00046
00047 virtual bool init(ros_ethercat_model::RobotState *robot, ros::NodeHandle &n);
00048
00049 virtual void update(const ros::Time& time, const ros::Duration& period);
00050
00051 bool calibrated() { return calibration_state_ == CALIBRATED; }
00052 void beginCalibration()
00053 {
00054 if (calibration_state_ == IS_INITIALIZED)
00055 calibration_state_ = BEGINNING;
00056 }
00057
00058 protected:
00059
00060 ros_ethercat_model::RobotState* robot_;
00061 ros::NodeHandle node_;
00062 boost::scoped_ptr<realtime_tools::RealtimePublisher<std_msgs::Empty> > pub_calibrated_;
00063 ros::Time last_publish_time_;
00064
00065 enum { IS_INITIALIZED, BEGINNING, MOVING_TO_LOW, MOVING_TO_HIGH, CALIBRATED };
00066 int calibration_state_;
00067
00068 ros_ethercat_model::Actuator *actuator_;
00069 ros_ethercat_model::JointState *joint_;
00070
00071 std::string joint_name_, actuator_name_, robot_id_, joint_prefix_, ns_;
00072
00077 void initialize_pids();
00078 };
00079
00080 }
00081
00082
00083
00084
00085
00086
00087
00088
00089 #endif