cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtsRobotTask.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5  Author(s): Paul Wilkening
6  Created on: 2014
7 
8  (C) Copyright 2014 Johns Hopkins University (JHU), All Rights Reserved.
9 
10  --- begin cisst license - do not edit ---
11 
12  This software is provided "as is" under an open source license, with
13  no warranty. The complete license can be found in license.txt and
14  http://www.cisst.org/cisst/license.txt.
15 
16  --- end cisst license ---
17  */
18 
19 #ifndef _mtsRobotTask_h
20 #define _mtsRobotTask_h
21 
23 
25 #include <sawConstraintController/prmJointState.h>
26 
27 // Always include last!
29 
31 {
33 
34 protected:
35 
36  enum TASKMODE {JPOS = 1, JVEL = 2};
37 
38  //VF Controller
40 
41  //Joint position and velocities
42  prmJointState JointState;
43 
44  //Contains controller output
46 
48 
49  //Current mode of task (how we should treat controllerOutput)
50  //The possible values of MODE refer to:
51  //1. Converting controllerOutput to an incremental joint position
52  //2. Converting controllerOutput to a joint velocity
53  //3. Converting controllerOutput to an incremental cartesian position
54  //4. Converting controllerOutput to a cartesian velocity
56 
57 public:
58 
59  mtsRobotTask(const std::string & taskName, double period): mtsTaskPeriodic(taskName, period, false, 1000) {
60  // These communication methods are the same for all tasks
61  InitializeInterfaces();
62  }
63 
64  ~mtsRobotTask(void) {}
65 
66  // Methods needed for periodic tasks
67  // (implementations of all but run can be empty if not needed)
68  virtual void Run(void);
69 
70  // Set up methods that pass VFs, sensors, kins, mode, etc
71  bool InitializeInterfaces(void);
72 
73  // Update local kins, sensors
74  virtual bool UpdateRobotStateData(void) = 0;
75 
76  // Safety check on the CO output
77  virtual bool ValidMotion(const vctDoubleVec & ControllerOutput) = 0;
78 
79  // Robot interface methods
80  virtual bool EStopOn() = 0;
81  virtual bool CheckWithinLimits() = 0;
82  virtual bool DisableMotors() = 0;
83  virtual bool StopMotion() = 0;
84  virtual bool JointVelocityMove(const vctDoubleVec & dq) = 0;
85  virtual bool JointPositionMove(const vctDoubleVec & dq) = 0;
86  virtual bool CartesianVelocityMove(const vctDoubleVec & dx) = 0;
87  virtual bool CartesianPositionMove(const vctDoubleVec & dx) = 0;
88  virtual bool ComputeJointPosition(vctDoubleVec & qPos) = 0;
89  virtual bool ComputeJointVelocity(vctDoubleVec & qVel) = 0;
90 
91 };
92 
94 
95 #endif // _mtsRobotTask_h
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
TASKMODE
Definition: mtsRobotTask.h:36
mtsVFController: A class that is responsible for managing the virtual fixtures, relevant state data...
Definition: mtsVFController.h:43
nmrConstraintOptimizer::STATUS OptimizerStatus
Definition: mtsRobotTask.h:47
CMN_DECLARE_SERVICES_INSTANTIATION(mtsRobotTask)
Definition: mtsRobotTask.h:30
mtsRobotTask(const std::string &taskName, double period)
Definition: mtsRobotTask.h:59
TASKMODE TaskMode
Definition: mtsRobotTask.h:55
#define CMN_LOG_LOD_RUN_VERBOSE
Definition: cmnLogLoD.h:95
~mtsRobotTask(void)
Definition: mtsRobotTask.h:64
#define CMN_DECLARE_SERVICES(hasDynamicCreation, lod)
Definition: cmnClassRegisterMacros.h:116
Defines a periodic task.
mtsVFController CO_Controller
Definition: mtsRobotTask.h:39
virtual void Run(void)=0
prmJointState JointState
Definition: mtsRobotTask.h:42
Definition: mtsTaskPeriodic.h:80
STATUS
Definition: nmrConstraintOptimizer.h:77
const int CMN_NO_DYNAMIC_CREATION
Definition: cmnClassRegisterMacros.h:328
vctDoubleVec ControllerOutput
Definition: mtsRobotTask.h:45