humotion / examples / meka / include / mekajointinterface.h @ 728b1c95
History | View | Annotate | Download (2.25 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 |
#include <m3meka_msgs/M3ControlStates.h> |
11 |
|
12 |
class MekaJointInterface : public humotion::server::JointInterface{ |
13 |
public:
|
14 |
MekaJointInterface(std::string _input_scope, std::string control_scope, std::string _output_scope); |
15 |
~MekaJointInterface(); |
16 |
|
17 |
//void fetch_position(Device *dev, double timestamp);
|
18 |
//void fetch_speed(Device *dev, double timestamp);
|
19 |
//void fetch_position(int id, double value, double timestamp);
|
20 |
//void fetch_speed(int id, double value, double timestamp);
|
21 |
void run();
|
22 |
|
23 |
static const int MAIN_LOOP_FREQUENCY = 50; |
24 |
|
25 |
protected:
|
26 |
void disable_joint(int e); |
27 |
void publish_target_position(int e); |
28 |
void enable_joint(int e); |
29 |
void execute_motion();
|
30 |
|
31 |
private:
|
32 |
void incoming_controlstate(const m3meka_msgs::M3ControlStates &control_state); |
33 |
void incoming_jointstates(const sensor_msgs::JointState & msg); |
34 |
void store_dummy_data(int id, double timestamp); |
35 |
void store_min_max(int id, float min, float max); |
36 |
ros::Subscriber joint_state_subscriber; |
37 |
ros::Subscriber control_state_subscriber; |
38 |
ros::Publisher target_publisher; |
39 |
|
40 |
double get_timestamp_s();
|
41 |
|
42 |
void set_eyelid_angle(double angle); |
43 |
void set_eyebrow_angle(int id); |
44 |
void set_mouth();
|
45 |
|
46 |
//iCubDataReceiver *icub_data_receiver;
|
47 |
void init_joints();
|
48 |
double lid_angle;
|
49 |
int lid_opening_previous;
|
50 |
int previous_mouth_state;
|
51 |
|
52 |
std::string input_scope; |
53 |
std::string control_scope; |
54 |
std::string output_scope; |
55 |
|
56 |
float last_pos_eye_vergence;
|
57 |
float last_pos_eye_pan;
|
58 |
float last_vel_eye_vergence;
|
59 |
float last_vel_eye_pan;
|
60 |
|
61 |
bool controller_enabled;
|
62 |
|
63 |
void store_joint(int id, float value); |
64 |
void set_target_in_positionmode(int id, double value); |
65 |
void set_target_in_velocitymode(int id, double value); |
66 |
|
67 |
|
68 |
int convert_enum_to_motorid(int e); |
69 |
int convert_motorid_to_enum(int id); |
70 |
|
71 |
|
72 |
typedef boost::bimap<int, int > enum_id_bimap_t; |
73 |
typedef enum_id_bimap_t::value_type enum_id_bimap_entry_t;
|
74 |
enum_id_bimap_t enum_id_bimap; |
75 |
}; |