From 1163d0606d760b20dc20e7702d8cf94eab6e5f75 Mon Sep 17 00:00:00 2001 From: armar-user <armar6@kit> Date: Wed, 14 Jul 2021 16:43:22 +0200 Subject: [PATCH] (FR) ObstacleAwarePlatformUnit: ensuring that max velocities are positive --- .../ObstacleAwarePlatformUnit.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/RobotAPI/components/units/ObstacleAwarePlatformUnit/ObstacleAwarePlatformUnit.cpp b/source/RobotAPI/components/units/ObstacleAwarePlatformUnit/ObstacleAwarePlatformUnit.cpp index 2acb4a23b..fd1ee293d 100644 --- a/source/RobotAPI/components/units/ObstacleAwarePlatformUnit/ObstacleAwarePlatformUnit.cpp +++ b/source/RobotAPI/components/units/ObstacleAwarePlatformUnit/ObstacleAwarePlatformUnit.cpp @@ -230,10 +230,14 @@ armarx::ObstacleAwarePlatformUnit::moveRelative( void armarx::ObstacleAwarePlatformUnit::setMaxVelocities( - const float max_pos_vel, - const float max_rot_vel, + float max_pos_vel, + float max_rot_vel, const Ice::Current&) { + // ensure positiveness + max_pos_vel = std::max(max_pos_vel, 0.F); + max_rot_vel = std::max(max_rot_vel, 0.F); + std::scoped_lock l{m_control_data.mutex}; m_control_data.max_vel = max_pos_vel; m_control_data.max_rot_vel = max_rot_vel; -- GitLab