1 #ifndef __CONTROLLER_TEMPLATE__ 2 #define __CONTROLLER_TEMPLATE__ 7 #include <sensor_msgs/JointState.h> 33 const sensor_msgs::JointState ¤t_state,
54 template <
class ActionClass,
class ActionGoal,
class ActionFeedback,
67 const sensor_msgs::JointState ¤t_state,
const ros::Duration &dt);
77 virtual sensor_msgs::JointState controlAlgorithm(
78 const sensor_msgs::JointState ¤t_state,
92 virtual void resetController() = 0;
113 sensor_msgs::JointState lastState(
const sensor_msgs::JointState ¤t);
124 void startActionlib();
129 virtual bool goalCB();
134 virtual void preemptCB();
148 template <
class ActionClass,
class ActionGoal,
class ActionFeedback,
152 : action_name_(action_name), nh_(nh)
158 template <
class ActionClass,
class ActionGoal,
class ActionFeedback,
161 ActionClass, ActionGoal, ActionFeedback,
177 << MAX_DT <<
" seconds, aborting");
208 for (
unsigned int i = 0; i < ret.name.size(); i++)
210 if (!std::isfinite(ret.position[i]) || !std::isfinite(ret.velocity[i]))
220 template <
class ActionClass,
class ActionGoal,
class ActionFeedback,
233 template <
class ActionClass,
class ActionGoal,
class ActionFeedback,
247 template <
class ActionClass,
class ActionGoal,
class ActionFeedback,
261 template <
class ActionClass,
class ActionGoal,
class ActionFeedback,
264 ActionClass, ActionGoal, ActionFeedback,
267 if (current.position.size() == 0)
269 ROS_WARN(
"lastState got invalid state");
276 for (
unsigned long i = 0; i <
last_state_.velocity.size(); i++)
287 template <
class ActionClass,
class ActionGoal,
class ActionFeedback,
305 std::string package_name, path, topic;
309 if (
nh_.
getParam(
"record_bag/package", package_name))
312 bag_manager_ = std::make_shared<BagManager>(path, topic);
316 bag_manager_ = std::make_shared<BagManager>(path, topic);
321 "No record_bag/package or record_bag/path parameters detected! No " 322 "bag will be recorded");
330 template <
class ActionClass,
class ActionGoal,
class ActionFeedback,
340 template <
class ActionClass,
class ActionGoal,
class ActionFeedback,
348 template <
class ActionClass,
class ActionGoal,
class ActionFeedback,
367 ROS_INFO(
"%s initialized successfully!", action_name_.c_str());
bool getParam(const std::string &key, std::string &s) const
std::string resolveName(const std::string &name, bool remap=true) const
bool hasParam(const std::string &key) const
ROSLIB_DECL std::string getPath(const std::string &package_name)
#define ROS_ERROR_STREAM(args)
#define ROS_DEBUG_THROTTLE(period,...)