NJointTrajectoryController.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <VirtualRobot/Robot.h>
4 
5 #include <ArmarXGui/interface/StaticPlotterInterface.h>
6 
9 #include <RobotAPI/interface/units/RobotUnit/NJointTrajectoryController.h>
11 
13 
14 namespace armarx
15 {
16  TYPEDEF_PTRS_HANDLE(NJointTrajectoryController);
17 
19  {
20  public:
22  };
23 
24  /**
25  * @brief The NJointTrajectoryController class
26  * @ingroup Library-RobotUnit-NJointControllers
27  */
29  public NJointControllerWithTripleBuffer<NJointTrajectoryControllerControlData>,
30  public NJointTrajectoryControllerInterface
31  {
32  public:
34  const NJointControllerConfigPtr& config,
35  const VirtualRobot::RobotPtr&);
36 
38 
39  // NJointControllerInterface interface
40  std::string getClassName(const Ice::Current&) const override;
41  void onInitNJointController() override;
42  void onConnectNJointController() override;
43 
44  // NJointController interface
45  void rtPreActivateController() override;
46  void rtPostDeactivateController() override;
47  void rtRun(const IceUtil::Time& sensorValuesTimestamp,
48  const IceUtil::Time& timeSinceLastIteration) override;
49 
50  // NJointTrajectoryControllerInterface interface
51  void setTrajectory(const TrajectoryBasePtr& t, const Ice::Current&) override;
52  bool isFinished(const Ice::Current&) override;
53  double getCurrentTimestamp(const Ice::Current&) override;
54  float getCurrentProgressFraction(const Ice::Current&) override;
55 
56  double getCurrentTrajTime() const;
57  void setLooping(bool looping);
58  double getTrajEndTime() const;
60 
61  private:
62  IceUtil::Time startTime;
63  std::vector<ControlTarget1DoFActuatorVelocity*> targets;
64  std::vector<const SensorValue1DoFActuatorPosition*> sensors;
65  LimitlessStateSeq limitlessStates;
66  StaticPlotterInterfacePrx plotter;
68 
69  Eigen::VectorXf currentPos;
70  bool looping = false;
71  float direction = 1.0;
72  double trajEndTime;
73  TrajectoryControllerPtr trajectoryCtrl;
74  NJointTrajectoryControllerConfigPtr cfg;
75  bool finished = false;
76  double currentTimestamp = 0;
77 
78  double startTimestamp = 0, endTimestamp = 1;
79  };
80 } // namespace armarx
armarx::NJointTrajectoryController::onConnectNJointController
void onConnectNJointController() override
Definition: NJointTrajectoryController.cpp:68
armarx::NJointTrajectoryController::getCurrentTimestamp
double getCurrentTimestamp(const Ice::Current &) override
Definition: NJointTrajectoryController.cpp:243
NJointControllerWithTripleBuffer.h
armarx::TYPEDEF_PTRS_HANDLE
TYPEDEF_PTRS_HANDLE(NJointCartesianNaturalPositionController)
armarx::NJointControllerWithTripleBuffer
Definition: NJointControllerWithTripleBuffer.h:10
armarx::NJointTrajectoryController::setTrajectory
void setTrajectory(const TrajectoryBasePtr &t, const Ice::Current &) override
Definition: NJointTrajectoryController.cpp:123
armarx::NJointTrajectoryController
The NJointTrajectoryController class.
Definition: NJointTrajectoryController.h:28
armarx::NJointTrajectoryController::onInitNJointController
void onInitNJointController() override
Definition: NJointTrajectoryController.cpp:62
armarx::NJointTrajectoryController::isFinished
bool isFinished(const Ice::Current &) override
Definition: NJointTrajectoryController.cpp:237
IceInternal::Handle< Trajectory >
armarx::NJointTrajectoryController::getTrajectoryCopy
TrajectoryPtr getTrajectoryCopy() const
Definition: NJointTrajectoryController.cpp:281
armarx::NJointTrajectoryController::getCurrentTrajTime
double getCurrentTrajTime() const
Definition: NJointTrajectoryController.cpp:255
armarx::NJointTrajectoryController::getClassName
std::string getClassName(const Ice::Current &) const override
Definition: NJointTrajectoryController.cpp:56
armarx::NJointTrajectoryController::rtPostDeactivateController
void rtPostDeactivateController() override
This function is called after the controller is deactivated.
Definition: NJointTrajectoryController.cpp:301
armarx::NJointTrajectoryController::NJointTrajectoryController
NJointTrajectoryController(RobotUnit *prov, const NJointControllerConfigPtr &config, const VirtualRobot::RobotPtr &)
Definition: NJointTrajectoryController.cpp:17
ControlTarget1DoFActuator.h
armarx::TrajectoryControllerPtr
std::shared_ptr< TrajectoryController > TrajectoryControllerPtr
Definition: TrajectoryController.h:61
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::NJointTrajectoryController::rtRun
void rtRun(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration) override
TODO make protected and use attorneys.
Definition: NJointTrajectoryController.cpp:75
armarx::RobotUnit
The RobotUnit class manages a robot and its controllers.
Definition: RobotUnit.h:180
IceInternal::ProxyHandle<::IceProxy::armarx::DebugObserverInterface >
armarx::NJointTrajectoryController::setLooping
void setLooping(bool looping)
Definition: NJointTrajectoryController.cpp:269
armarx::NJointTrajectoryControllerControlData
Definition: NJointTrajectoryController.h:18
armarx::NJointTrajectoryControllerControlData::trajectoryCtrl
TrajectoryControllerPtr trajectoryCtrl
Definition: NJointTrajectoryController.h:21
armarx::NJointTrajectoryController::rtPreActivateController
void rtPreActivateController() override
This function is called before the controller is activated.
Definition: NJointTrajectoryController.cpp:295
armarx::NJointTrajectoryController::getCurrentProgressFraction
float getCurrentProgressFraction(const Ice::Current &) override
Definition: NJointTrajectoryController.cpp:249
TrajectoryController.h
armarx::NJointTrajectoryController::~NJointTrajectoryController
~NJointTrajectoryController()
Definition: NJointTrajectoryController.cpp:51
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::NJointTrajectoryController::getTrajEndTime
double getTrajEndTime() const
Definition: NJointTrajectoryController.cpp:275
SensorValue1DoFActuator.h
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18