<commit_before>#ifndef YAWRATECONTROLLER_H
#define YAWRATECONTROLLER_H

#include <cstdint>
#include "ch.h"
#include "Singleton.h"

class Sample;

class YawRateController : public Singleton<YawRateController> {
  friend class Singleton<YawRateController>;
 public:
  void turnOn();
  void turnOff();
  bool isEnabled() const;

  void Reset();

  float RateCommanded() const;
  void RateCommanded(float yaw_rate);

  uint32_t RotationDir() const;
  uint32_t CurrentDir() const;
  int32_t SteerOffset() const;

  bool hasFault();

  uint32_t PWM_CCR() const;

  void Update(const Sample & s);

  static void shellcmd_(BaseSequentialStream *chp, int argc, char *argv[]);
  static void calibrateSteerEncoder_(BaseSequentialStream * chp,
                                    int argc, char * argv[]);
  static void homeFork_(BaseSequentialStream * chp, int argc, char * argv[]);

 private:
  YawRateController();

  void setCurrentDirPositive();
  void setCurrentDirNegative();
  void setCurrent(float current);

  void PWM_CCR(uint32_t ccr);
  uint32_t CurrentToCCR(float current);

  void shellcmd(BaseSequentialStream *chp, int argc, char *argv[]);

  void calibrateSteerEncoder(BaseSequentialStream * chp);
  void homeFork(BaseSequentialStream * chp);

  void SteerOffset(int32_t N);

  static CH_IRQ_HANDLER(CalibrationISR_);
  static CH_IRQ_HANDLER(homeISR_);

  int32_t offset_; /*! Calibration constant */
  bool homed_;     /*! Whether the fork has been homed */
  float u_,        /*! Applied current */
        r_,        /*! Commanded yaw rate */
        x_[5];     /*! Controller state */
};

#include "YawRateController_priv.h"

#endif // YAWRATECONTROLLER_H<commit_msg>Minor edit to YawRateController.h<commit_after>#ifndef YAWRATECONTROLLER_H
#define YAWRATECONTROLLER_H

#include <cstdint>
#include "ch.h"
#include "Singleton.h"

class Sample;

class YawRateController : public Singleton<YawRateController> {
  friend class Singleton<YawRateController>;
 public:
  void turnOn();
  void turnOff();
  bool isEnabled() const;

  void Reset();

  float RateCommanded() const;
  void RateCommanded(float yaw_rate);

  uint32_t RotationDir() const;
  uint32_t CurrentDir() const;
  int32_t SteerOffset() const;

  bool hasFault();

  uint32_t PWM_CCR() const;

  void Update(const Sample & s);

  static void shellcmd_(BaseSequentialStream *chp, int argc, char *argv[]);
  static void calibrateSteerEncoder_(BaseSequentialStream * chp,
                                    int argc, char * argv[]);
  static void homeFork_(BaseSequentialStream * chp, int argc, char * argv[]);

 private:
  YawRateController();

  void setCurrentDirPositive();
  void setCurrentDirNegative();
  void setCurrent(float current);

  void PWM_CCR(uint32_t ccr);
  uint32_t CurrentToCCR(float current);

  void shellcmd(BaseSequentialStream *chp, int argc, char *argv[]);

  void calibrateSteerEncoder(BaseSequentialStream * chp);
  void homeFork(BaseSequentialStream * chp);

  void SteerOffset(int32_t N);

  static CH_IRQ_HANDLER(CalibrationISR_);
  static CH_IRQ_HANDLER(homeISR_);

  int32_t offset_; /*! Calibration constant */
  bool homed_;     /*! Whether the fork has been homed */
  float u_,        /*! Applied torque (output) */
        r_,        /*! Commanded yaw rate (input) */
        x_[5];     /*! Controller state */
};

#include "YawRateController_priv.h"

#endif // YAWRATECONTROLLER_H
{'fraction_non_alphanumeric': 0.10471976401179942, 'fraction_numerical': 0.010029498525073746, 'mean_word_length': 4.053651266766021, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2713834', 'n_tokens_mistral': 1159, 'n_tokens_neox': 1111, 'n_words': 282}