What happens is that I can upload the firmware, and the motor turns. Then I launch Studio from a conda env command line.
I can open the command line tab and connect there. I can see the serial log.
Connected ...
.0000 4.7418
2.0000 5.0000 0.0000 0.00 0.00 2.0000 4.8847
Disconnected ...
Connected ...
.0000 0.0000 0.00 0.00 2.0000 1.7826
2.0000 5.0000 0.0000 0.00 0.00 2.0000 1.9240
000 0.0000 0.00 0.00 2.0000 1.6399
2.0000 5.0000 0.0000 0.00 0.00 2.0000 1.7826
2.0000 5.0000 0.0000 0.00 0.00 2.0000 1.9240
MOT: Monitor enabled!
MOT: Init
MOT: Enable driver.
2.0000 5.0000 0.0000 0.00 0.00 2.0000 0.1325
2.0000 5.0000 0.0000 0.00 0.00 2.0000 0.2758
2.0000 5.0000 0.0000 0.00 0.00 2.0000 0.4164
But when I try the Tree View or Form View, there are no signs of life. The buttons can be clicked, and most of them react, but nothing changes with regards to the data on screen. And after I click a few things, the UI hangs.
Then I see something like this in the shell:
(simplefoc) mark@delbert:~/simplefoc/SimpleFOCStudio$ python3 simpleFOCStudio.py
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
libpng warning: iCCP: known incorrect sRGB profile
Traceback (most recent call last):
File "/home/mark/simplefoc/SimpleFOCStudio/src/simpleFOCConnector.py", line 872, in run
self.handle_received_data(reading.decode())
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 5: invalid continuation byte
Segmentation fault (core dumped)
(simplefoc) mark@delbert:~/simplefoc/SimpleFOCStudio$
(simplefoc) mark@delbert:~/simplefoc/SimpleFOCStudio$ python3 -V
Python 3.6.13 :: Anaconda, Inc.
(simplefoc) mark@delbert:~/simplefoc/SimpleFOCStudio$
I’m running this on Linux Mint, in a miniconda3 environment.
Here’s my latest version of the code. I added Serial.begin(), and some other stuff.
#include <SimpleFOC.h>
// My motor is a BDUAV-2204-260kv, a little gimbal motor.
// no encoder
// 7 pole pairs,
// phase resistance = 10 ohms
BLDCMotor motor = BLDCMotor(7, 10);
// I use a SimpleFOCShield 2.0.4
// the phase pins are on pins 9, 5, and 6
// the enable pin is 8
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8);
// InlineCurrentSensor constructor
// - shunt_resistor - shunt resistor value
// - gain - current-sense op-amp gain
// - phA - A phase adc pin
// - phB - B phase adc pin
// - phC - C phase adc pin (optional)
//InlineCurrentSense current_sense = InlineCurrentSense(0.01, 50, A2, A0);
float target_velocity = 2; // rad/s
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.scalar(&target_velocity, cmd); }
void doMotor(char* cmd) { command.motor(&motor, cmd); }
void setup(){
Serial.begin(115200);
driver.voltage_power_supply = 5;
driver.init();
// current_sense.init();
motor.linkDriver(&driver);
// motor.linkCurrentSense(¤t_sense);
motor.current_limit = 0.5;
motor.velocity_limit = 20;
motor.voltage_limit = 4;
motor.monitor_variables = _MON_CURR_D| _MON_CURR_Q | _MON_VOLT_D | _MON_VOLT_Q | _MON_TARGET | _MON_VEL | _MON_ANGLE;
motor.monitor_downsample = 100;
motor.controller = MotionControlType::velocity_openloop;
motor.foc_modulation = FOCModulationType::SpaceVectorPWM;
command.add('M', doMotor, "motor");
command.add('T', doTarget, "target velocity");
motor.useMonitoring(Serial);
motor.init();
//current_sense.gain_b *=-1;
//current_sense.skip_align = true;
//motor.initFOC();
_delay(1000);
}
void loop(){
motor.monitor();
motor.move(target_velocity);
//motor.loopFOC();
command.run();
}