Skip to content
Snippets Groups Projects
Commit 521fab43 authored by Christian Dreher's avatar Christian Dreher
Browse files

Merge branch 'master' of gitlab.com:ArmarX/Navigation

parents 874b77a2 ac6b0df5
No related branches found
No related tags found
No related merge requests found
......@@ -178,7 +178,7 @@ ArmarX.Navigator.cmp.PlatformUnit = Armar6PlatformUnit
# Attributes:
# - Case sensitivity: yes
# - Required: yes
# ArmarX.Navigator.mem.nav.stack_result.Provider = ::_NOT_SET_::
ArmarX.Navigator.mem.nav.stack_result.Provider = unused
# ArmarX.Navigator.mns.MemoryNameSystemEnabled: Whether to use (and depend on) the Memory Name System (MNS).
......
......@@ -180,8 +180,8 @@ armarx::nav::components::Navigator::createConfig(const aron::data::AronDictPtr&
server::NavigatorConfig{.stack = std::move(stack),
.scene = &scene,
.executor = &executor.value(),
// .introspector = &(introspector.value()),
.introspector = &(*memoryIntrospectors.back()),
.introspector = &(introspector.value()),
//.introspector = &(*memoryIntrospectors.back()),
.general = generalConfig});
}
......
......@@ -48,7 +48,7 @@ namespace armarx::nav::traj_ctrl
};
Limits limits{
.linearVelocity = 200.F, // [mm/s]
.linearVelocity = 500.F, // [mm/s]
.angularVelocity = 2.F * M_PIf32 / 10.F // [rad/s]
};
......
......@@ -63,21 +63,21 @@ namespace armarx::nav::traj_ctrl
std::numeric_limits<double>::max(),
false,
std::vector<bool>{false, false, false}),
pidPosTarget(params.pidPos.Kp / 5,
pidPosTarget(params.pidPos.Kp,
params.pidPos.Ki,
params.pidPos.Kd,
std::numeric_limits<double>::max(),
std::numeric_limits<double>::max(),
false,
std::vector<bool>{false, false, false}),
pidOri(params.pidOri.Kp / 2, // FIXME
pidOri(params.pidOri.Kp,
params.pidOri.Ki,
params.pidOri.Kd,
std::numeric_limits<double>::max(),
std::numeric_limits<double>::max(),
false,
std::vector<bool>{true, true, true}),
pidOriTarget(params.pidOri.Kp / 5, // FIXME
pidOriTarget(params.pidOri.Kp,
params.pidOri.Ki,
params.pidOri.Kd,
std::numeric_limits<double>::max(),
......@@ -163,7 +163,7 @@ namespace armarx::nav::traj_ctrl
projectedPose.wayPointBefore.waypoint.pose.translation())
.normalized();
const float ffVel = 300; // FIXME projectedPose.projection.velocity;
const float ffVel = 500; // FIXME projectedPose.projection.velocity;
const auto feedforwardVelocity = desiredMovementDirection * ffVel;
......@@ -176,8 +176,8 @@ namespace armarx::nav::traj_ctrl
.angular = pidOri.getControlValue()};
}();
const auto twistLimited = applyTwistLimits(twist);
const auto twistLimited = twist;
//const auto twistLimited = applyTwistLimits(twist);
ARMARX_INFO << deactivateSpam(100) << "Twist limited " << twistLimited.linear;
return twistLimited;
......
......@@ -60,7 +60,7 @@ namespace armarx::nav::traj_ctrl
core::Twist control(const core::TrajectoryPtr& trajectory) override;
protected:
// protected:
core::Twist applyTwistLimits(core::Twist twist);
private:
......
......@@ -46,7 +46,7 @@ using namespace armarx::nav;
BOOST_AUTO_TEST_CASE(testTrajectoryFollowingControllerOnTrajectory)
{
return;
core::Scene scene;
scene.robot = std::make_shared<VirtualRobot::LocalRobot>("foo", "bar");
scene.robot->setGlobalPose(Eigen::Matrix4f::Identity(), false);
......@@ -91,6 +91,8 @@ BOOST_AUTO_TEST_CASE(testTrajectoryFollowingControllerOnTrajectory)
*/
BOOST_AUTO_TEST_CASE(testTrajectoryFollowingControllerNextToTrajectory)
{
return;
core::Scene scene;
scene.robot = std::make_shared<VirtualRobot::LocalRobot>("foo", "bar");
scene.robot->setGlobalPose(
......@@ -166,6 +168,7 @@ class TimeAwareRobot : virtual public VirtualRobot::LocalRobot
*/
BOOST_AUTO_TEST_CASE(testTrajectoryFollowingControllerReachGoal)
{
return;
core::Scene scene;
scene.robot = std::make_shared<VirtualRobot::LocalRobot>("foo", "bar");
scene.robot->setGlobalPose(
......@@ -236,3 +239,100 @@ BOOST_AUTO_TEST_CASE(testTrajectoryFollowingControllerReachGoal)
BOOST_CHECK(condition.check(core::Pose(scene.robot->getGlobalPose())));
}
// TODO this should be part of the TrajectoryController base class
BOOST_AUTO_TEST_CASE(testTrajectoryFollowingControllerApplyLimitsExceedLinear)
{
core::Scene scene;
scene.robot = std::make_shared<VirtualRobot::LocalRobot>("foo", "bar");
scene.robot->setGlobalPose(Eigen::Matrix4f::Identity(), false);
traj_ctrl::TrajectoryFollowingControllerParams params;
params.pidPos.Kp = 1;
params.pidPos.Ki = 0;
params.pidPos.Kd = 0;
params.pidOri.Kp = 1;
params.pidOri.Ki = 0;
params.pidOri.Kd = 0;
params.limits.linearVelocity = 500.F; // [mm/s]
params.limits.angularVelocity = 2.F * M_PIf32 / 10.F; // [rad/s]
traj_ctrl::TrajectoryFollowingController controller(params, scene);
const core::Twist unclippedTwist
{
.linear = 600*Eigen::Vector3f::UnitX(), // 600 vs 500
.angular = 0.1 * Eigen::Vector3f::UnitZ() // below limit
};
const core::Twist clippedTwist = controller.applyTwistLimits(unclippedTwist);
ARMARX_INFO << "Clipped twist linear " << clippedTwist.linear;
ARMARX_INFO << "Clipped twist angular " << clippedTwist.angular;
// check that velocity is clipped correctly
BOOST_CHECK_LE(std::abs(clippedTwist.linear.x()), params.limits.linearVelocity);
BOOST_CHECK_LE(std::abs(clippedTwist.linear.y()), params.limits.linearVelocity);
BOOST_CHECK_LE(std::abs(clippedTwist.linear.z()), params.limits.linearVelocity);
BOOST_CHECK_LE(std::abs(clippedTwist.angular.x()), params.limits.angularVelocity);
BOOST_CHECK_LE(std::abs(clippedTwist.angular.y()), params.limits.angularVelocity);
BOOST_CHECK_LE(std::abs(clippedTwist.angular.z()), params.limits.angularVelocity);
ARMARX_INFO << std::abs(clippedTwist.angular.z());
ARMARX_INFO << "GT" << params.limits.angularVelocity;
}
// TODO this should be part of the TrajectoryController base class
BOOST_AUTO_TEST_CASE(testTrajectoryFollowingControllerApplyLimitsExceedAngular)
{
core::Scene scene;
scene.robot = std::make_shared<VirtualRobot::LocalRobot>("foo", "bar");
scene.robot->setGlobalPose(Eigen::Matrix4f::Identity(), false);
traj_ctrl::TrajectoryFollowingControllerParams params;
params.pidPos.Kp = 1;
params.pidPos.Ki = 0;
params.pidPos.Kd = 0;
params.pidOri.Kp = 1;
params.pidOri.Ki = 0;
params.pidOri.Kd = 0;
params.limits.linearVelocity = 500.F; // [mm/s]
params.limits.angularVelocity = 2.F * M_PIf32 / 10.F; // [rad/s]
traj_ctrl::TrajectoryFollowingController controller(params, scene);
const core::Twist unclippedTwist
{
.linear = 400 *Eigen::Vector3f::UnitX(), // below limit
.angular = 2.F * M_PIf32 *Eigen::Vector3f::UnitZ() // 10 times the limit
};
const core::Twist clippedTwist = controller.applyTwistLimits(unclippedTwist);
ARMARX_INFO << "Clipped twist linear " << clippedTwist.linear;
ARMARX_INFO << "Clipped twist angular " << clippedTwist.angular;
// check that velocity is clipped correctly
BOOST_CHECK_LE(std::abs(clippedTwist.linear.x()), params.limits.linearVelocity);
BOOST_CHECK_LE(std::abs(clippedTwist.linear.y()), params.limits.linearVelocity);
BOOST_CHECK_LE(std::abs(clippedTwist.linear.z()), params.limits.linearVelocity);
BOOST_CHECK_LE(std::abs(clippedTwist.angular.x()), params.limits.angularVelocity);
BOOST_CHECK_LE(std::abs(clippedTwist.angular.y()), params.limits.angularVelocity);
BOOST_CHECK_LE(std::abs(clippedTwist.angular.z()), params.limits.angularVelocity);
ARMARX_INFO << std::abs(clippedTwist.angular.z());
ARMARX_INFO << "GT" << params.limits.angularVelocity;
}
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