Position Control

Discussions regarding the Field Oriented Control (FOC) implementation on the VESC.
benjamin
Site Admin
Posts: 280
Joined: 15 Dec 2015, 08:38
Location: Sweden
Contact:

Position Control

Postby benjamin » 29 Dec 2015, 01:51

This is a demo of how to set up position control with sensored FOC and a pulse encoder:



Position control should be useful for robotics applications. Setting up from the default configuration is not too difficult.

joe90
Posts: 49
Joined: 15 Dec 2015, 16:52
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Position Control

Postby joe90 » 07 Jan 2016, 13:24

Thanks

Even If I dont have an application for it, it is nice to know.
Would having an encoder on a ebike would improve startup ?
I know that startup is good but is it worth to go the extra effort ?

Regards
Michel Cote
Twin v4.7 + SK3 6374 149KV
Bicycle
2500W peak/unit on 12S

benjamin
Site Admin
Posts: 280
Joined: 15 Dec 2015, 08:38
Location: Sweden
Contact:

Re: Position Control

Postby benjamin » 08 Jan 2016, 09:58


hexakopter
Posts: 86
Joined: 24 Dec 2015, 15:24
Location: Germany
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Position Control

Postby hexakopter » 16 Jan 2016, 20:22

Great video. Position control looks like a nice feature for a lot of robotic applications.
Do you have tested with what frequency one could send new positions? As you also play around with copters I saw on github and vimeo you maybe know brushless gimbals. Maybe one could use then the VESC as over powered motor driver for a fun project to show it also works with not rewinded motors. In the video it looks like you are generating a lot of torque.

erwincoumans
Posts: 25
Joined: 16 Dec 2015, 02:16
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Position Control

Postby erwincoumans » 31 Jan 2016, 16:45

I've been doing some tests using position control on VESC using FOC and quadrature encoder, over CANBUS and UART. It requires a few minor changes in hardware and software as described here: viewtopic.php?p=386#p386

I ran at around 1000 Hertz (1ms) from an Arduino. Reaching the target obviously requires the right motor and PID parameters etc.

Thorsten
Posts: 1
Joined: 05 Feb 2016, 20:05
Location: Hamburg
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Position Control

Postby Thorsten » 05 Feb 2016, 20:25

Hi,
I saw your project on hackaday today. It looks fantastic! I'm building a CNC machine and I started the construction with stepper motors. Later I started to code a servo motor controller for DC motors + optical encoders on AVR and later on a STM32F407. But I'm quite sure my controller is quite crappy compared to yours.

Is it possible to use it as a stepper controller replacement?
The normal stepper motor controllers are interfaced via a step and a direction pin.

Greetings

Thorsten

benjamin
Site Admin
Posts: 280
Joined: 15 Dec 2015, 08:38
Location: Sweden
Contact:

Re: Position Control

Postby benjamin » 05 Feb 2016, 21:16

Hi Thorsten,
More people are interested in exactly the same thing :-)
viewtopic.php?f=8&t=76

I haven't implemented something like that yet, but it should be quite easy to do. If you are already familiar with programming for the stm32f4 you can make a custom application as described in this post:
http://vedder.se/2015/08/vesc-writing-c ... lications/
You probably have to set up a pin change interrupt, as in the encoder app:
https://github.com/vedderb/bldc/blob/ma ... oder.c#L35

the encoder irq handler is in the iqr handlers file:
https://github.com/vedderb/bldc/blob/ma ... lers.c#L43
but you can just put the handler directly in your custom app.

tom frisch
Posts: 2
Joined: 08 Feb 2016, 15:40
Location: Portland
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Position Control

Postby tom frisch » 08 Feb 2016, 16:06

I'm interested in using VESC for motion control, but want it to run at a much higher refresh rate like 20k or higher (so it's not so noisy to humans). Is this possible?

erwincoumans
Posts: 25
Joined: 16 Dec 2015, 02:16
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Re: Position Control

Postby erwincoumans » 08 Feb 2016, 18:23

What is the frequency of the PID control loop in VESC at the moment? Is there a way to increase/decrease this frequency?

benjamin
Site Admin
Posts: 280
Joined: 15 Dec 2015, 08:38
Location: Sweden
Contact:

Re: Position Control

Postby benjamin » 09 Feb 2016, 08:28

The PID frequency is half of the switching frequency, so if you set it to 40 kHz it will run at 20 kHz. What makes most of the noise in the video is the current control loop, which is much faster than necessary. Setting the time constant to e.g. 2000 µS will be quieter. How fast the control loops have to be depends on the application, but fast control loops will be a bit noisy in general. With the same performance as in the video you can probably make it more or less completely quiet.


[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1236: count(): Parameter must be an array or an object that implements Countable

Return to “FOC”

Who is online

Users browsing this forum: No registered users and 3 guests