29 #include <Eigen/Geometry>
32 #include <IceUtil/Time.h>
35 #include <VirtualRobot/Nodes/RobotNode.h>
43 DynamicPlatformObstacleAvoidance::SubClassRegistry
45 DynamicPlatformObstacleAvoidance::GetName(),
60 ARMARX_VERBOSE <<
"Starting platform movement towards target position.";
68 PlatformUnitInterfacePrx platform = getPlatformUnit2();
72 if (in.isGoalNameSet())
74 ARMARX_WARNING <<
"Property `GoalName` with value `" << in.getGoalName()
75 <<
"` is deprecated and will be ignored! Unset this property and use `GoalPose` instead. ";
79 const Eigen::Vector3f target_pose = in.getGoalPose()->toEigen();
80 const std::vector<ObstacleAvoidingPlatformUnitHelper::Target> waypoints = [&]
82 std::vector<ObstacleAvoidingPlatformUnitHelper::Target> waypoints;
84 if (in.isWaypointsPoseListSet())
86 const std::vector<armarx::Vector3Ptr> waypoints_eigen = in.getWaypointsPoseList();
87 waypoints.reserve(waypoints_eigen.size());
89 std::back_inserter(waypoints),
92 const Eigen::Vector3f v = av->toEigen();
93 return ObstacleAvoidingPlatformUnitHelper::Target{v.head<2>(), v[2]};
99 const Eigen::Vector2f target_pos = target_pose.head<2>();
100 const float target_ori = target_pose(2);
115 platform_ctrl.setMaxVelocities(in.getMaxVelocity(), in.getMaxAngularVelocity());
116 platform_ctrl.setWaypoints(waypoints);
117 platform_ctrl.addWaypoint(target_pos, target_ori);
119 CycleUtil cycle{IceUtil::Time::milliSeconds(10)};
120 while (not isRunningTaskStopped() and not platform_ctrl.isFinalTargetReached())
123 platform_ctrl.update();
124 cycle.waitForCycleDuration();
128 platform->stopPlatform();
134 platform_ctrl.isFinalTargetReached() ? emitSuccess() : emitFailure();
139 DynamicPlatformObstacleAvoidance::onExit()
143 PlatformUnitInterfacePrx platform = getPlatformUnit2();
144 platform->stopPlatform();