-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I'd like to use the calibratedSensor on a stepper motor with:
MagneticSensorSPI sensor = MagneticSensorSPI(PA8, 14, 0x3FFF);
// instantiate the calibrated sensor object
CalibratedSensor sensor_calibrated = CalibratedSensor(sensor);
StepperMotor motor = StepperMotor(50);
motor.linkSensor(&sensor_calibrated);
Currently only BLDCmotor is implemented.
I am not sure if just duplicating the code in CalibratedSensor.cpp and replacing
void CalibratedSensor::calibrate(BLDCMotor& motor){
by
void CalibratedSensor::calibrate(StepperMotor& motor){
and changing CalibratedSensor.h (add last line)
to:
#ifndef __CALIBRATEDSENSOR_H__
#define __CALIBRATEDSENSOR_H__
#include "common/base_classes/Sensor.h"
#include "BLDCMotor.h"
#include "StepperMotor.h"
#include "common/base_classes/FOCMotor.h"
class CalibratedSensor: public Sensor{
public:
// constructor of class with pointer to base class sensor and driver
CalibratedSensor(Sensor& wrapped);
~CalibratedSensor();
/*
Override the update function
*/
virtual void update() override;
/**
* Calibrate method computes the LUT for the correction
*/
virtual void calibrate(BLDCMotor& motor);
virtual void calibrate(StepperMotor& motor);
is enough. The calculations about the electrical angles are for a BLDC motor, these might not fit to a stepper motor which has 90 degrees between its poles instead of 120 degrees.
May be somebody can provide the right calculations?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request