CartesianWaypointController.h
Go to the documentation of this file.
1/*
2 * This file is part of ArmarX.
3 *
4 * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T),
5 * Karlsruhe Institute of Technology (KIT), all rights reserved.
6 *
7 * ArmarX is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * ArmarX is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * @author Raphael Grimm (raphael dot grimm at kit dot edu)
20 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21 * GNU General Public License
22 */
23
24#pragma once
25
26#include <memory>
27
28#include <Eigen/Dense>
29
30#include <VirtualRobot/VirtualRobot.h>
31
32#include <RobotAPI/interface/core/CartesianWaypointControllerConfig.h>
35
37
38namespace Eigen
39{
41}
42
43namespace armarx
44{
46 using CartesianWaypointControllerPtr = std::shared_ptr<CartesianWaypointController>;
47
49 {
50 public:
51 CartesianWaypointController(const VirtualRobot::RobotNodeSetPtr& rns,
52 const Eigen::VectorXf& currentJointVelocity,
53 float maxPositionAcceleration,
54 float maxOrientationAcceleration,
55 float maxNullspaceAcceleration,
56 const VirtualRobot::RobotNodePtr& tcp = nullptr,
57 const VirtualRobot::RobotNodePtr& referenceFrame = nullptr);
58
59
60 [[deprecated("compued null space velocity does not match pseudo inverse svd method in "
61 "simox. never use this function.")]] void
62 setCurrentJointVelocity(const Eigen::Ref<const Eigen::VectorXf>& currentJointVelocity);
63
64 const Eigen::VectorXf& calculate(float dt);
65
66 void setWaypoints(const std::vector<Eigen::Matrix4f>& waypoints);
67 void swapWaypoints(std::vector<Eigen::Matrix4f>& waypoints);
68 void addWaypoint(const Eigen::Matrix4f& waypoint);
69 void setTarget(const Eigen::Matrix4f& target);
71 void setFeedForwardVelocity(const Eigen::Vector3f& feedForwardVelocityPos,
72 const Eigen::Vector3f& feedForwardVelocityOri);
74
75 float getPositionError() const;
76
77 float getOrientationError() const;
78
79 bool isCurrentTargetReached() const;
80 bool isCurrentTargetNear() const;
81 bool isFinalTargetReached() const;
82 bool isFinalTargetNear() const;
83
84 bool isLastWaypoint() const;
85
86 const Eigen::Matrix4f& getCurrentTarget() const;
87 const Eigen::Vector3f getCurrentTargetPosition() const;
88
89 size_t skipToClosestWaypoint(float rad2mmFactor);
90
91 void setNullSpaceControl(bool enabled);
92
93 std::string getStatusText();
94
95 void setConfig(const CartesianWaypointControllerConfig& cfg);
96
99
100 std::vector<Eigen::Matrix4f> waypoints;
102
107
108 Eigen::Vector6f feedForwardVelocity = Eigen::Vector6f::Zero();
109 Eigen::Vector6f cartesianVelocity = Eigen::Vector6f::Zero();
111
112
116
117 private:
118 Eigen::VectorXf _out;
119 Eigen::VectorXf _jnv;
120 };
121} // namespace armarx
constexpr T dt
const Eigen::VectorXf & calculate(float dt)
void swapWaypoints(std::vector< Eigen::Matrix4f > &waypoints)
void setWaypoints(const std::vector< Eigen::Matrix4f > &waypoints)
const Eigen::Matrix4f & getCurrentTarget() const
void setCurrentJointVelocity(const Eigen::Ref< const Eigen::VectorXf > &currentJointVelocity)
CartesianWaypointController(const VirtualRobot::RobotNodeSetPtr &rns, const Eigen::VectorXf &currentJointVelocity, float maxPositionAcceleration, float maxOrientationAcceleration, float maxNullspaceAcceleration, const VirtualRobot::RobotNodePtr &tcp=nullptr, const VirtualRobot::RobotNodePtr &referenceFrame=nullptr)
CartesianVelocityControllerWithRamp ctrlCartesianVelWithRamps
void setTarget(const Eigen::Matrix4f &target)
const Eigen::Vector3f getCurrentTargetPosition() const
void setConfig(const CartesianWaypointControllerConfig &cfg)
void setFeedForwardVelocity(const Eigen::Vector6f &feedForwardVelocity)
void addWaypoint(const Eigen::Matrix4f &waypoint)
Matrix< float, 6, 1 > Vector6f
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::shared_ptr< CartesianWaypointController > CartesianWaypointControllerPtr