CtrlGroup.h
Go to the documentation of this file.
1 // CtrlGroup.h
2 //
3 /*
4 * Software License Agreement (BSD License)
5 *
6 * Copyright (c) 2013, Yaskawa America, Inc.
7 * All rights reserved.
8 *
9 * Redistribution and use in binary form, with or without modification,
10 * is permitted provided that the following conditions are met:
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of the Yaskawa America, Inc., nor the names
16 * of its contributors may be used to endorse or promote products derived
17 * from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31 
32 #ifndef CTRLGROUP_H
33 #define CTRLGROUP_H
34 
35 
36 #define Q_SIZE 200
37 
38 #if (DX100 || DX200 || FS100)
39 #define Q_LOCK_TIMEOUT 1000
40 #else
41 #define Q_LOCK_TIMEOUT 5000 //YRC1000 tick period is 0.2 ms
42 #endif
43 
44 #define Q_OFFSET_IDX( a, b, c ) (((a)+(b)) >= (c) ) ? ((a)+(b)-(c)) \
45  : ( (((a)+(b)) < 0 ) ? ((a)+(b)+(c)) : ((a)+(b)) )
46 
47 #define RAD_PER_DEGREE (0.0174533)
48 
49 typedef struct
50 {
51  LONG time;
52  UCHAR frame;
53  UCHAR user;
54  UCHAR tool;
55  LONG inc[MP_GRP_AXES_NUM];
57 
58 typedef struct
59 {
60  SEM_ID q_lock;
61  LONG cnt;
62  LONG idx;
65 
66 // jointMotionData values are in radian and joint order in sequential order
67 typedef struct
68 {
69  int flag;
70  int time; // time in millisecond
71  float pos[MP_GRP_AXES_NUM]; // position in radians
72  float vel[MP_GRP_AXES_NUM]; // velocity in radians/s
73  float acc[MP_GRP_AXES_NUM]; // acceleration in radians/s^2
75 
76 //---------------------------------------------------------------
77 // CtrlGroup:
78 // Structure containing all the data related to a control group
79 //---------------------------------------------------------------
80 typedef struct
81 {
82  int groupNo; // sequence group number
83  int numAxes; // number of axis in the control group
84  MP_GRP_ID_TYPE groupId; // control group ID
85  PULSE_TO_RAD pulseToRad; // conversion ratio between pulse and radian
86  PULSE_TO_METER pulseToMeter; // conversion ratio between pulse and meter (linear axis)
87  FB_PULSE_CORRECTION_DATA correctionData; // compensation for axes coupling
88  MAX_INCREMENT_INFO maxInc; // maximum increment per interpolation cycle
89  float maxSpeed[MP_GRP_AXES_NUM]; // maximum joint speed in radian/sec (rotational) or meter/sec (linear)
90  int tool; // selected tool for the motion
91 
92  Incremental_q inc_q; // incremental queue
93  long q_time; // time to which the queue has been processed
94 
95  JointMotionData jointMotionData; // joint motion command data in radian
96  JointMotionData jointMotionDataToProcess; // joint motion command data in radian to process
97  BOOL hasDataToProcess; // indicates that there is data to process
98  int tidAddToIncQueue; // ThreadId to add incremental values to the queue
99  int timeLeftover_ms; // Time left over after reaching the end of a trajectory to complete the interpolation period
100  long prevPulsePos[MAX_PULSE_AXES]; // The commanded pulse position that the trajectory starts at (Ros_MotionServer_StartTrajMode)
101  AXIS_MOTION_TYPE axisType; // Indicates whether axis is rotary or linear
102 
103  BOOL bIsBaxisSlave; // Indicates the B axis will automatically move to maintain orientation as other axes are moved
104 
105  JOINT_FEEDBACK_SPEED_ADDRESSES speedFeedbackRegisterAddress; //CIO address for the registers containing feedback speed
106 } CtrlGroup;
107 
108 
109 //---------------------------------
110 // External Functions Declaration
111 //---------------------------------
112 
113 //Initialize specific control group. This should be called for each group connected to the robot
114 //controller in numerical order.
115 // int groupNo: Zero based index of the group number (0-3)
116 // BOOL bIsLastGrpToInit: TRUE if this is the final group that is being initialized. FALSE if you plan to call this function again.
117 // float interpolPeriod: Value of the interpolation period (ms) for the robot controller.
118 extern CtrlGroup* Ros_CtrlGroup_Create(int groupNo, BOOL bIsLastGrpToInit, float interpolPeriod);
119 
120 extern BOOL Ros_CtrlGroup_GetPulsePosCmd(CtrlGroup* ctrlGroup, long pulsePos[MAX_PULSE_AXES]);
121 extern BOOL Ros_CtrlGroup_GetFBPulsePos(CtrlGroup* ctrlGroup, long pulsePos[MAX_PULSE_AXES]);
122 extern BOOL Ros_CtrlGroup_GetFBServoSpeed(CtrlGroup* ctrlGroup, long pulseSpeed[MAX_PULSE_AXES]);
123 
124 extern BOOL Ros_CtrlGroup_GetTorque(CtrlGroup* ctrlGroup, double torqueValues[MAX_PULSE_AXES]);
125 
126 extern void Ros_CtrlGroup_ConvertToRosPos(CtrlGroup* ctrlGroup, long pulsePos[MAX_PULSE_AXES], float rosPos[MAX_PULSE_AXES]);
127 extern void Ros_CtrlGroup_ConvertToMotoPos(CtrlGroup* ctrlGroup, float radPos[MAX_PULSE_AXES], long pulsePos[MAX_PULSE_AXES]);
128 
129 extern UCHAR Ros_CtrlGroup_GetAxisConfig(CtrlGroup* ctrlGroup);
130 
131 extern BOOL Ros_CtrlGroup_IsRobot(CtrlGroup* ctrlGroup);
132 
133 #endif
MP_GRP_ID_TYPE groupId
Definition: CtrlGroup.h:84
void Ros_CtrlGroup_ConvertToRosPos(CtrlGroup *ctrlGroup, long pulsePos[MAX_PULSE_AXES], float rosPos[MAX_PULSE_AXES])
Definition: CtrlGroup.c:479
float pos[ROS_MAX_JOINT]
float acc[ROS_MAX_JOINT]
JOINT_FEEDBACK_SPEED_ADDRESSES speedFeedbackRegisterAddress
Definition: CtrlGroup.h:105
Incremental_q inc_q
Definition: CtrlGroup.h:92
BOOL bIsBaxisSlave
Definition: CtrlGroup.h:103
int groupNo
SEM_ID q_lock
Definition: CtrlGroup.h:60
PULSE_TO_RAD pulseToRad
Definition: CtrlGroup.h:85
BOOL hasDataToProcess
Definition: CtrlGroup.h:97
BOOL Ros_CtrlGroup_GetFBPulsePos(CtrlGroup *ctrlGroup, long pulsePos[MAX_PULSE_AXES])
Definition: CtrlGroup.c:271
void Ros_CtrlGroup_ConvertToMotoPos(CtrlGroup *ctrlGroup, float radPos[MAX_PULSE_AXES], long pulsePos[MAX_PULSE_AXES])
Definition: CtrlGroup.c:548
int tidAddToIncQueue
Definition: CtrlGroup.h:98
BOOL Ros_CtrlGroup_GetFBServoSpeed(CtrlGroup *ctrlGroup, long pulseSpeed[MAX_PULSE_AXES])
Definition: CtrlGroup.c:345
float data[ROS_MAX_JOINT]
UCHAR Ros_CtrlGroup_GetAxisConfig(CtrlGroup *ctrlGroup)
Definition: CtrlGroup.c:618
BOOL Ros_CtrlGroup_GetTorque(CtrlGroup *ctrlGroup, double torqueValues[MAX_PULSE_AXES])
Definition: CtrlGroup.c:450
int tool
Definition: CtrlGroup.h:90
int groupNo
Definition: CtrlGroup.h:82
#define Q_SIZE
Definition: CtrlGroup.h:36
BOOL Ros_CtrlGroup_GetPulsePosCmd(CtrlGroup *ctrlGroup, long pulsePos[MAX_PULSE_AXES])
Definition: CtrlGroup.c:212
int numAxes
Definition: CtrlGroup.h:83
JointMotionData jointMotionData
Definition: CtrlGroup.h:95
CtrlGroup * Ros_CtrlGroup_Create(int groupNo, BOOL bIsLastGrpToInit, float interpolPeriod)
Definition: CtrlGroup.c:59
BOOL Ros_CtrlGroup_IsRobot(CtrlGroup *ctrlGroup)
Definition: CtrlGroup.c:635
MAX_INCREMENT_INFO maxInc
Definition: CtrlGroup.h:88
JointMotionData jointMotionDataToProcess
Definition: CtrlGroup.h:96
int timeLeftover_ms
Definition: CtrlGroup.h:99
float vel[ROS_MAX_JOINT]
AXIS_MOTION_TYPE axisType
Definition: CtrlGroup.h:101
FB_PULSE_CORRECTION_DATA correctionData
Definition: CtrlGroup.h:87
PULSE_TO_METER pulseToMeter
Definition: CtrlGroup.h:86
long q_time
Definition: CtrlGroup.h:93


motoman_driver
Author(s): Jeremy Zoss (Southwest Research Institute), Ted Miller (MotoROS) (Yaskawa Motoman), Eric Marcil (MotoROS) (Yaskawa Motoman)
autogenerated on Sat May 8 2021 02:27:43