Skip to content
Snippets Groups Projects
Commit 04528ae6 authored by Patrick Dormanns's avatar Patrick Dormanns
Browse files

use armarx::FramedPosition for target

parent 9846e1e3
No related branches found
No related tags found
1 merge request!53Implement 'PointAt'-skill
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<AronTypeDefinition> <AronTypeDefinition>
<AronIncludes> <AronIncludes>
<Include include="RobotAPI/libraries/aron/common/aron/framed.xml" />
<Include include="armarx/control/pointing/aron/Side.xml" /> <Include include="armarx/control/pointing/aron/Side.xml" />
</AronIncludes> </AronIncludes>
...@@ -15,14 +16,9 @@ ...@@ -15,14 +16,9 @@
<::armarx::control::pointing::arondto::Side /> <::armarx::control::pointing::arondto::Side />
</ObjectChild> </ObjectChild>
<!-- Name of the robot node relative to whose frame 'framedTarget' is given --> <!-- Position to point at -->
<ObjectChild key="frame"> <ObjectChild key="target">
<string /> <armarx::arondto::FramedPosition />
</ObjectChild>
<!-- Position to point at in frame 'frame' -->
<ObjectChild key="framedTarget">
<position />
</ObjectChild> </ObjectChild>
<!-- Name of the hand preshape to use. If none is provided, the hand will be <!-- Name of the hand preshape to use. If none is provided, the hand will be
......
...@@ -22,14 +22,14 @@ namespace armarx::control::pointing::core ...@@ -22,14 +22,14 @@ namespace armarx::control::pointing::core
aborted = false; aborted = false;
ARMARX_INFO << "Pointing with " << ((params.side == Side::LEFT) ? "left" : "right") ARMARX_INFO << "Pointing with " << ((params.side == Side::LEFT) ? "left" : "right")
<< " arm at " << params.framedTarget << " in frame '" << params.frame << "'" << " arm at " << params.target
<< (params.handShape ? " with hand shape '" + *params.handShape + "'" : ""); << (params.handShape ? " with hand shape '" + *params.handShape + "'" : "");
remote_.trajectoryPlayer->stopTrajectoryPlayer(); remote_.trajectoryPlayer->stopTrajectoryPlayer();
VirtualRobot::RobotPtr robot = getRobot(); VirtualRobot::RobotPtr robot = getRobot();
auto target = PositionInGlobalFrame(robot, params.frame, params.framedTarget); Eigen::Vector3f target = params.target.toGlobalEigen(robot);
visualizeTarget(target); visualizeTarget(target);
armarx::TrajectoryPtr traj = computTrajectory(robot, params.side, target); armarx::TrajectoryPtr traj = computTrajectory(robot, params.side, target);
...@@ -184,18 +184,4 @@ namespace armarx::control::pointing::core ...@@ -184,18 +184,4 @@ namespace armarx::control::pointing::core
return shape->getRobotNodeJointValueMap(); return shape->getRobotNodeJointValueMap();
} }
Eigen::Vector3f
Pointing::PositionInGlobalFrame(VirtualRobot::RobotPtr robot,
const std::string& frame,
const Eigen::Vector3f& framedPosition)
{
auto node = robot->getRobotNode(frame);
if (not node)
{
ARMARX_ERROR << "Robot '" << robot->getName() << "' has no node '" << frame << "'";
throw PointingFailedException();
}
return node->toGlobalCoordinateSystemVec(framedPosition);
}
} // namespace armarx::control::pointing::core } // namespace armarx::control::pointing::core
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include <RobotAPI/components/ArViz/Client/Client.h> #include <RobotAPI/components/ArViz/Client/Client.h>
#include <RobotAPI/interface/components/TrajectoryPlayerInterface.h> #include <RobotAPI/interface/components/TrajectoryPlayerInterface.h>
#include <RobotAPI/libraries/armem/client/MemoryNameSystem.h> #include <RobotAPI/libraries/armem/client/MemoryNameSystem.h>
#include <RobotAPI/libraries/core/FramedPose.h>
#include <RobotAPI/libraries/core/Trajectory.h> #include <RobotAPI/libraries/core/Trajectory.h>
#include "Side.h" #include "Side.h"
...@@ -36,11 +37,8 @@ namespace armarx::control::pointing::core ...@@ -36,11 +37,8 @@ namespace armarx::control::pointing::core
/** Side of the arm to point with. */ /** Side of the arm to point with. */
Side side; Side side;
/** Name of the robot node relative to whose frame @ref framedTarget is given. */ /** Position to point at. */
std::string frame; armarx::FramedPosition target;
/** Position to point at in frame @ref frame. */
Eigen::Vector3f framedTarget;
/** Name of the hand preshape to use. If none is provided, the hand will be ignored. */ /** Name of the hand preshape to use. If none is provided, the hand will be ignored. */
std::optional<std::string> handShape; std::optional<std::string> handShape;
...@@ -105,14 +103,9 @@ namespace armarx::control::pointing::core ...@@ -105,14 +103,9 @@ namespace armarx::control::pointing::core
void playTrajectory(armarx::TrajectoryPtr traj); void playTrajectory(armarx::TrajectoryPtr traj);
static Eigen::Vector3f PositionInGlobalFrame(VirtualRobot::RobotPtr robot,
const std::string& frame,
const Eigen::Vector3f& framedTarget);
static std::map<std::string, float> static std::map<std::string, float>
GetShapeJointValues(VirtualRobot::RobotPtr robot, Side side, const std::string& shapeName); GetShapeJointValues(VirtualRobot::RobotPtr robot, Side side, const std::string& shapeName);
private: private:
Remote remote_; Remote remote_;
std::atomic_bool aborted; std::atomic_bool aborted;
......
...@@ -12,7 +12,7 @@ namespace armarx::control::pointing::skills ...@@ -12,7 +12,7 @@ namespace armarx::control::pointing::skills
{ {
ParamType defaultParams; ParamType defaultParams;
defaultParams.side = core::Side::RIGHT; defaultParams.side = core::Side::RIGHT;
defaultParams.frame = "root"; defaultParams.target.header.frame = armarx::GlobalFrame;
defaultParams.handShape = std::make_optional("Pointing"); defaultParams.handShape = std::make_optional("Pointing");
defaultParams.maxVelocity = 0.4; defaultParams.maxVelocity = 0.4;
defaultParams.maxAcceleration = 0.3; defaultParams.maxAcceleration = 0.3;
......
...@@ -26,8 +26,7 @@ namespace armarx::control::pointing ...@@ -26,8 +26,7 @@ namespace armarx::control::pointing
skills::fromAron(const arondto::PointAtParams& dto, core::Pointing::Parameters& bo) skills::fromAron(const arondto::PointAtParams& dto, core::Pointing::Parameters& bo)
{ {
fromAron(dto.side, bo.side); fromAron(dto.side, bo.side);
armarx::aron::fromAron(dto.frame, bo.frame); armarx::aron::fromAron(dto.target, bo.target);
armarx::aron::fromAron(dto.framedTarget, bo.framedTarget);
armarx::aron::fromAron(dto.handShape, bo.handShape); armarx::aron::fromAron(dto.handShape, bo.handShape);
armarx::aron::fromAron(dto.maxVelocity, bo.maxVelocity); armarx::aron::fromAron(dto.maxVelocity, bo.maxVelocity);
armarx::aron::fromAron(dto.maxAcceleration, bo.maxAcceleration); armarx::aron::fromAron(dto.maxAcceleration, bo.maxAcceleration);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment