RotateTowards.cpp
Go to the documentation of this file.
1#include "RotateTowards.h"
2
3#include <Eigen/Geometry>
4
5#include <SimoxUtility/math/convert/deg_to_rad.h>
6
10
12
16
18{
19
21 const NavigatingSkillHelper::Services& helperSrv,
22 const Properties& props,
23 const Services& srv) :
24 Base(helperProperties, helperSrv, DefaultSkillDescription()), srv_(srv), properties_(props)
25 {
26 }
27
28 Eigen::Isometry3f
29 RotateTowards::relativeTarget(const Base::SpecializedMainInput& in)
30 {
31 const auto robotPoseOpt =
33 ARMARX_CHECK(robotPoseOpt.has_value())
34 << "Could not get global pose for robot " << QUOTED(properties_.robotName);
35
36 const auto& robotPose = robotPoseOpt.value();
37 const auto robotPoseIsometry = Eigen::Isometry3f{robotPose};
38 auto newPose = robotPoseIsometry.inverse() *
40 robotPose.translation(), in.parameters.targetPositionGlobal)};
41
42 return newPose;
43 }
44
47 {
48 ParamType defaultParams;
49 defaultParams.navigatingSkillParams = NavigatingSkillHelper::DefaultSkillDescription();
50 defaultParams.targetPositionGlobal = Eigen::Vector3f{0.F, 0.F, 0.F};
51 defaultParams.navigatingSkillParams.globalPlanningAlgorithm =
52 arondto::GlobalPlanningAlgorithm::Point2Point;
53
55 .skillId = {.skillName = constants::skill_names::RotateTowards},
56 .description = "Rotate so that the robot is facing the specified global position",
57 .rootProfileDefaults = defaultParams.toAron(),
59 .parametersType = ParamType::ToAronType()};
60 }
61} // namespace armarx::navigation::skills
#define QUOTED(x)
static DateTime Now()
Current time on the virtual clock.
Definition Clock.cpp:93
std::optional< RobotState::Pose > queryGlobalPose(const std::string &robotName, const armem::Time &timestamp) const
static Duration Minutes(std::int64_t minutes)
Constructs a duration in minutes.
Definition Duration.cpp:96
static arondto::NavigatingSkillParams DefaultSkillDescription()
RotateTowards(const NavigatingSkillHelper::Properties &helperProperties, const NavigatingSkillHelper::Services &helperSrv, const Properties &props, const Services &srv)
static armarx::skills::SkillDescription DefaultSkillDescription()
NavigateRelativeSkill< arondto::RotateTowardsParams > Base
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
Eigen::Matrix4f getRobotPoseAtXOrientedTowardsY(const Eigen::Vector3f &x, const Eigen::Vector3f &y)
Definition util.cpp:97
armem::robot_state::VirtualRobotReader & robotReader