27 #include "../example/srh_example_controller.hpp" 32 #include <std_msgs/Float64.h> 40 SrhExampleController::SrhExampleController()
59 std::string joint_name;
76 return init(robot, joint_name);
83 std::string robot_state_name;
84 node_.
param<std::string>(
"robot_state_name", robot_state_name,
"unique_robot_hw");
88 robot_ = robot->getHandle(robot_state_name).getState();
92 ROS_ERROR_STREAM(
"Could not find robot state: " << robot_state_name <<
" Not loading the controller. " <<
99 if (joint_name.substr(3, 1).compare(
"0") == 0)
104 std::string j1 = joint_name.substr(0, 3) +
"1";
105 std::string j2 = joint_name.substr(0, 3) +
"2";
111 ROS_ERROR(
"SrhMixedPositionVelocityController could not find joint named \"%s\"\n",
120 ROS_ERROR(
"SrhMixedPositionVelocityController could not find joint named \"%s\"\n",
133 ROS_ERROR(
"SrhMixedPositionVelocityController could not find joint named \"%s\"\n",
180 double error_position = 0.0;
194 double commanded_effort = 10 * error_position;
virtual const char * what() const
ros_ethercat_model::JointState * joint_state_
boost::scoped_ptr< realtime_tools::RealtimePublisher< control_msgs::JointControllerState > > controller_state_publisher_
virtual void update(const ros::Time &time, const ros::Duration &period)
virtual void starting(const ros::Time &time)
ros_ethercat_model::JointState * joint_state_2
ros::Subscriber sub_command_
ros_ethercat_model::RobotState * robot_
bool init(ros_ethercat_model::RobotStateInterface *robot, ros::NodeHandle &n)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
const std::string & getNamespace() const
virtual ~SrhExampleController()
bool getParam(const std::string &key, std::string &s) const
#define ROS_ERROR_STREAM(args)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
void after_init()
call this function at the end of the init function in the inheriting classes.