26 #include <experimental/memory>
66 const std::string& prefix,
70 prefix +
".reduceVelocity",
71 "Whether to first reduce the velocity when coming closer to an obstacle "
74 prefix +
".minDistance",
75 "The minimum distance, below which the robot will stop.");
78 prefix +
".maxDistance",
79 "The maximum distance, above which the robot will move with the maximum velocity.");
83 "A parameter to adjust how the velocity is reduced when coming closer to "
84 "an obstacle. A higher value means the robot will reduce it's speed later.")
89 "A parameter to adjust how the velocity is reduced when coming closer to an "
90 "obstacle. A higher value means the robot will reduce it's speed earlier.")
101 def->component(navigatorPrx,
"navigator");
103 def->required(properties.robotName,
"RobotName",
"Default robot name.");
105 auto optionalSubSkillID =
109 def->optional(skillID.
providerId->providerName, nameBase +
".providerName");
110 def->optional(skillID.
skillName, nameBase +
".skillName");
113 def->required(properties.safetyGuardParams.robotRadius,
114 "p.navigateToLocation.safetyGuardParams.robotRadius",
115 "The robot radius used for distance calculation to the platform.");
116 def->optional(properties.safetyGuardParams.enableHumans,
117 "p.navigateToLocation.safetyGuardParams.enableHumans",
118 "Whether to consider humans for the safety guard.");
119 def->optional(properties.safetyGuardParams.enableLaserScanners,
120 "p.navigateToLocation.safetyGuardParams.enableLaserscanners",
121 "Whether to consider laser scanners for the safety guard.");
122 def->optional(properties.safetyGuardParams.maxVelocity.linear,
123 "p.navigateToLocation.safetyGuardParams.maxVelocityLinear",
124 "The maximum linear velocity.");
125 def->optional(properties.safetyGuardParams.maxVelocity.angular,
126 "p.navigateToLocation.safetyGuardParams.maxVelocityAngular",
127 "The maximum angular velocity.");
128 defineProximityFieldParams(def,
129 "p.navigateToLocation.safetyGuardParams.humanProximityField",
130 properties.safetyGuardParams.humanProximityField);
131 defineProximityFieldParams(
133 "p.navigateToLocation.safetyGuardParams.laserScannerProximityField",
134 properties.safetyGuardParams.laserScannerProximityField);
137 optionalSubSkillID(properties.navigateToNamedLocation.subSkillIDs.navigateToLocation,
138 "p.navigateToNamedLocation.subSkillIDs.navigateToLocation");
139 optionalSubSkillID(properties.navigateToChargingStation.subSkillIDs.navigateToNamedLocation,
140 "p.navigateToChargingStation.subSkillIDs.navigateToNamedLocation");
167 addSkillFactory<skills::NavigateTo>(srv);
179 addSkillFactory<skills::NavigateToLocation>(prop, srv);
186 addSkillFactory<skills::NavigateToNamedLocation>(properties.navigateToNamedLocation,
191 addSkillFactory<skills::NavigateToChargingStation>(
192 properties.navigateToChargingStation);
196 skills::MoveXMeters::Services srv{
197 .iceNavigator = iceNavigator,
200 addSkillFactory<skills::MoveXMeters>(srv);
205 skills::RotateXDegrees::Services srv{
206 .iceNavigator = iceNavigator,
209 addSkillFactory<skills::RotateXDegrees>(srv);
214 .robotName = this->properties.robotName,
219 .robotReader = virtualRobotReaderPlugin->get(),
221 addSkillFactory<skills::MoveRelativePlanar>(properties, srv);
231 .virtualRobotReader =
232 virtualRobotReaderPlugin->get(),
233 .costmapReader = costmapReaderPlugin->get(),
234 .roomsReader = roomsReaderPlugin->get(),
237 addSkillFactory<skills::GuideHumanToRoom>(srv);
278 return Component::defaultName;
284 return Component::defaultName;
295 const auto safetyGuardParams = [
this]()
297 std::lock_guard g{safetyGuardParamsMutex};
298 return properties.safetyGuardParams;
315 grid.
add(
Label(
"Enable Humans"), {.row = row, .column = 0})
316 .add(tab.enableHumans, {.row = row++, .column = 1});
317 grid.
add(
Label(
"Enable Laserscanner"), {.row = row, .column = 0})
318 .add(tab.enableLaserScanners, {.row = row++, .column = 1});
320 grid.
add(
Label(
"Max velocity linear"), {.row = row, .column = 0})
321 .add(tab.maxVelocityLinear, {.row = row++, .column = 1});
322 grid.
add(
Label(
"Max velocity angular"), {.row = row, .column = 0})
323 .add(tab.maxVelocityAngular, {.row = row++, .column = 1});
326 tab.enableHumans.setValue(safetyGuardParams.enableHumans);
327 tab.enableLaserScanners.setValue(safetyGuardParams.enableLaserScanners);
328 tab.maxVelocityLinear.setValue(safetyGuardParams.maxVelocity.linear);
329 setSpinBox(tab.maxVelocityLinear, 0, 2000, 1, 1);
330 tab.maxVelocityAngular.setValue(safetyGuardParams.maxVelocity.angular);
331 setSpinBox(tab.maxVelocityAngular, 0, 5, 2, 0.1);
335 const auto setupProximityFieldGui =
336 [&root, &setSpinBox](RemoteGuiTab::ProximityField& field,
337 const safety_guard::ProximityFieldParams&
values,
338 const std::string& label)
342 grid.
add(
Label(
"Reduce speed"), {.row = row, .column = 0})
343 .add(field.reduceSpeed, {.row = row++, .column = 1});
344 grid.
add(
Label(
"Min distance"), {.row = row, .column = 0})
345 .add(field.minDistance, {.row = row++, .column = 1});
347 grid.
add(
Label(
"Max distance"), {.row = row, .column = 0})
348 .add(field.maxDistance, {.row = row++, .column = 1});
349 grid.
add(
Label(
"k"), {.row = row, .column = 0})
350 .add(field.k, {.row = row++, .column = 1});
351 grid.
add(
Label(
"lambda"), {.row = row, .column = 0})
352 .add(field.lambda, {.row = row++, .column = 1});
358 field.reduceSpeed.setValue(
values.reduceVelocity);
359 field.minDistance.setValue(
values.minDistance);
360 setSpinBox(field.minDistance, 0, 5000, 1, 1);
361 field.maxDistance.setValue(
values.maxDistance);
362 setSpinBox(field.maxDistance, 0, 10000, 1, 1);
363 field.k.setValue(
values.k);
364 setSpinBox(field.k, 1, 20, 2, 0.1);
365 field.lambda.setValue(
values.lambda);
366 setSpinBox(field.lambda, 1, 20, 2, 0.1);
369 setupProximityFieldGui(tab.humanProximityField,
370 safetyGuardParams.humanProximityField,
371 "Human proximity field");
373 setupProximityFieldGui(tab.laserScannerProximityField,
374 safetyGuardParams.laserScannerProximityField,
375 "LaserScanner proximity field");
377 RemoteGui_createTab(getName(), root, &tab);
381 Component::RemoteGui_update()
383 std::lock_guard g{safetyGuardParamsMutex};
385 auto& safetyGuardParams = properties.safetyGuardParams;
387 safetyGuardParams.enableHumans = tab.enableHumans.getValue();
388 safetyGuardParams.enableLaserScanners = tab.enableLaserScanners.getValue();
389 safetyGuardParams.maxVelocity.linear = tab.maxVelocityLinear.getValue();
390 safetyGuardParams.maxVelocity.angular = tab.maxVelocityAngular.getValue();
402 readProximityField(tab.humanProximityField, safetyGuardParams.humanProximityField);
403 readProximityField(tab.laserScannerProximityField,
404 safetyGuardParams.laserScannerProximityField);