movement_publisher.hpp
Go to the documentation of this file.
1 
27 #ifndef _MOVEMENT_PUBLISHER_HPP_
28 #define _MOVEMENT_PUBLISHER_HPP_
29 
30 #include <ros/ros.h>
31 #include <boost/thread.hpp>
32 #include <string>
33 #include <vector>
34 
35 #include <std_msgs/Float64.h>
37 #include <control_msgs/JointControllerState.h>
38 #include <sr_robot_msgs/JointControllerState.h>
39 #include <math.h>
40 #include <sr_hand/hand_commander.hpp>
41 
42 namespace shadowrobot
43 {
45 {
46 public:
59  MovementPublisher(std::string joint_name, double rate = 100.0,
60  unsigned int repetition = 1, unsigned int nb_mvt_step = 1000 ,
61  std::string controller_type = "", bool testing = false,
62  HandCommander* hand_commander = NULL);
63 
64  MovementPublisher(double min_value = 0.0, double max_value = 1.5,
65  double rate = 100.0, unsigned int repetition = 1,
66  unsigned int nb_mvt_step = 1000 , std::string controller_type = "");
67 
68  virtual ~MovementPublisher();
69 
70  void start();
71  void stop();
72 
79  void sr_calculateErrorCallback(const sr_robot_msgs::JointControllerState::ConstPtr& msg);
80 
87  void calculateErrorCallback(const control_msgs::JointControllerState::ConstPtr& msg);
88 
93  void execute_step(int index_mvt_step, int index_partial_movement);
94 
95  void add_movement(PartialMovement mvt);
96 
97  void set_publisher(ros::Publisher publisher);
98  void set_subscriber(ros::Subscriber subscriber);
99 
100  std::string get_subscriber_topic();
101 
102 protected:
110  void subscribe_and_default_pub_(std::string input);
111 
118  void publish_();
119 
121  std::string joint_name_;
122 
123  std::vector<PartialMovement> partial_movements;
128 
130  unsigned int repetition;
131  double min, max;
132 
133  std_msgs::Float64 msg;
134  std::vector<sr_robot_msgs::joint> joint_vector_;
135  double last_target_;
136 
137  unsigned int nb_mvt_step;
138  double SError_;
139  double MSError_;
140  unsigned int n_samples_;
141  std::string controller_type;
142 };
143 } // namespace shadowrobot
144 
145 /* For the emacs weenies in the crowd.
146 Local Variables:
147  c-basic-offset: 2
148 End:
149 */
150 
151 #endif
MovementPublisher(std::string joint_name, double rate=100.0, unsigned int repetition=1, unsigned int nb_mvt_step=1000, std::string controller_type="", bool testing=false, HandCommander *hand_commander=NULL)
void execute_step(int index_mvt_step, int index_partial_movement)
void set_subscriber(ros::Subscriber subscriber)
void add_movement(PartialMovement mvt)
boost::shared_ptr< HandCommander > hand_commander_
void subscribe_and_default_pub_(std::string input)
void calculateErrorCallback(const control_msgs::JointControllerState::ConstPtr &msg)
std::vector< PartialMovement > partial_movements
void set_publisher(ros::Publisher publisher)
This is the main class from which all the different types of movement will inherit.
std::vector< sr_robot_msgs::joint > joint_vector_
void sr_calculateErrorCallback(const sr_robot_msgs::JointControllerState::ConstPtr &msg)


sr_movements
Author(s): Ugo Cupcic
autogenerated on Tue Oct 13 2020 03:50:46