kinematics-dynamics
Loading...
Searching...
No Matches
FtCompensation.hpp
1// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3#ifndef __FT_COMPENSATION_HPP__
4#define __FT_COMPENSATION_HPP__
5
6#include <yarp/os/PeriodicThread.h>
7#include <yarp/os/RFModule.h>
8
9#include <yarp/dev/MultipleAnalogSensorsInterfaces.h>
10#include <yarp/dev/PolyDriver.h>
11
12#include <kdl/frames.hpp>
13
14#include "ICartesianControl.h"
15
16namespace roboticslab
17{
18
26class FtCompensation : public yarp::os::RFModule,
27 public yarp::os::PeriodicThread
28{
29public:
31 : yarp::os::PeriodicThread(1.0, yarp::os::ShouldUseSystemClock::Yes, yarp::os::PeriodicThreadClock::Absolute)
32 {}
33
34 ~FtCompensation() override
35 { close(); }
36
37 bool configure(yarp::os::ResourceFinder & rf) override;
38 bool updateModule() override;
39 bool interruptModule() override;
40 double getPeriod() override;
41 bool close() override;
42
43protected:
44 void run() override;
45
46private:
47 bool readSensor(KDL::Wrench & wrench) const;
48 bool compensateTool(KDL::Wrench & wrench) const;
49 bool applyImpedance(KDL::Wrench & wrench);
50
51 yarp::dev::PolyDriver cartesianDevice;
52 ICartesianControl * iCartesianControl;
53
54 int sensorIndex;
55 yarp::dev::PolyDriver sensorDevice;
56 yarp::dev::ISixAxisForceTorqueSensors * sensor;
57
58 KDL::Rotation R_N_sensor;
59 KDL::Vector toolCoM_N;
60 KDL::Wrench toolWeight_0;
61 KDL::Wrench initialOffset;
62 KDL::Frame initialPose;
63 KDL::Frame previousPose;
64
65 using cartesian_cmd = void (ICartesianControl::*)(const std::vector<double> &);
66 cartesian_cmd command;
67
68 bool dryRun;
69 bool usingTool;
70 bool enableImpedance;
71
72 double linGain;
73 double rotGain;
74
75 double linStiffness;
76 double rotStiffness;
77
78 double linDamping;
79 double rotDamping;
80
81 double forceDeadband;
82 double torqueDeadband;
83};
84
85} // namespace roboticslab
86
87#endif // __FT_COMPENSATION_HPP__
Contains roboticslab::ICartesianControl and related vocabs.
Produces motion in the direction of an externally applied force measured by a force-torque sensor (pr...
Definition FtCompensation.hpp:28
Abstract base class for a cartesian controller.
Definition ICartesianControl.h:146
The main, catch-all namespace for Robotics Lab UC3M.
Definition groups.dox:6