From 21381543f2dd2ee68f5dda49a8bdfe0123d0a9ec Mon Sep 17 00:00:00 2001
From: odri <odri@furano.laas.fr>
Date: Tue, 12 Apr 2022 16:21:02 +0200
Subject: [PATCH] Do not try to display solo3D data if it is disabled

---
 .../tools/LoggerControl.py                    | 21 +++++++------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/python/quadruped_reactive_walking/tools/LoggerControl.py b/python/quadruped_reactive_walking/tools/LoggerControl.py
index 08bb91e3..503987ff 100644
--- a/python/quadruped_reactive_walking/tools/LoggerControl.py
+++ b/python/quadruped_reactive_walking/tools/LoggerControl.py
@@ -380,24 +380,18 @@ class LoggerControl:
         t_range = np.array([k * self.dt for k in range(self.tstamps.shape[0])])
 
         plt.figure()
-        plt.plot(t_range, self.t_mip, "+", color="gold")
+        if self.solo3d:
+            plt.plot(t_range, self.t_mip, "+", color="gold")
         plt.plot(t_range, self.loop_t_filter, "r+")
         plt.plot(t_range, self.loop_t_planner, "g+")
         plt.plot(t_range, self.loop_t_mpc, "b+")
         plt.plot(t_range, self.loop_t_wbc, "+", color="violet")
         plt.plot(t_range, self.loop_t_loop, "k+")
         plt.plot(t_range, self.loop_t_loop_if, "+", color="rebeccapurple")
-        plt.legend(
-            [
-                "SurfacePlanner",
-                "Estimator",
-                "Planner",
-                "MPC",
-                "WBC",
-                "Control loop",
-                "Whole loop",
-            ]
-        )
+        lgd = ["Estimator", "Planner", "MPC", "WBC", "Control loop", "Whole loop"]
+        if self.solo3d:
+            lgd = ["SurfacePlanner"] + lgd
+        plt.legend(lgd)
         plt.xlabel("Time [s]")
         plt.ylabel("Time [s]")
         self.custom_suptitle("Computation time of each block")
@@ -986,7 +980,8 @@ class LoggerControl:
 
         self.plotTimes()
         self.plotMpcTime()
-        self.plotSurfacePlannerTime()
+        if self.solo3d:
+            self.plotSurfacePlannerTime()
         self.plotStepTime()
         self.plotMPCCost()
 
-- 
GitLab