kinematics-dynamics
LinearTrajectoryThread.hpp
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 #ifndef __LINEAR_TRAJECTORY_THREAD_HPP__
4 #define __LINEAR_TRAJECTORY_THREAD_HPP__
5 
6 #include <mutex>
7 #include <vector>
8 
9 #include <yarp/os/PeriodicThread.h>
10 
11 #include <kdl/trajectory.hpp>
12 
13 #include "ICartesianControl.h"
14 
15 namespace roboticslab
16 {
17 
23 class LinearTrajectoryThread : public yarp::os::PeriodicThread
24 {
25 public:
26  LinearTrajectoryThread(int period, ICartesianControl * iCartesianControl);
27  ~LinearTrajectoryThread() override;
28 
29  bool checkStreamingConfig();
30  bool configure(const std::vector<double> & vels);
31  void useTcpFrame(bool enableTcpFrame) { usingTcpFrame = enableTcpFrame; }
32 
33 protected:
34  void run() override;
35 
36 private:
37  double period {0.0};
38  ICartesianControl * iCartesianControl {nullptr};
39  KDL::Trajectory * trajectory {nullptr};
40  double startTime {0.0};
41  bool usingStreamingCommandConfig {false};
42  bool usingTcpFrame {false};
43  std::vector<double> deltaX;
44  mutable std::mutex mtx;
45 };
46 
47 } // namespace roboticslab
48 
49 #endif // __LINEAR_TRAJECTORY_THREAD_HPP__
Contains roboticslab::ICartesianControl and related vocabs.
Abstract base class for a cartesian controller.
Definition: ICartesianControl.h:146
Periodic thread that encapsulates a linear trajectory.
Definition: LinearTrajectoryThread.hpp:24
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:6