Statistics
| Branch: | Tag: | Revision:

humotion / examples / yarp_icub / include / icub_data_receiver.h @ 708960ff

History | View | Annotate | Download (1.538 KB)

1 8c6c1163 Simon Schulz
#pragma once
2
#include <humotion/server/joint_interface.h>
3
#include <boost/bimap.hpp>
4
#include <yarp/dev/PolyDriver.h>
5
#include <yarp/dev/IControlLimits2.h>
6
#include <yarp/dev/ControlBoardInterfaces.h>
7
#include <yarp/os/Time.h>
8
#include <yarp/sig/Vector.h>
9
#include "icub_jointinterface.h"
10
#include <humotion/server/server.h>
11
#include <yarp/os/Network.h>
12
#include <yarp/os/RateThread.h>
13
#include <yarp/os/Time.h>
14
#include <yarp/os/Property.h>
15
#include <yarp/dev/ControlBoardInterfaces.h>
16
#include "icub_jointinterface.h"
17
18
//forward declaration to solve loop
19
class iCubJointInterface;
20
21
class iCubDataReceiver : public yarp::os::RateThread{
22
public:
23 35b3ca25 Simon Schulz
    iCubDataReceiver(int period, iCubJointInterface *icub_jointinterface);
24 8c6c1163 Simon Schulz
    bool threadInit();
25
    void threadRelease();
26
    void run();
27
private:
28 35b3ca25 Simon Schulz
    void store_incoming_position(int icub_id, double value, double timestamp);
29 ea29304b Simon Schulz
    void store_incoming_velocity(int icub_id, double velocity, double timestamp);
30
    yarp::sig::Vector calculate_velocities(yarp::sig::Vector positions,
31
                              yarp::sig::Vector timestamps);
32 8c6c1163 Simon Schulz
33 ad7b6f18 Simon Schulz
    void dump_incoming_data();
34
35 35b3ca25 Simon Schulz
    float target_eye_pan_;
36
    float target_eye_vergence_;
37 8c6c1163 Simon Schulz
38 ea29304b Simon Schulz
    float target_eye_pan_velocity_;
39
    float target_eye_vergence_velocity_;
40
41
    yarp::sig::Vector positions_;
42
    yarp::sig::Vector timestamps_;
43
    yarp::sig::Vector velocities_;
44
    yarp::sig::Vector commands_;
45
46
    yarp::sig::Vector previous_positions_;
47
    yarp::sig::Vector previous_timestamps_;
48 35b3ca25 Simon Schulz
49
    iCubJointInterface *icub_jointinterface_;
50 ea29304b Simon Schulz
    yarp::dev::IEncodersTimed *iencs_;
51 8c6c1163 Simon Schulz
};