cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mtsIntuitiveResearchKitSUJ.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): Anton Deguet, Youri Tan
6  Created on: 2014-11-07
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 
20 #ifndef _mtsIntuitiveResearchKitSUJ_h
21 #define _mtsIntuitiveResearchKitSUJ_h
22 
24 #include <sawIntuitiveResearchKit/mtsIntuitiveResearchKitArmTypes.h>
26 
27 // forward declaration
28 class mtsIntuitiveResearchKitSUJArmData;
29 
31 {
33 
34 public:
35  static const size_t NumberOfJoints = 4;
36  static const size_t NumberOfBrakes = 3;
37 
38  mtsIntuitiveResearchKitSUJ(const std::string & componentName, const double periodInSeconds);
41 
42  void Configure(const std::string & filename);
43  void Startup(void);
44  void Run(void);
45  void Cleanup(void);
46 
47 protected:
48 
49  void Init(void);
50 
52  void GetRobotData(void);
53 
57 
60  void SetState(const mtsIntuitiveResearchKitArmTypes::RobotStateType & newState);
61 
63  void RunHoming(void);
64 
66  void RunHomingPower(void);
67 
69  void RunReady(void);
70 
71  void SetRobotControlState(const std::string & state);
72 
74  void GetRobotControlState(std::string & state) const;
75 
77  void SetLiftVelocity(const double & velocity);
78 
80  void SetBaseFrame(const prmPositionCartesianGet & newBaseFrame);
81 
83  void ErrorEventHandler(const std::string & message);
84 
86  void MotorDownEventHandler(const prmEventButton & button);
87 
89  void MotorUpEventHandler(const prmEventButton & button);
90 
91  // Required interface
92  struct {
100  } RobotIO;
101 
102  // Functions for events
103  struct {
108  } MessageEvents;
109 
110  // Functions to control MUX
111  struct {
114  } MuxReset;
115 
116  struct {
119  } MuxIncrement;
120 
121  double mMuxTimer;
124 
125  // Functions to control motor on SUJ3
126  struct {
129  } PWM;
130 
131  mtsIntuitiveResearchKitArmTypes::RobotStateType mRobotState;
132 
133  // Home Action
134  double mHomingTimer;
136 
137  // Clutch / brake timer
138  double mPreviousTic;
140 
142  const size_t mVoltageSamplesNumber;
146 
147  void DispatchError(const std::string & message);
148  void DispatchStatus(const std::string & message);
149 };
150 
152 
153 #endif // _mtsIntuitiveResearchKitSUJ_h
vctBoolVec mMuxState
Definition: mtsIntuitiveResearchKitSUJ.h:122
mtsFunctionVoid EnablePower
Enable Robot Power.
Definition: mtsIntuitiveResearchKitSUJ.h:94
struct mtsIntuitiveResearchKitSUJ::@199 PWM
double mMuxTimer
Definition: mtsIntuitiveResearchKitSUJ.h:121
double mHomingTimer
Definition: mtsIntuitiveResearchKitSUJ.h:134
Definition: mtsFunctionRead.h:37
struct mtsIntuitiveResearchKitSUJ::@195 RobotIO
void SetLiftVelocity(const double &velocity)
mtsFunctionRead GetActuatorAmpStatus
Definition: mtsIntuitiveResearchKitSUJ.h:97
mtsIntuitiveResearchKitArmTypes::RobotStateType mRobotState
Definition: mtsIntuitiveResearchKitSUJ.h:131
size_t mVoltageSamplesCounter
Definition: mtsIntuitiveResearchKitSUJ.h:143
void SetState(const mtsIntuitiveResearchKitArmTypes::RobotStateType &newState)
mtsFunctionWrite SetActuatorCurrent
Definition: mtsIntuitiveResearchKitSUJ.h:98
Definition: mtsTaskPeriodic.h:38
Definition: mtsFunctionVoid.h:36
bool mHomingPowerRequested
Definition: mtsIntuitiveResearchKitSUJ.h:135
double mPreviousTic
Definition: mtsIntuitiveResearchKitSUJ.h:138
const int CMN_DYNAMIC_CREATION_ONEARG
Definition: cmnClassRegisterMacros.h:333
struct mtsIntuitiveResearchKitSUJ::@197 MuxReset
mtsIntuitiveResearchKitSUJ(const std::string &componentName, const double periodInSeconds)
mtsFunctionWrite EnablePWM
Definition: mtsIntuitiveResearchKitSUJ.h:127
Definition: mtsIntuitiveResearchKitSUJ.h:30
Definition: prmEventButton.h:37
CMN_DECLARE_SERVICES_INSTANTIATION(mtsIntuitiveResearchKitSUJ)
vctDoubleVec mBrakeCurrents
Definition: mtsIntuitiveResearchKitSUJ.h:139
struct mtsIntuitiveResearchKitSUJ::@196 MessageEvents
void Configure(const std::string &filename)
mtsFunctionRead GetAnalogInputVolts
Definition: mtsIntuitiveResearchKitSUJ.h:99
void GetRobotControlState(std::string &state) const
const size_t mVoltageSamplesNumber
Definition: mtsIntuitiveResearchKitSUJ.h:142
struct mtsIntuitiveResearchKitSUJ::@198 MuxIncrement
size_t mMuxIndex
Definition: mtsIntuitiveResearchKitSUJ.h:123
mtsFunctionRead GetValue
Definition: mtsIntuitiveResearchKitSUJ.h:112
mtsFunctionWrite SetValue
Definition: mtsIntuitiveResearchKitSUJ.h:113
void GetAndConvertPotentiometerValues(void)
void DispatchError(const std::string &message)
void ErrorEventHandler(const std::string &message)
mtsFunctionWrite Error
Definition: mtsIntuitiveResearchKitSUJ.h:106
static const size_t NumberOfBrakes
Definition: mtsIntuitiveResearchKitSUJ.h:36
static const size_t NumberOfJoints
Definition: mtsIntuitiveResearchKitSUJ.h:35
vctDynamicVector< vctDoubleVec > mVoltageSamples
Definition: mtsIntuitiveResearchKitSUJ.h:141
Defines a periodic task.
vctDoubleVec mVoltages
Definition: mtsIntuitiveResearchKitSUJ.h:144
vctFixedSizeVector< mtsIntuitiveResearchKitSUJArmData *, 4 > Arms
Definition: mtsIntuitiveResearchKitSUJ.h:145
size_t mMuxIndexExpected
Definition: mtsIntuitiveResearchKitSUJ.h:123
~mtsIntuitiveResearchKitSUJ()
Definition: mtsIntuitiveResearchKitSUJ.h:40
mtsFunctionWrite RobotState
Definition: mtsIntuitiveResearchKitSUJ.h:107
void DispatchStatus(const std::string &message)
mtsFunctionWrite Warning
Definition: mtsIntuitiveResearchKitSUJ.h:105
void MotorUpEventHandler(const prmEventButton &button)
Definition: mtsFunctionWrite.h:37
mtsFunctionWrite Status
Definition: mtsIntuitiveResearchKitSUJ.h:104
Definition: mtsTaskPeriodic.h:80
void SetBaseFrame(const prmPositionCartesianGet &newBaseFrame)
void SetRobotControlState(const std::string &state)
mtsFunctionWrite SetPWMDutyCycle
Definition: mtsIntuitiveResearchKitSUJ.h:128
mtsFunctionVoid DisablePower
Definition: mtsIntuitiveResearchKitSUJ.h:95
void MotorDownEventHandler(const prmEventButton &button)
#define CMN_LOG_ALLOW_DEFAULT
Definition: cmnLogLoD.h:76
mtsFunctionRead GetEncoderChannelA
Definition: mtsIntuitiveResearchKitSUJ.h:96
Definition: prmPositionCartesianGet.h:37