humotion / examples / meka / include / mekajointinterface.h @ d82702d2
History | View | Annotate | Download (1.998 KB)
1 |
#pragma once
|
---|---|
2 |
#include <humotion/server/joint_interface.h> |
3 |
#include <humotion/server/server.h> |
4 |
#include <boost/bimap.hpp> |
5 |
//#include "meka_data_receiver.h"
|
6 |
//class MekaDataReceiver;
|
7 |
#include "ros/ros.h" |
8 |
#include "sensor_msgs/JointState.h" |
9 |
#include "trajectory_msgs/JointTrajectory.h" |
10 |
|
11 |
class MekaJointInterface : public humotion::server::JointInterface{ |
12 |
public:
|
13 |
MekaJointInterface(std::string _input_scope, std::string _output_scope); |
14 |
~MekaJointInterface(); |
15 |
|
16 |
//void fetch_position(Device *dev, double timestamp);
|
17 |
//void fetch_speed(Device *dev, double timestamp);
|
18 |
//void fetch_position(int id, double value, double timestamp);
|
19 |
//void fetch_speed(int id, double value, double timestamp);
|
20 |
void run();
|
21 |
|
22 |
static const int MAIN_LOOP_FREQUENCY = 50; |
23 |
|
24 |
protected:
|
25 |
void disable_joint(int e); |
26 |
void publish_target_position(int e); |
27 |
void enable_joint(int e); |
28 |
void execute_motion();
|
29 |
|
30 |
private:
|
31 |
void incoming_jointstates(const sensor_msgs::JointState & msg); |
32 |
void store_dummy_data(int id, double timestamp); |
33 |
void store_min_max(int id, float min, float max); |
34 |
ros::Subscriber joint_state_subscriber; |
35 |
ros::Publisher target_publisher; |
36 |
|
37 |
double get_timestamp_s();
|
38 |
|
39 |
void set_eyelid_angle(double angle); |
40 |
void set_eyebrow_angle(int id); |
41 |
void set_mouth();
|
42 |
|
43 |
//iCubDataReceiver *icub_data_receiver;
|
44 |
void init_joints();
|
45 |
double lid_angle;
|
46 |
int lid_opening_previous;
|
47 |
int previous_mouth_state;
|
48 |
|
49 |
std::string input_scope; |
50 |
std::string output_scope; |
51 |
|
52 |
float last_pos_eye_vergence;
|
53 |
float last_pos_eye_pan;
|
54 |
float last_vel_eye_vergence;
|
55 |
float last_vel_eye_pan;
|
56 |
|
57 |
void store_joint(int id, float value); |
58 |
void set_target_in_positionmode(int id, double value); |
59 |
void set_target_in_velocitymode(int id, double value); |
60 |
|
61 |
|
62 |
int convert_enum_to_motorid(int e); |
63 |
int convert_motorid_to_enum(int id); |
64 |
|
65 |
|
66 |
typedef boost::bimap<int, int > enum_id_bimap_t; |
67 |
typedef enum_id_bimap_t::value_type enum_id_bimap_entry_t;
|
68 |
enum_id_bimap_t enum_id_bimap; |
69 |
}; |