102 #include <sys/time.h> 109 #include "rnr/rnrconfig.h" 112 #include "Dynamixel/Dynamixel.h" 113 #include "Dynamixel/DynaError.h" 114 #include "Dynamixel/DynaServo.h" 115 #include "Dynamixel/DynaChain.h" 200 double &fJointCurPos,
201 double &fJointCurVel);
211 double &fJointCurPos,
212 double &fJointCurVel);
223 int &nServoCurSpeed);
253 virtual bool isStopped(
const std::string &strJointName);
296 virtual void estop();
349 virtual int stop(
const std::vector<std::string> &vecJointNames);
364 virtual int stop(
const std::string &strJointName);
402 virtual int move(
const std::string &strJointName,
403 const double fJointGoalPos,
404 const double fJointGoalVel);
411 virtual void setHz(
const double fHz);
461 #ifdef HEK_KIN_EXEC_ALG_SYNC 463 bool m_bWaitOneCycle;
464 #else // HEK_KIN_EXEC_ALG_INDIV 467 #endif // HEK_KIN_EXEC_ALG_SYNC 485 pthread_mutex_lock(&m_mutexSync);
499 pthread_mutex_unlock(&m_mutexSync);
508 virtual void sense();
516 virtual void react();
565 static void *
thread(
void *pArg);
600 m_eState = eNewState;
601 pthread_cond_signal(&m_condSync);
620 void timedWait(
const struct timespec &tsTimeout);
vector< std::string > TaskList
Order list of tasks.
ThreadState
Kinematics thread states.
map< std::string, HekKinJoint * > KinChain
Associative Map of kinematic joints.
static const double HekTuneKinHzDft
Default kinematics thread cycle rate (Hertz).
virtual int stop()
Stop kinematics chain at the current position.
virtual void freeze()
Freeze kinematics chain at the current position.
virtual int waitForAllStop(double fSeconds)
Wait for all joints to stop.
virtual void sense()
Sense the state of all joints.
virtual void getJointCurPosVel(const std::string &strJointName, double &fJointCurPos, double &fJointCurVel)
Get the current instantaneous joint position and velocity.
double m_fHz
thread run rate (Hertz)
virtual bool isStopped(const std::string &strJointName)
Test if joint is moving.
virtual void react()
React to any necessary time-critical joint events.
Joint trajectory point class.
static void * thread(void *pArg)
The kinematics thread.
bool m_bIsControlling
[not] actively controlling joints
TaskList m_taskList
list of tasks to exec per cycle
ThreadState m_eState
thread state
Joint points and trajectory class interfaces.
thread created and ready to run
void lock()
Lock the kinematics thread.
Hekateros tuning data class.
virtual int resetServoOdometersForAllJoints()
Reset all joints' master servos odometers to the current respective encoder positions.
KinChain m_kinChain
kinematic chain
Container class to hold Dynamixel synchronous messages data.
void createThread()
Create the kinematics thread.
void unlock()
Unlock the kinematics thread.
void waitOneCycle()
Wait one full cycle.
int runThread(const double fHz=HekTuneKinHzDft)
Run the kinematics thread.
virtual ~HekKinematics()
Desctructor.
Hekateros joint classes interfaces.
virtual void monitorHealth()
Monitor servo health thread task.
virtual int act()
Move all joints.
std::string m_strTaskOneCycle
task name one cycle away
void terminateThread()
Terminate the kinematics thread.
virtual void plan()
Plan motions for all joints.
int m_nNumServos
number of servos to monitor
virtual int resetServoOdometer(const std::string &strJointName)
Reset joint's master servo odometer to the current encoder position.
std::map< int, HekRobotJoint > MapRobotJoints
Map of robot joints.
thread created but unitialized
pthread_t m_thread
pthread identifier
Top-level package include file.
struct timespec m_tsSched
working scheduler time stamp
pthread_mutex_t m_mutexSync
synchonization mutex
int jointPosToServoPos(const std::string &strJointName, const double fPos)
Convert joint position to the equivalent servo position.
virtual bool hasOverTorqueCondition(const std::string &strJointName)
Test if joint is in an over torque condition.
virtual void sense_react()
Sense-react the state of all joints.
virtual void exec()
Execute kinematics task(s).
struct timespec m_tsExecPeriod
task execution period (converted)
void schedWait()
Block kinematics thread until the next subcycle task is to be run.
virtual void setHz(const double fHz)
Set thread run rate and ancillary data.
HekKinematics(DynaChain &dynaChain, MapRobotJoints &kinJointDesc, const HekTunes &tunes)
Default initializer constructor.
void changeState(ThreadState eNewState)
Change the kinematics thread state.
pthread_cond_t m_condSync
synchonization condition
Hekateros common utilities.
virtual void release()
Release kinematics chain.
virtual void getFilteredJointCurPosVel(const std::string &strJointName, double &fJointCurPos, double &fJointCurVel)
Get the smoothed (filtered) current joint position and velocity.
virtual void estop()
Emergency stop the kinematics chain.
virtual int move(HekJointTrajectoryPoint &trajectoryPoint)
Move kinematic chain through a trajectory point.
void getServoCurPosSpeed(const std::string &strJointName, int &nServoCurPos, int &nServoCurSpeed)
Get the current servo position and speed.
Hekateros powered joint kinematics and dynamics control class interface.
virtual void buildTaskList()
Build ordered list of tasks to execute.
DynaChain & m_dynaChain
dynamixel chain
double m_fTExec
task execution period (seconds)
int m_iterHealth
servo health iterator
void timedWait(const struct timespec &tsTimeout)
Timed wait until state change or time out.
virtual void reload(const HekTunes &tunes)
Reload configuration tuning parameters for all joints.
TaskList::iterator m_iterTask
task iterator
The <b><i>Hekateros</i></b> namespace encapsulates all <b><i>Hekateros</i></b> related constructs...
double servoPosToJointPos(const std::string &strJointName, const int nOdPos)
Convert servo position to the equivalent joint position.
int m_nHealthServoId
health monitoring servo id
void readyWait()
Wait indefinitely while in the ready state.
int m_nNumJoints
number of joints to control