ricboard_pub.h
Go to the documentation of this file.
1 
2 #ifndef ARMADILLO2_HW_RICBOARD_PUB_H
3 #define ARMADILLO2_HW_RICBOARD_PUB_H
4 
8 #include <ros/ros.h>
9 #include <tf/tf.h>
10 #include <sensor_msgs/Range.h>
11 #include <sensor_msgs/NavSatFix.h>
12 #include <sensor_msgs/Imu.h>
13 #include <std_msgs/Float64.h>
14 #include <std_msgs/String.h>
18 #include <boost/thread/thread.hpp>
19 #include <boost/chrono/chrono.hpp>
20 
21 
22 #define RIC_PORT_PARAM "~ric_port"
23 #define TORSO_JOINT_PARAM "~torso_joint"
24 #define RIC_PUB_INTERVAL 0.1 //secs
25 #define RIC_WRITE_INTERVAL 0.05 //secs
26 #define RIC_DEAD_TIMEOUT 1 //secs
27 #define MAX_RIC_DISCONNECTIONS 5
28 #define SERVO_NEUTRAL 1500
29 
31 {
32  double pos = 0;
33  double vel = 0;
34  double prev_pos = 0;
35  double effort = 0; /* effort stub - not used */
36  double command_effort = 0;
37  std::string joint_name;
38 };
39 
40 
42 {
43 private:
44 
45  bool load_ric_hw_ = true;
46  int ric_disconnections_counter_ = 0;
47  std::string ric_port_;
51 
53  ric_dead_timer_;
58  boost::thread* t;
59 
61 
62  /* handles */
63  std::vector<hardware_interface::JointStateHandle> joint_state_handles_;
64  std::vector<hardware_interface::JointHandle> pos_handles_;
65 
66  void pubTimerCB(const ros::TimerEvent& event);
67  void ricDeadTimerCB(const ros::TimerEvent& event);
68  void loop();
69  void speakMsg(std::string msg, int sleep_time)
70  {
71  std_msgs::String speak_msg;
72  speak_msg.data = msg;
73  espeak_pub_.publish(speak_msg);
74  if (sleep_time > 0)
75  sleep(sleep_time);
76  }
77 
78 public:
80  void startLoop();
81  void stopLoop();
82 
83  /* functions for ros controller use */
84  void read(const ros::Duration elapsed);
85  void write(const ros::Duration elapsed);
86  void registerHandles(hardware_interface::JointStateInterface &joint_state_interface,
87  hardware_interface::EffortJointInterface &position_interface);
88 };
89 
90 
91 #endif //ARMADILLO2_HW_RICBOARD_PUB_H
double prev_pos
Definition: ricboard_pub.h:34
torso_joint torso_
Definition: ricboard_pub.h:54
ros::Publisher espeak_pub_
Definition: ricboard_pub.h:60
ros::NodeHandle * nh_
Definition: ricboard_pub.h:57
void publish(const boost::shared_ptr< M > &message) const
std::vector< hardware_interface::JointStateHandle > joint_state_handles_
Definition: ricboard_pub.h:63
ric_interface::RicInterface ric_
Definition: ricboard_pub.h:56
double command_effort
Definition: ricboard_pub.h:36
double pos
Definition: ricboard_pub.h:32
double effort
Definition: ricboard_pub.h:35
ros::Publisher ric_imu_pub_
Definition: ricboard_pub.h:50
std::string ric_port_
Definition: ricboard_pub.h:47
std::vector< hardware_interface::JointHandle > pos_handles_
Definition: ricboard_pub.h:64
boost::thread * t
Definition: ricboard_pub.h:58
ros::Timer ric_pub_timer_
Definition: ricboard_pub.h:52
double vel
Definition: ricboard_pub.h:33
ros::Publisher ric_ultrasonic_pub_
Definition: ricboard_pub.h:49
void speakMsg(std::string msg, int sleep_time)
Definition: ricboard_pub.h:69
LowPassFilter torso_lpf_
Definition: ricboard_pub.h:55
std::string joint_name
Definition: ricboard_pub.h:37
ros::Publisher ric_gps_pub_
Definition: ricboard_pub.h:48


armadillo2_hw
Author(s):
autogenerated on Wed Jan 3 2018 03:48:27