From 09b8201868858dc0822aa08b5be9e7bb3e062364 Mon Sep 17 00:00:00 2001 From: Samuel Sadok Date: Fri, 23 Mar 2018 16:53:44 -0700 Subject: [PATCH] expose sensorless estimator on protocol --- Firmware/MotorControl/axis.hpp | 3 ++- Firmware/MotorControl/sensorless_estimator.hpp | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Firmware/MotorControl/axis.hpp b/Firmware/MotorControl/axis.hpp index 65ef9d97..300c7e94 100644 --- a/Firmware/MotorControl/axis.hpp +++ b/Firmware/MotorControl/axis.hpp @@ -184,7 +184,8 @@ public: ), make_protocol_object("motor", motor_.make_protocol_definitions()), make_protocol_object("controller", controller_.make_protocol_definitions()), - make_protocol_object("encoder", encoder_.make_protocol_definitions()) + make_protocol_object("encoder", encoder_.make_protocol_definitions()), + make_protocol_object("sensorless_estimator", sensorless_estimator_.make_protocol_definitions()) ); } }; diff --git a/Firmware/MotorControl/sensorless_estimator.hpp b/Firmware/MotorControl/sensorless_estimator.hpp index 569c9a09..740ae8c1 100644 --- a/Firmware/MotorControl/sensorless_estimator.hpp +++ b/Firmware/MotorControl/sensorless_estimator.hpp @@ -26,6 +26,18 @@ public: float V_alpha_beta_memory_[2] = {0.0f, 0.0f}; // [V] float pm_flux_linkage_ = 1.58e-3f; // [V / (rad/s)] { 5.51328895422 / ( * ) } bool estimator_good_ = false; + + // Communication protocol definitions + auto make_protocol_definitions() { + return make_protocol_member_list( + make_protocol_property("error", &error_), + make_protocol_property("phase", &phase_), + make_protocol_property("pll_pos", &pll_pos_), + make_protocol_property("pll_vel", &pll_vel_), + make_protocol_property("pll_kp", &pll_kp_), + make_protocol_property("pll_ki", &pll_ki_) + ); + } }; #endif /* __SENSORLESS_ESTIMATOR_HPP */