You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there
first Thankyou very much for your work on teensyStep and VisualTeensy
this may be related to the issue flagged by baaender
Am having freezing issues with rotate control
Which I have narrowed down to largish jumps in the speed modifier value from 1 tick interval to the next
Also the value at which this freezing occurs is not symetrical ie a jump of 0.05 in a negative direction will cause a freeze whereas a similar jump in the positive direction does not.
These values also seem to be very dependent on the acceleration and maxspindlespeed chosen
I am using a high acceleration rate as I am not using this to directly to control motors but rather to generate pulse and direction output as a result of a 3D rotation process on a previously generated pulse stream.
I am attaching a sketch that illustrates this issue as best as i can
Playing with the basespeed variable and observing the count behaviour in the console should show what I mean
tested on T3.1 & t3.5
Thanks Harry Harrison
`//this code is purely for testing purposes to check on 1for1 pulse in out
//max rates available how to ensure reliabilty of data throughput
//will eventually be embodied in a program that takes 3 pulse streams representing
//Yaw Tilt Roll perform a 3Drotion on these and then retransmit the data to the motors
// this is effectively a stabilising routine for a servo controlled camera pointing device.
// original motor signal comes from KUPER hardware which performs all smoothing scaling recording and other signal conditioning
// so no accelleration limiting required
//HOWEVER in the event of unfiltered input particularly direct input from Highcount encoders
// with very little smoothing,
// the code needs to be able to survive abrupt changes in speed/ direction without freezing
float baseSpeed = 0.024; //adjust this to see effects of instantaneous override speed change equivalent to
// double this value. Seems to work up to ).25 ie 0.5 swing equivalent to 500 count per
float ratio = 0.9;
volatile float speedmodifier = 0.005;
volatile byte state = LOW;
volatile double count = 0;
volatile double total = 0;
float a = 0.01;
constexpr unsigned recalcPeriod = 10000; //µs period for calculation of new target points.
double totalOld = 0;
double totalNew = 0;
////////////////////////////////Functions definition///////////////////////////////////////////////
void blink();
void tickRoutine();
void Tick();
void ConsolePrint();
////////////////////////////////Functions///////////////////////////////////////////////
void blink()
{
state = !state;
digitalWriteFast(13, !digitalReadFast(13));
}
void TickRoutine()
{
if (TickFlag == true)
{
TickFlag = false;
Counter++;
speedmodifier = baseSpeed;
controller.overrideSpeed(speedmodifier);
motorPosnOld = motorPosn;
motorPosn = motor.getPosition();
motorDelta = motorPosnOld - motorPosn;
if (Counter > 300)
{
baseSpeed = -baseSpeed;
blink();
Counter = 0;
}
}
}
void tick()
{ //isr function to sevice interval timer
TickFlag = true;
digitalWriteFast(23, !digitalReadFast(23)); //write interval time to pin 23 for logic analyzer
digitalWriteFast(LED_BUILTIN, !digitalReadFast(LED_BUILTIN));
}
void consolePrint()
{ // utility to print to console
t = int(millis());
t = t / 100;
if (t > t_old)
{
Serial.print("MotorPosn ");
Serial.println(motor.getPosition());
Serial.print("speedModifier ");
Serial.println((speedmodifier));
if (motor.getPosition() > MaxVal)
{
MaxVal = motor.getPosition();
}
Serial.print("MaxVal");
Serial.println(MaxVal);
Serial.print("motorDelta ");
Serial.println(motorDelta);
}
}
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
pinMode(23, OUTPUT);
pinMode(22, OUTPUT);
pinMode(21, OUTPUT);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(A14, INPUT);
Serial.begin(115200); //use fastest baud rate for SERIAL MONITOR
while (!Serial)
{
/* do nothing */
}
Serial.flush();
tickTimer.begin(tick, recalcPeriod); //10 millisecs
motor
.setMaxSpeed(maxSpindleSpeed)
.setAcceleration(5000000)
.setPosition(0); // set start position of counter
motor.setPullInOutSpeed(5000, 5000);
controller.rotateAsync(motor); // let the motor run with constant speed
controller.overrideSpeed(0); // start with stopped motor
tickTimer.priority(128); // lowest priority, potentially long caclulations need to be interruptable by TeensyStep
//attachInterrupt(digitalPinToInterrupt(22), stepP, RISING);
Hi there
first Thankyou very much for your work on teensyStep and VisualTeensy
this may be related to the issue flagged by baaender
Am having freezing issues with rotate control
Which I have narrowed down to largish jumps in the speed modifier value from 1 tick interval to the next
Also the value at which this freezing occurs is not symetrical ie a jump of 0.05 in a negative direction will cause a freeze whereas a similar jump in the positive direction does not.
These values also seem to be very dependent on the acceleration and maxspindlespeed chosen
I am using a high acceleration rate as I am not using this to directly to control motors but rather to generate pulse and direction output as a result of a 3D rotation process on a previously generated pulse stream.
I am attaching a sketch that illustrates this issue as best as i can
Playing with the basespeed variable and observing the count behaviour in the console should show what I mean
tested on T3.1 & t3.5
Thanks Harry Harrison
`//this code is purely for testing purposes to check on 1for1 pulse in out
//max rates available how to ensure reliabilty of data throughput
//will eventually be embodied in a program that takes 3 pulse streams representing
//Yaw Tilt Roll perform a 3Drotion on these and then retransmit the data to the motors
// this is effectively a stabilising routine for a servo controlled camera pointing device.
// original motor signal comes from KUPER hardware which performs all smoothing scaling recording and other signal conditioning
// so no accelleration limiting required
//HOWEVER in the event of unfiltered input particularly direct input from Highcount encoders
// with very little smoothing,
// the code needs to be able to survive abrupt changes in speed/ direction without freezing
//As set up
#include <Arduino.h>
#include <QuadDecode_def.h>
#include <teensystep.h>
int t;
int t_old;
volatile bool TickFlag = false;
double motorPosn;
double motorPosnOld;
double motorDelta = 0;
constexpr unsigned maxSpindleSpeed = 100'000;
constexpr unsigned spindleStepPin = 22;
constexpr unsigned spindleDirPin = 21;
constexpr unsigned AnalogIn = A14;
int sensorValue = 0;
int Counter = 0;
double MaxVal;
RotateControl controller;
Stepper motor(spindleStepPin, spindleDirPin);
IntervalTimer tickTimer;
float baseSpeed = 0.024; //adjust this to see effects of instantaneous override speed change equivalent to
// double this value. Seems to work up to ).25 ie 0.5 swing equivalent to 500 count per
float ratio = 0.9;
volatile float speedmodifier = 0.005;
volatile byte state = LOW;
volatile double count = 0;
volatile double total = 0;
float a = 0.01;
constexpr unsigned recalcPeriod = 10000; //µs period for calculation of new target points.
double totalOld = 0;
double totalNew = 0;
////////////////////////////////Functions definition///////////////////////////////////////////////
void blink();
void tickRoutine();
void Tick();
void ConsolePrint();
////////////////////////////////Functions///////////////////////////////////////////////
void blink()
{
state = !state;
digitalWriteFast(13, !digitalReadFast(13));
}
void TickRoutine()
{
if (TickFlag == true)
{
TickFlag = false;
Counter++;
speedmodifier = baseSpeed;
controller.overrideSpeed(speedmodifier);
motorPosnOld = motorPosn;
motorPosn = motor.getPosition();
motorDelta = motorPosnOld - motorPosn;
if (Counter > 300)
{
baseSpeed = -baseSpeed;
blink();
Counter = 0;
}
}
}
void tick()
{ //isr function to sevice interval timer
TickFlag = true;
digitalWriteFast(23, !digitalReadFast(23)); //write interval time to pin 23 for logic analyzer
digitalWriteFast(LED_BUILTIN, !digitalReadFast(LED_BUILTIN));
}
void consolePrint()
{ // utility to print to console
t = int(millis());
t = t / 100;
if (t > t_old)
{
Serial.print("MotorPosn ");
Serial.println(motor.getPosition());
Serial.print("speedModifier ");
Serial.println((speedmodifier));
if (motor.getPosition() > MaxVal)
{
MaxVal = motor.getPosition();
}
Serial.print("MaxVal");
Serial.println(MaxVal);
Serial.print("motorDelta ");
Serial.println(motorDelta);
}
}
//////////////////////////////////////////////End Functions////////////////////////////////////////////////
////////////////////////////Program setup------------------------------------------------------------
/////////////////////////////Program setup------------------------------------------------------------
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
pinMode(23, OUTPUT);
pinMode(22, OUTPUT);
pinMode(21, OUTPUT);
pinMode(3, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(A14, INPUT);
Serial.begin(115200); //use fastest baud rate for SERIAL MONITOR
while (!Serial)
{
/* do nothing */
}
Serial.flush();
}
////////////////////////////////////Program loop-------------------------------------------
void loop()
{
//speedmodifier= ReadPot();
TickRoutine();
consolePrint();
}`
The text was updated successfully, but these errors were encountered: