Can someone show examples of the commands you can type in to do different things?

Can someone show examples of the commands you can type in to do different things?
It is never shown in any videos what is being type in in the serial monitor.

this is not useful to me because I can’t see an example and I don’t now if this works in the Arduino IDE

There was a page where it was described the commands but i think that is no more available since they are modifying the commander class. If you go into the commander.h you can find some lines with the descriptions of the commands right now implemented:

     *  - It has several paramters (the letters can be changed in the commands.h file)
     *    'Q' - Q current PID controller & LPF (see function pid and lpf for commands)
     *    'D' - D current PID controller & LPF (see function pid and lpf for commands)
     *    'V' - Velocity PID controller & LPF  (see function pid and lpf for commands)
     *    'A' - Angle PID controller & LPF     (see function pid and lpf for commands)
     *    'L' - Limits
     *           sub-commands:
     *           'C' - Current
     *           'U' - Voltage
     *           'V' - Velocity
     *    'C' - Motion control type config
     *          sub-commands:
     *          'D' - downsample motiron loop
     *          '0' - torque
     *          '1' - velocity
     *          '2' - angle
     *    'T' - Torque control type
     *          sub-commands:
     *          '0' - voltage
     *          '1' - current
     *          '2' - foc_current
     *    'E' - Motor status (enable/disable)
     *          sub-commands:
     *          '0' - enable
     *          '1' - disable
     *    'R' - Motor resistance
     *    'S' - Sensor offsets
     *          sub-commands:
     *          'M' - sensor offset
     *          'E' - sensor electrical zero
     *    'M' - Monitoring control
     *          sub-commands:
     *          'D' - downsample monitoring
     *          'C' - clear monitor
     *          'S' - set monitoring variables
     *          'G' - get variable value
     *    '' - Target setting interface 
     *         Depends of the motion control mode:
     *          - torque                          : torque (ex. M2.5) 
     *          - velocity (open and closed loop) : velocity torque (ex.M10 2.5 or M10 to only chanage the target witout limits)
     *          - angle    (open and closed loop) : angle velocity torque (ex.M3.5 10 2.5 or M3.5 to only chanage the target witout limits)
     *

so if in your main you have like this command.add('M', onMotor, "my motor"); then on the serial for example, following the command list above, you can send MC1 to set the velocity control mode and then M20 to spin the motor at 20 rad/s

The commander is very handy since you can also change for example the Torque control type on-line like MT2 (foc current) and also the PID parameters like MVP2 (it put the proportional term of the velocity PID to 2)

hope that help you!

Bye

1 Like


When I type in M20 it does nothing if I type in A120 it spins

I need actual examples not ones that I need to convert in some way before they work

Hey @ShoreyDesigns,

Welcome to the community.
Unfortunately the learning curve of the simplefoc is not as steep as we would like it to be and in some cases simplefoc is not so simple.

Here is the docs page @luzz94 was telling you about.

I know it light be intimidating to read all of these things and I agree that it is a lot of info, but for now we do not have a good video to show the commander functionalities, that is why we have tried to cover as much stuff as possible in the docs. But I agree that we need more docs and more simpler tutorials.

However it is really not easy to provide example that would work for everyone as everyone hardware components are different and everyone is looking for a different functionality.

If you give us a bit more info about your hardware setup and what are you searching to control we can give you an example code and bit more insight how to use it.

@Antun_Skuric Thank you
I am tiring to recreate your haptic control video Arduino Field Oriented Control (FOC) Haptic control example - SimpleFOCShield - YouTube

I am first working to get 1 motor and shield to work properly
I am tried to reduce the amount of variables as much as possible
standard Arduino Uno
Simple FOC shield 2.0.4

The motor link was broken on Haptics - Steer by wire | Arduino-FOC
so I went with iPower GBM4108H-120T Gimbal Motor
iPower GBM4108H-120T Gimbal Motor - RobotShop

amt 103 endoder
12v 3amp power supply

I am using the Arduino IDE just to reduce complexity