Add more validation:
* ensure group is not empty * ensure axis group with same name is created twice * ensure group exists when adding axis
This commit is contained in:
@@ -182,8 +182,7 @@ void ecmcSS1SafetyGroup::validateCfgs() {
|
||||
}
|
||||
}
|
||||
|
||||
void ecmcSS1SafetyGroup::validateAxes() {
|
||||
|
||||
void ecmcSS1SafetyGroup::validateAxes() {
|
||||
// Ensure that axis is not linked twice to group
|
||||
for(std::vector<safetyAxis*>::iterator iaxis = axes_.begin(); iaxis != axes_.end(); ++iaxis) {
|
||||
int axisLinkedCounter = 0;
|
||||
@@ -213,11 +212,19 @@ void ecmcSS1SafetyGroup::validateAxes() {
|
||||
}
|
||||
}
|
||||
|
||||
int axisCounter = 0;
|
||||
// Check axis object exists and valid
|
||||
for(std::vector<safetyAxis*>::iterator saxis = axes_.begin(); saxis != axes_.end(); ++saxis) {
|
||||
if(!getAxisValid((*saxis)->axisId_)) {
|
||||
throw std::runtime_error( "Safety: Ecmc Axis object not valid.");
|
||||
}
|
||||
axisCounter++;
|
||||
}
|
||||
|
||||
// do not allow empty group
|
||||
if(axisCounter == 0) {
|
||||
printf("Safety %s: Error, group empty (axis count zero)\n",sName_);
|
||||
throw std::runtime_error( "Safety: Error, empty group not allowed.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user