This ROS package defines libraries that are generic to the control algorithms used in my research, in an attempt to maximize code re-usability.
This is a ROS package and relies on a ROS instalation. Assuming the "full" version of your ROS distro, this package depends on the package realtime_tools
:
$ sudo apt-get install ros-<distro>-realtime-tools
where you should replace <distro>
with the ROS distribution name (e.g., indigo
).
Tested in ROS indigo and kinetic.
To implement a controller you inherit from the ControllerTemplate
class and implement the pure virtual methods. This will enhance your controller with an actionlib interface.
Create a package named my_controller
, which should define an actionlib action file (Example.action
) as in the actionlib tutorial. In the class definition file, you should have something like
// Other includes
#include <my_controller/ExampleAction.h>
#include <generic_control_toolbox/controller_template.hpp>
class MyController : public generic_control_toolbox::ControllerTemplate<ExampleAction,
ExampleGoal,
ExampleFeedback,
ExampleResult>
{
public:
MyController(const std::string &action_name);
// destructor, other public methods/members
private:
sensor_msgs::JointState controlAlgorithm(const sensor_msgs::JointState ¤t_state, const ros::Duration &dt);
bool parseGoal(boost::shared_ptr<const ExampleGoal> goal);
bool init();
void resetController();
// other public methods/members
};
The action_name
element of the constructor must be passed to the ControllerTemplate
constructor to initialize the actiolib server. An example of an implemented controller using this template can be found in the sarafun_folding_assembly folding controller definition.