8 void kmlFactory::_readEntry(
char* dest,
int destsz,
const char* section,
const char* subsection,
const char* entry) {
21 memset(line,0,
sizeof(line));
24 }
while (strcmp(line,section));
30 memset(line,0,
sizeof(line));
33 }
while (strcmp(line,subsection));
38 memset(line,0,
sizeof(line));
41 }
while (strncmp(line,entry,strlen(entry)));
47 while (line[pos++] !=
'=') {
51 while (line[pos++] !=
'"') {
56 memset(dest,0,destsz);
57 while (line[pos] !=
'"') {
58 dest[idx++] = line[pos++];
62 while (line[pos++] !=
';') {
74 _readEntry(input,
sizeof(input),
"[KATANA]",
"[GENERAL]",
"addr");
75 gnl.
adr = atoi(input);
77 _readEntry(input,
sizeof(input),
"[KATANA]",
"[GENERAL]",
"modelName");
88 _readEntry(input,
sizeof(input),
"[KATANA]",
"[GENERAL]",
"motcnt");
89 mot.
cnt = atoi(input);
100 _readEntry(input,
sizeof(input),
"[KATANA]",
"[GENERAL]",
"sctcnt");
101 katsct.
cnt = atoi(input);
109 _readEntry(input,
sizeof(input),
"[KATANA]",
"[GENERAL]",
"type");
115 _readEntry(input,
sizeof(input),
"[KATANA]",
"[GENERAL]",
"kinematics");
116 if(!strcmp(
"Analytical", input))
118 if(!strcmp(
"RobAnaGuess", input))
128 _readEntry(input,
sizeof(input),
"[ENDEFFECTOR]",
"[GENERAL]",
"segment1");
130 _readEntry(input,
sizeof(input),
"[ENDEFFECTOR]",
"[GENERAL]",
"segment2");
132 _readEntry(input,
sizeof(input),
"[ENDEFFECTOR]",
"[GENERAL]",
"segment3");
134 _readEntry(input,
sizeof(input),
"[ENDEFFECTOR]",
"[GENERAL]",
"segment4");
146 for(
int i = 0; i < count; ++i) {
147 memset(section,0,
sizeof(section));
148 sprintf(section,
"[MOT[%d]]",i);
149 _readEntry(input,
sizeof(input),section,
"[GENERAL]",
"slvID");
150 motdesc[i].
slvID = atoi(input);
161 for(
int i = 0; i < count; ++i) {
162 memset(section,0,
sizeof(section));
163 sprintf(section,
"[SCT[%d]]", i);
164 _readEntry(input,
sizeof(input),section,
"[GENERAL]",
"ctrlID");
165 sctdesc[i].
ctrlID = atoi(input);
166 _readEntry(input,
sizeof(input),section,
"[GENERAL]",
"sens_res");
168 _readEntry(input,
sizeof(input),section,
"[GENERAL]",
"sens_count");
181 memset(section,0,
sizeof(section));
182 sprintf(section,
"[MOT[%d]]", number);
184 _readEntry(input,
sizeof(input),section,
"[CALIBRATION]",
"enable");
185 clb.
enable = strcmp(
"TRUE",input) ?
false :
true;
187 _readEntry(input,
sizeof(input),section,
"[CALIBRATION]",
"order");
188 clb.
order = atoi(input);
190 _readEntry(input,
sizeof(input),section,
"[CALIBRATION]",
"dir");
196 _readEntry(input,
sizeof(input),section,
"[CALIBRATION]",
"mcf");
197 if(!strcmp(
"MCF_OFF", input))
199 if(!strcmp(
"MCF_ON", input))
201 if(!strcmp(
"MCF_FREEZE",input))
211 _readEntry(input,
sizeof(input),section,
"[CALIBRATION]",
"encoderPositionAfter");
223 memset(section,0,
sizeof(section));
224 sprintf(section,
"[MOT[%d]]", number);
226 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"maxppwm");
229 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"maxnpwm");
232 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"kP");
233 scp.
kP = atoi(input);
235 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"kI");
236 scp.
kI = atoi(input);
238 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"kD");
239 scp.
kD = atoi(input);
241 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"kARW");
242 scp.
kARW = atoi(input);
244 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"kP_speed");
247 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"kI_speed");
250 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"kD_speed");
253 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"maxppwm_nmp");
256 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"maxnpwm_nmp");
259 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"kspeed_nmp");
262 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"kpos_nmp");
265 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"kI_nmp");
268 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"crash_limit_nmp");
271 _readEntry(input,
sizeof(input),section,
"[STATIC]",
"crash_limit_lin_nmp");
282 memset(section,0,
sizeof(section));
283 sprintf(section,
"[MOT[%d]]", number);
285 _readEntry(input,
sizeof(input),section,
"[DYNAMIC]",
"maxaccel");
288 _readEntry(input,
sizeof(input),section,
"[DYNAMIC]",
"maxdecel");
291 _readEntry(input,
sizeof(input),section,
"[DYNAMIC]",
"minpos");
294 _readEntry(input,
sizeof(input),section,
"[DYNAMIC]",
"maxpspeed");
297 _readEntry(input,
sizeof(input),section,
"[DYNAMIC]",
"maxnspeed");
300 _readEntry(input,
sizeof(input),section,
"[DYNAMIC]",
"maxcurr");
305 _readEntry(input,
sizeof(input),section,
"[DYNAMIC]",
"maxaccel_nmp");
308 _readEntry(input,
sizeof(input),section,
"[DYNAMIC]",
"maxpspeed_nmp");
311 _readEntry(input,
sizeof(input),section,
"[DYNAMIC]",
"maxnspeed_nmp");
314 _readEntry(input,
sizeof(input),section,
"[DYNAMIC]",
"maxcurr_nmp");
325 memset(section,0,
sizeof(section));
326 sprintf(section,
"[MOT[%d]]", number);
328 _readEntry(input,
sizeof(input),section,
"[INIT]",
"encodersPerCycle");
331 _readEntry(input,
sizeof(input),section,
"[INIT]",
"encoderOffset");
334 _readEntry(input,
sizeof(input),section,
"[INIT]",
"rotationDirection");
337 _readEntry(input,
sizeof(input),section,
"[INIT]",
"angleOffset");
340 _readEntry(input,
sizeof(input),section,
"[INIT]",
"angleRange");
350 _readEntry(input,
sizeof(input),
"[KATANA]",
"[GRIPPER]",
"isPresent");
351 isPresent = strcmp(
"YES",input) ?
false :
true;
353 _readEntry(input,
sizeof(input),
"[KATANA]",
"[GRIPPER]",
"openEncoders");
354 openEncoders = atoi(input);
356 _readEntry(input,
sizeof(input),
"[KATANA]",
"[GRIPPER]",
"closeEncoders");
357 closeEncoders = atoi(input);
TMotCmdFlg mcf
motor flag after calibration
byte actcurr
actual current
char modelName[255]
model name
void _readEntry(char *dest, int destsz, const char *section, const char *subsection, const char *entry)
byte maxppwm
max. val for pos. voltage
TMotSCP getMotSCP(short number)
byte kI_speed
Integral factor of the speed compensator.
double arr_segment[4]
length of the Katana segments
short sens_count
count of sensors
byte kD
derivate factor of pos comp
[SCT] every sens ctrl's attributes
bool enable
enable/disable
Initial motor parameters.
TMotDYL getMotDYL(short number)
byte ctrlID
controller number (ID)
TSctDesc * desc
description[]
byte kD_speed
Derivative factor of the speed compensator.
CMotBase * arr
array of motors
byte maxppwm_nmp
Max. value for positive voltage (0 => 0%, +70 => 100%)
std::ifstream _configfile
TMotCLB getMotCLB(short number)
short maxnspeed
max. allowed reverse speed; pos!
TMotDesc * getMotDesc(short count)
byte maxnpwm
max. val for neg. voltage; pos!
int crash_limit_lin_nmp
Limit of error in position in linear movement.
Calibration structure for single motors.
Inverse Kinematics structure of the endeffektor.
[MOT] every motor's attributes
search direction for the meachanical stopper
byte kI_nmp
Integral factor (1/kI) of control output added to the final control output.
short maxpspeed
max. allowed forward speed
TMotInit getMotInit(short number)
short minpos
not yet active
sensor controller description (partly)
CSctBase * arr
array of sens ctrl's
[SCP] static controller parameters
TMotDesc * desc
description[]
byte maxcurr_nmp
set the maximal current
void getGripperParameters(bool &isPresent, int &openEncoders, int &closeEncoders)
int crash_limit_nmp
Limit of error in position.
short order
order in which this motor will be calibrated. range: 0..5
[GNL] general robot attributes
TSearchDir dir
search direction for mech. stopper
byte kP_speed
Proportional factor of the speed compensator.
motor description (partly)
byte maxdecel
max deceleration
TSctDesc * getSctDesc(short count)
short sens_res
resolution: 8/12 bit
byte maxaccel_nmp
Maximal acceleration and deceleration.
byte maxaccel
max acceleration
byte maxnpwm_nmp
Max. value for negative voltage (0 => 0%, +70 => 100%)
byte kP
prop. factor of pos comp
short maxpspeed_nmp
Max. allowed forward speed.
byte kpos_nmp
Proportional factor of position compensator.
short maxnspeed_nmp
Max. allowed reverse speed.
byte kspeed_nmp
Proportional factor of speed compensator.
short cnt
count of sens ctrl's