yarp-devices
JointCalibrator.hpp
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 #ifndef __JOINT_CALIBRATOR_HPP__
4 #define __JOINT_CALIBRATOR_HPP__
5 
6 #include <vector>
7 
8 #include <yarp/dev/CalibratorInterfaces.h>
9 #include <yarp/dev/DeviceDriver.h>
10 #include <yarp/dev/IControlMode.h>
11 #include <yarp/dev/IEncoders.h>
12 #include <yarp/dev/IPositionControl.h>
13 #include <yarp/dev/WrapperSingle.h>
14 
15 namespace roboticslab
16 {
17 
29 {
30  std::vector<double> pos;
31  std::vector<double> vel;
32  std::vector<double> acc;
33 };
34 
39 class JointCalibrator : public yarp::dev::DeviceDriver,
40  public yarp::dev::IRemoteCalibrator,
41  public yarp::dev::WrapperSingle
42 {
43 public:
45  : axes(0), iControlMode(nullptr), iEncoders(nullptr), iPositionControl(nullptr)
46  { }
47 
48  bool calibrateSingleJoint(int j) override;
49  bool calibrateWholePart() override;
50  bool homingSingleJoint(int j) override;
51  bool homingWholePart() override;
52  bool parkSingleJoint(int j, bool wait) override;
53  bool parkWholePart() override;
54  bool quitCalibrate() override;
55  bool quitPark() override;
56 
57  bool attach(yarp::dev::PolyDriver * poly) override;
58  bool detach() override;
59 
60  bool open(yarp::os::Searchable & config) override;
61  bool close() override;
62 
63 private:
64  bool move(const std::vector<int> & joints, const MovementSpecs & specs);
65 
66  int axes;
67  bool isBlocking;
68 
69  MovementSpecs homeSpecs;
70  MovementSpecs parkSpecs;
71 
72  yarp::dev::IControlMode * iControlMode;
73  yarp::dev::IEncoders * iEncoders;
74  yarp::dev::IPositionControl * iPositionControl;
75 };
76 
77 } // namespace roboticslab
78 
79 #endif // __JOINT_CALIBRATOR_HPP__
Remote calibrator class for multi-joint homing and park.
Definition: JointCalibrator.hpp:42
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:6
Stores movement specifications: position, velocity, acceleration.
Definition: JointCalibrator.hpp:29