CtrlGroup.h
Go to the documentation of this file.
00001 // CtrlGroup.h
00002 //
00003 /*
00004 * Software License Agreement (BSD License) 
00005 *
00006 * Copyright (c) 2013, Yaskawa America, Inc.
00007 * All rights reserved.
00008 *
00009 * Redistribution and use in binary form, with or without modification,
00010 * is permitted provided that the following conditions are met:
00011 *
00012 *       * Redistributions in binary form must reproduce the above copyright
00013 *       notice, this list of conditions and the following disclaimer in the
00014 *       documentation and/or other materials provided with the distribution.
00015 *       * Neither the name of the Yaskawa America, Inc., nor the names 
00016 *       of its contributors may be used to endorse or promote products derived
00017 *       from this software without specific prior written permission.
00018 *
00019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00020 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00022 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00023 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00024 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00025 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00026 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00027 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00028 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00029 * POSSIBILITY OF SUCH DAMAGE.
00030 */ 
00031 
00032 #ifndef CTRLGROUP_H
00033 #define CTRLGROUP_H
00034 
00035 #define Q_SIZE 200
00036 #define Q_LOCK_TIMEOUT 1000
00037 #define Q_OFFSET_IDX( a, b, c ) (((a)+(b)) >= (c) ) ? ((a)+(b)-(c)) \
00038                                 : ( (((a)+(b)) < 0 ) ? ((a)+(b)+(c)) : ((a)+(b)) )
00039                                 
00040 typedef struct
00041 {
00042         LONG time;
00043         UCHAR frame;
00044         UCHAR user;
00045         UCHAR tool;
00046         LONG inc[MP_GRP_AXES_NUM];
00047 } Incremental_data;
00048 
00049 typedef struct
00050 {
00051         SEM_ID q_lock;
00052         LONG cnt;
00053         LONG idx;
00054         Incremental_data data[Q_SIZE];
00055 } Incremental_q;
00056 
00057 
00058 
00059 // jointMotionData values are in radian and joint order in sequential order 
00060 typedef struct
00061 {
00062         int flag;
00063         int time;                                               // time in millisecond
00064         float pos[MP_GRP_AXES_NUM];             // position in radians
00065         float vel[MP_GRP_AXES_NUM];             // velocity in radians/s
00066         float acc[MP_GRP_AXES_NUM];             // acceleration in radians/s^2
00067 } JointMotionData;
00068 
00069 
00070 //---------------------------------------------------------------
00071 // CtrlGroup:
00072 // Structure containing all the data related to a control group 
00073 //---------------------------------------------------------------
00074 typedef struct 
00075 {
00076         int groupNo;                                                            // sequence group number
00077         int numAxes;                                                            // number of axis in the control group
00078         MP_GRP_ID_TYPE groupId;                                         // control group ID
00079         GB_PULSE_TO_RAD pulseToRad;                                     // conversion ratio between pulse and radian
00080         FB_PULSE_CORRECTION_DATA correctionData;        // compensation for axes coupling
00081         MAX_INCREMENT_INFO maxInc;                                      // maximum increment per interpolation cycle
00082         float maxSpeedRad[MP_GRP_AXES_NUM];                     // maximum joint speed in radian/sec
00083         
00084         Incremental_q inc_q;                                            // incremental queue
00085         long q_time;                                                            // time to which the queue as been processed
00086         
00087         JointMotionData jointMotionData;                        // joint motion command data in radian
00088         JointMotionData jointMotionDataToProcess;       // joint motion command data in radian to process
00089         BOOL hasDataToProcess;                                          // indicates that there is data to process
00090         int tidAddToIncQueue;                                           // ThreadId to add incremental values to the queue
00091         int timeLeftover_ms;                                            // Time left over after reaching the end of a trajectory to complet the interpolation period
00092 } CtrlGroup;
00093 
00094 
00095 //---------------------------------
00096 // External Functions Declaration
00097 //---------------------------------
00098 
00099 extern CtrlGroup* Ros_CtrlGroup_Create(int groupNo, float interpolPeriod);
00100 
00101 extern BOOL Ros_CtrlGroup_GetPulsePosCmd(CtrlGroup* ctrlGroup, long pulsePos[MAX_PULSE_AXES]);
00102 
00103 extern BOOL Ros_CtrlGroup_GetFBPulsePos(CtrlGroup* ctrlGroup, long pulsePos[MAX_PULSE_AXES]);
00104 
00105 extern void Ros_CtrlGroup_ConvertToRosPos(CtrlGroup* ctrlGroup, long pulsePos[MAX_PULSE_AXES], float radPos[MAX_PULSE_AXES]);
00106 
00107 extern void Ros_CtrlGroup_ConvertToMotoPos(CtrlGroup* ctrlGroup, float radPos[MAX_PULSE_AXES], long pulsePos[MAX_PULSE_AXES]);
00108 
00109 extern UCHAR Ros_CtrlGroup_GetAxisConfig(CtrlGroup* ctrlGroup);
00110 
00111 extern BOOL Ros_CtrlGroup_IsRobot(CtrlGroup* ctrlGroup);
00112 
00113 #endif


motoman_driver
Author(s): Jeremy Zoss (Southwest Research Institute)
autogenerated on Wed Aug 26 2015 12:37:33