From bc0184d67e4afc9a2b1425681d9b88abb871390e Mon Sep 17 00:00:00 2001 From: Yuval Tassa Date: Fri, 3 Feb 2023 01:47:38 -0800 Subject: [PATCH] Increase precision of `simulate` sensor plot y-axis by 1 digit. - Before this change, the y-axis scale had only one digit, leading to user confusion. Small changes in senor values could appear as if the values remained at the nearest integer value, while in fact the y-axis itself was changing, but this was not evident in the GUI due to the reduced precision. - Fixes #719. PiperOrigin-RevId: 506841881 Change-Id: I583036bba389cef8d9ecf1c1bbcfb573ef2285e6 --- simulate/simulate.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/simulate/simulate.cc b/simulate/simulate.cc index 4bf4be7c..24b7ffef 100644 --- a/simulate/simulate.cc +++ b/simulate/simulate.cc @@ -376,7 +376,7 @@ void sensorinit(mj::Simulate* sim) { mju::strcpy_arr(figsensor.title, "Sensor data"); // y-tick nubmer format - mju::strcpy_arr(figsensor.yformat, "%.0f"); + mju::strcpy_arr(figsensor.yformat, "%.1f"); // grid size figsensor.gridsize[0] = 2; @@ -435,8 +435,7 @@ void sensorupdate(mj::Simulate* sim) { } // update linepnt - figsensor.linepnt[lineid] = mjMIN(mjMAXLINEPNT-1, - figsensor.linepnt[lineid]+2*dim); + figsensor.linepnt[lineid] = mjMIN(mjMAXLINEPNT-1, figsensor.linepnt[lineid]+2*dim); } }