visual-tracking-control
VisualServoingClient.h
Go to the documentation of this file.
1 #ifndef VISUALSERVOINGCLIENT_H
2 #define VISUALSERVOINGCLIENT_H
3 
4 #include "thrift/VisualServoingIDL.h"
5 
6 #include <vector>
7 
8 #include <yarp/dev/DeviceDriver.h>
9 #include <yarp/dev/IVisualServoing.h>
10 #include <yarp/os/Bottle.h>
11 #include <yarp/os/BufferedPort.h>
12 #include <yarp/os/ConstString.h>
13 #include <yarp/os/LogStream.h>
14 #include <yarp/os/Port.h>
15 #include <yarp/os/Searchable.h>
16 #include <yarp/sig/Vector.h>
17 
18 
19 class VisualServoingClient : public yarp::dev::DeviceDriver,
20  public yarp::dev::IVisualServoing
21 {
22 public:
23  /* Ctors and Dtors */
25 
27 
28 
29  /* DeviceDriver overrides */
30  bool open(yarp::os::Searchable &config) override;
31 
32  bool close() override;
33 
34 
35  /* IVisualServoing overrides */
36  bool initFacilities(const bool use_direct_kin) override;
37 
38  bool resetFacilities() override;
39 
40  bool stopFacilities() override;
41 
42  bool goToGoal(const yarp::sig::Vector& vec_x, const yarp::sig::Vector& vec_o) override;
43 
44  bool goToGoal(const std::vector<yarp::sig::Vector>& vec_px_l, const std::vector<yarp::sig::Vector>& vec_px_r) override;
45 
46  bool setModality(const std::string& mode) override;
47 
48  bool setVisualServoControl(const std::string& control) override;
49 
50  bool setControlPoint(const yarp::os::ConstString& point) override;
51 
52  bool getVisualServoingInfo(yarp::os::Bottle& info) override;
53 
54  bool setGoToGoalTolerance(const double tol = 15.0) override;
55 
56  bool checkVisualServoingController() override;
57 
58  bool waitVisualServoingDone(const double period = 0.1, const double timeout = 0.0) override;
59 
60  bool stopController() override;
61 
62  bool setTranslationGain(const double K_x_1 = 1.0, const double K_x_2 = 0.25) override;
63 
64  bool setMaxTranslationVelocity(const double max_x_dot) override;
65 
66  bool setTranslationGainSwitchTolerance(const double K_x_tol = 30.0) override;
67 
68  bool setOrientationGain(const double K_o_1 = 1.5, const double K_o_2 = 0.375) override;
69 
70  bool setMaxOrientationVelocity(const double max_o_dot) override;
71 
72  bool setOrientationGainSwitchTolerance(const double K_o_tol = 30.0) override;
73 
74  std::vector<yarp::sig::Vector> get3DGoalPositionsFrom3DPose(const yarp::sig::Vector& x, const yarp::sig::Vector& o) override;
75 
76  std::vector<yarp::sig::Vector> getGoalPixelsFrom3DPose(const yarp::sig::Vector& x, const yarp::sig::Vector& o, const CamSel& cam) override;
77 
78  bool storedInit(const std::string& label) override;
79 
80  bool storedGoToGoal(const std::string& label) override;
81 
82  bool goToSFMGoal() override;
83 
84 
85 private:
86  bool verbosity_ = false;
87  yarp::os::ConstString local_ = "";
88  yarp::os::ConstString remote_ = "";
89 
91  yarp::os::Port port_rpc_command_;
92 
93  void yInfoVerbose (const yarp::os::ConstString& str) const { if(verbosity_) yInfo() << str; };
94  void yWarningVerbose(const yarp::os::ConstString& str) const { if(verbosity_) yWarning() << str; };
95  void yErrorVerbose (const yarp::os::ConstString& str) const { if(verbosity_) yError() << str; };
96 };
97 
98 #endif /* VISUALSERVOINGCLIENT_H */
bool setTranslationGainSwitchTolerance(const double K_x_tol=30.0) override
bool initFacilities(const bool use_direct_kin) override
bool goToGoal(const yarp::sig::Vector &vec_x, const yarp::sig::Vector &vec_o) override
bool setTranslationGain(const double K_x_1=1.0, const double K_x_2=0.25) override
bool setVisualServoControl(const std::string &control) override
yarp::os::Port port_rpc_command_
bool checkVisualServoingController() override
bool open(yarp::os::Searchable &config) override
bool setControlPoint(const yarp::os::ConstString &point) override
yarp::os::ConstString remote_
bool setModality(const std::string &mode) override
void yInfoVerbose(const yarp::os::ConstString &str) const
bool setMaxTranslationVelocity(const double max_x_dot) override
VisualServoingIDL IDL Interface to ServerVisualServoing functionalities.
yarp::os::ConstString local_
VisualServoingIDL visualservoing_control
bool storedGoToGoal(const std::string &label) override
bool setOrientationGainSwitchTolerance(const double K_o_tol=30.0) override
bool setMaxOrientationVelocity(const double max_o_dot) override
void yWarningVerbose(const yarp::os::ConstString &str) const
std::vector< yarp::sig::Vector > getGoalPixelsFrom3DPose(const yarp::sig::Vector &x, const yarp::sig::Vector &o, const CamSel &cam) override
std::vector< yarp::sig::Vector > get3DGoalPositionsFrom3DPose(const yarp::sig::Vector &x, const yarp::sig::Vector &o) override
bool setOrientationGain(const double K_o_1=1.5, const double K_o_2=0.375) override
bool waitVisualServoingDone(const double period=0.1, const double timeout=0.0) override
void yErrorVerbose(const yarp::os::ConstString &str) const
bool storedInit(const std::string &label) override
bool getVisualServoingInfo(yarp::os::Bottle &info) override
bool setGoToGoalTolerance(const double tol=15.0) override