humotion / examples / meka / include / mekajointinterface.h @ 5fba4e15
History | View | Annotate | Download (2.198 KB)
1 |
#pragma once
|
---|---|
2 |
#include <humotion/server/joint_interface.h> |
3 |
#include <humotion/server/server.h> |
4 |
#include <boost/bimap.hpp> |
5 |
|
6 |
#include "ros/ros.h" |
7 |
#include "sensor_msgs/JointState.h" |
8 |
#include "trajectory_msgs/JointTrajectory.h" |
9 |
|
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(int e, float position, float velocity); |
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, humotion::Timestamp 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 |
void set_eyelid_angle(double angle); |
41 |
void set_eyebrow_angle(int id); |
42 |
void set_mouth();
|
43 |
|
44 |
//iCubDataReceiver *icub_data_receiver;
|
45 |
void init_joints();
|
46 |
double lid_angle;
|
47 |
int lid_opening_previous;
|
48 |
int previous_mouth_state;
|
49 |
|
50 |
std::string input_scope; |
51 |
std::string control_scope; |
52 |
std::string output_scope; |
53 |
|
54 |
float last_pos_eye_vergence;
|
55 |
float last_pos_eye_pan;
|
56 |
float last_vel_eye_vergence;
|
57 |
float last_vel_eye_pan;
|
58 |
|
59 |
bool controller_enabled;
|
60 |
|
61 |
void store_joint(int id, float value); |
62 |
void set_target_in_positionmode(int id, double value); |
63 |
void set_target_in_velocitymode(int id, double value); |
64 |
|
65 |
|
66 |
int convert_enum_to_motorid(int e); |
67 |
int convert_motorid_to_enum(int id); |
68 |
|
69 |
|
70 |
typedef boost::bimap<int, int > enum_id_bimap_t; |
71 |
typedef enum_id_bimap_t::value_type enum_id_bimap_entry_t;
|
72 |
enum_id_bimap_t enum_id_bimap; |
73 |
}; |