From acadb40fea6b9f937365588eb8acb4c7dd8c4105 Mon Sep 17 00:00:00 2001 From: Salah Talamali Date: Wed, 25 Jul 2018 13:37:16 +0100 Subject: [PATCH 1/2] add noise only if the robot is in motion, otherwise when the robot is set to stop, it will keep moving --- .../simulator/differential_steering_default_actuator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/robots/generic/simulator/differential_steering_default_actuator.cpp b/src/plugins/robots/generic/simulator/differential_steering_default_actuator.cpp index ff6031c1..9e865ba3 100644 --- a/src/plugins/robots/generic/simulator/differential_steering_default_actuator.cpp +++ b/src/plugins/robots/generic/simulator/differential_steering_default_actuator.cpp @@ -109,8 +109,8 @@ namespace argos { /* Convert speeds in m/s */ m_fCurrentVelocity[LEFT_WHEEL] = f_left_velocity * 0.01; m_fCurrentVelocity[RIGHT_WHEEL] = f_right_velocity * 0.01; - /* Apply noise */ - if(m_pcRNG) { + /* Apply noise only if the robot is in motion (at least one of the wheels is moving)*/ + if( (m_pcRNG) && ( (f_left_velocity!=0) || (f_right_velocity!=0) ) ) { ADD_NOISE(LEFT); ADD_NOISE(RIGHT); } From 97938479301e9c24b2c265e1944c3e417b291c81 Mon Sep 17 00:00:00 2001 From: Carlo Pinciroli Date: Sun, 13 Oct 2019 06:06:23 +0800 Subject: [PATCH 2/2] Minor style change. --- .../simulator/differential_steering_default_actuator.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/robots/generic/simulator/differential_steering_default_actuator.cpp b/src/plugins/robots/generic/simulator/differential_steering_default_actuator.cpp index 2c5ae56e..4b9e38ed 100644 --- a/src/plugins/robots/generic/simulator/differential_steering_default_actuator.cpp +++ b/src/plugins/robots/generic/simulator/differential_steering_default_actuator.cpp @@ -110,7 +110,9 @@ namespace argos { m_fCurrentVelocity[LEFT_WHEEL] = f_left_velocity * 0.01; m_fCurrentVelocity[RIGHT_WHEEL] = f_right_velocity * 0.01; /* Apply noise only if the robot is in motion (at least one of the wheels is moving)*/ - if( (m_pcRNG) && ( (f_left_velocity!=0) || (f_right_velocity!=0) ) ) { + if( m_pcRNG && + ((f_left_velocity != 0) || + (f_right_velocity != 0) )) { ADD_NOISE(LEFT); ADD_NOISE(RIGHT); }