29 #include <VirtualRobot/IK/GenericIKSolver.h>
35 #include <RobotAPI/interface/core/RobotState.h>
36 #include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
39 #include <RobotComponents/interface/components/RobotIK.h>
52 defineRequiredProperty<std::string>(
53 "RobotFileName",
"Filename of VirtualRobot robot model (e.g. robot_model.xml)");
55 defineOptionalProperty<std::string>(
56 "RobotStateComponentName",
57 "RobotStateComponent",
58 "Name of the robot state component that should be used");
59 defineOptionalProperty<std::string>(
"ReachabilitySpacesFolder",
60 "Path to a folder containing reachability spaces");
61 defineOptionalProperty<int>(
62 "NumIKTrials", 10,
"Number of trials to find an ik solution");
63 defineOptionalProperty<std::string>(
64 "InitialReachabilitySpaces",
66 "Reachability spaces to load initially (semi-colon separated)");
127 virtual public RobotIKInterface
133 virtual std::string getRobotFilename(
const Ice::Current&)
const;
159 NameValueMap computeIKFramedPose(
const std::string& robotNodeSetName,
160 const FramedPoseBasePtr& tcpPose,
162 const Ice::Current& = Ice::emptyCurrent)
override;
176 NameValueMap computeIKGlobalPose(
const std::string& robotNodeSetName,
177 const PoseBasePtr& tcpPose,
179 const Ice::Current& = Ice::emptyCurrent)
override;
194 computeExtendedIKGlobalPose(
const std::string& robotNodeSetName,
195 const PoseBasePtr& tcpPose,
197 const Ice::Current& = Ice::emptyCurrent)
override;
210 NameValueMap computeCoMIK(
const std::string& robotNodeSetJoints,
211 const CoMIKDescriptor& desc,
212 const Ice::Current& = Ice::emptyCurrent)
override;
237 NameValueMap computeHierarchicalDeltaIK(
const std::string& robotNodeSet,
238 const IKTasks& iktasks,
239 const CoMIKDescriptor& comIK,
241 bool avoidJointLimits,
242 bool enableCenterOfMass,
243 const Ice::Current& = Ice::emptyCurrent)
override;
265 bool createReachabilitySpace(
const std::string& chainName,
266 const std::string& coordinateSystem,
267 float stepTranslation,
269 const WorkspaceBounds& minBounds,
270 const WorkspaceBounds& maxBounds,
272 const Ice::Current& = Ice::emptyCurrent)
override;
285 bool defineRobotNodeSet(
const std::string& name,
286 const NodeNameList& nodes,
287 const std::string& tcpName,
288 const std::string& rootNode,
289 const Ice::Current& = Ice::emptyCurrent)
override;
298 bool hasReachabilitySpace(
const std::string& chainName,
299 const Ice::Current& = Ice::emptyCurrent)
const override;
315 bool isFramedPoseReachable(
const std::string& chainName,
316 const FramedPoseBasePtr& tcpPose,
317 const Ice::Current& = Ice::emptyCurrent)
const override;
332 bool isPoseReachable(
const std::string& chainName,
333 const PoseBasePtr& tcpPose,
334 const Ice::Current& = Ice::emptyCurrent)
const override;
346 bool loadReachabilitySpace(
const std::string&
filename,
347 const Ice::Current& = Ice::emptyCurrent)
override;
358 bool saveReachabilitySpace(
const std::string& robotNodeSet,
360 const Ice::Current& = Ice::emptyCurrent)
const override;
368 void onInitComponent()
override;
369 void onConnectComponent()
override;
370 void onDisconnectComponent()
override;
375 VirtualRobot::RobotNodeSetPtr nodeSet);
376 void computeIK(
const std::string& robotNodeSetName,
381 void computeIK(VirtualRobot::RobotNodeSetPtr nodeSet,
386 void computeIK(
const std::string& robotNodeSetName,
389 ExtendedIKResult& iksolution);
391 void computeIK(VirtualRobot::RobotNodeSetPtr nodeSet,
394 ExtendedIKResult& iksolution);
397 Eigen::Matrix4f toReachabilityMapFrame(
const FramedPoseBasePtr& tcpPose,
398 const std::string& chainName)
const;
400 bool isReachable(
const std::string& setName,
const Eigen::Matrix4f& tcpPose)
const;
405 VirtualRobot::JacobiProvider::InverseJacobiMethod
406 convertInverseJacobiMethod(armarx::InverseJacobiMethod aenum)
const;
408 void synchRobot()
const;
413 mutable std::recursive_mutex _modifyRobotModelMutex;
416 mutable std::recursive_mutex _editRobotNodeSetsMutex;
418 mutable std::recursive_mutex _accessReachabilityCacheMutex;
421 std::string _robotFile;
427 using ReachabilityCacheType =
428 std::map<std::string, VirtualRobot::WorkspaceRepresentationPtr>;
429 ReachabilityCacheType _reachabilities;