You are here

position control with gearbox

19 posts / 0 new
Last post
raess
Offline
Last seen: 2 years 7 months ago
Joined: 2018-03-22 20:10
Posts: 38
position control with gearbox

Hi,

I need some help :)

I have a 3D-printed actuator with 6:1 gearing. The position control works great, but since I gear it, I only get 60 degrees range of motion. Would it be possible to control on the encoder steps? or how can I get 360 - degree motion?

btw: here is the actuator

Many thanks

Robin

arvidb
Offline
Last seen: 5 years 4 months ago
Joined: 2018-01-16 23:09
Posts: 77

You should be able to get more than 360° of motion out of your motor (to make your gear output move 360° or more) but the VESC can't handle position steps larger than 180° (I guess this is a bug in the position PID routine - it uses utils_angle_difference() to compute the error angle and that function always returns a value between -180° and +180° when I guess the error should be based on the actual multi-turn difference between set and actual position).

So if you feed the VESC multiple smaller moves, always within 180° of the current motor position, it should work. I haven't tried it, I'm only looking at the code.

Or change

	// Compute parameters
	float error = utils_angle_difference(angle_set, angle_now);

to

	// Compute parameters
	float error = angle_set - angle_now;

in mcpwm_foc.c.

Wait, maybe the encoder code doesn't keep track of multiple turns. Then the above won't work and I guess you are out of luck. sad

wdaehn
Offline
Last seen: 3 years 1 month ago
Joined: 2017-09-12 17:26
Posts: 65

We had a similar discussion in the past and the conclusion was that "Servo Control" and "Position Control" are two different things. Vesc supports Servo Control only, so an angle of 180° per call.

Roger Wolff
Offline
Last seen: 2 years 5 months ago
VESC Original
Joined: 2017-05-24 12:27
Posts: 202

"vesc supports" is a bit easy... Current vesc firmware supports... would be more accurate. 

 

What you could do is to have an "app" running that will feed the main vesc code a "carrot" position depending on the wanted multi-turn final position. The thing is that the PID loop can and should be adjusted to be able to stop in half a turn. So when you set a target that is say 100 turns away, at position 50.0 full turns you're still feeding the PID loop something like: "Please go to 50.49" which it will try to achieve with the condition that it can STOP there. What it (the PID loop) doesn't know is that once you reach 50.1 position you'll adjust the target to 50.59.....

wdaehn
Offline
Last seen: 3 years 1 month ago
Joined: 2017-09-12 17:26
Posts: 65

(Correct, yes, the firmware is the limiting factor.)

Yes of course that will work. But how would you do things like speed ramps etc? All is theoretically possible but not from a practical point of view.

And if my understanding is correct, the servo mode will not have the same torque at e.g. 1000rpms. Servo mode is forced commutation, isn't it?

 

Either way, desperately waiting for the VESC to support proper positional control including speed=0 downhill.

raess
Offline
Last seen: 2 years 7 months ago
Joined: 2018-03-22 20:10
Posts: 38

Thanks for the answer guys. We are looking on how we can update the firmware to support multi-turn position control. The current position control will not work for our use case.

We tested the Odrive position control which allows control with encoder counts:

https://www.youtube.com/watch?v=qHH8VnjDOFo

wdaehn
Offline
Last seen: 3 years 1 month ago
Joined: 2017-09-12 17:26
Posts: 65

You tested ODrive and the result was....?

raess
Offline
Last seen: 2 years 7 months ago
Joined: 2018-03-22 20:10
Posts: 38

The result was great. I can control the motor on encoder counts.

So for the AS5047P 4000 count/rev. I can send it +- 12000 counts and get 360degress on the output on the gearbox.

Lets see if we can modify the VESC firmware to have the same control function. 

raess
Offline
Last seen: 2 years 7 months ago
Joined: 2018-03-22 20:10
Posts: 38

Some more testing with odrive

raess
Offline
Last seen: 2 years 7 months ago
Joined: 2018-03-22 20:10
Posts: 38

Okej. We are working on implementing multi-turn position control for the VESC. We already got it working more or less.

Now the encoder handles multi-turn postions and we do no longer compute shorted angles , we use full revolutions.

The encoder position still remains degrees and not encoder ticks (so it remains back-compatible) with existing commands.

plot2.jpg

The vesc tool need to be modified to allow greater degress then 360 in order to control bigger degress from vesc tool interface. We are running Pyvesc for dev. 

 

 

 

 

raess
Offline
Last seen: 2 years 7 months ago
Joined: 2018-03-22 20:10
Posts: 38

So here is a quick video on the gearbox output. Using 0-2160Degress control.

raess
Offline
Last seen: 2 years 7 months ago
Joined: 2018-03-22 20:10
Posts: 38

So we need some help,  for example, how is the ERPM used in the actual foc position controller? and how could the ERPM be changed at motor running time?

raess
Offline
Last seen: 2 years 7 months ago
Joined: 2018-03-22 20:10
Posts: 38

We are working hard this weekend to implement a cascaded style position, velocity and current control loop in the VESC firmware. Now we can control multi-turn positions with speed settings. Nice!

sin_wave.jpg

raess
Offline
Last seen: 2 years 7 months ago
Joined: 2018-03-22 20:10
Posts: 38

We made a simulator for this new multi-turn cascade position control so everyone can see how this modified VESC firmware works ( http://grauonline.de/alexwww/motorsim/motorsim.html ) - Happy controlling

raess
Offline
Last seen: 2 years 7 months ago
Joined: 2018-03-22 20:10
Posts: 38

Motion testing over ROS.

 

arvidb
Offline
Last seen: 5 years 4 months ago
Joined: 2018-01-16 23:09
Posts: 77

Yeah, a cascaded controller seems like a good idea. Have you published your code somewhere? (Your site seems to be down.)

raess
Offline
Last seen: 2 years 7 months ago
Joined: 2018-03-22 20:10
Posts: 38

Yeah, my site is down at the moment. But you find the modified FW here: https://github.com/raess1/vesc-FW

Also have modified PYvesc and Ros driver under my git.

 

Cheers

Magistr1018
Offline
Last seen: 2 years 1 month ago
Joined: 2018-07-30 09:24
Posts: 2

I have a task:
I developed a gear motor, installed the encoder on the output shaft.
It turned out very compact and high-torque!
motor thickness is 20 mm, diameter 70 mm - moment 0.5 Nm.
the reduction factor is 99 and it takes up to 10 A.

I need help in compiling a project on a 15 bit encoder !!!

Schem

IanG
Offline
Last seen: 4 years 4 months ago
Joined: 2020-03-05 04:23
Posts: 7

Hi raess!

I have the same situation with you, so I really appreciate you made the VESC achieve the multi-turn. But I still have some questions. Now I am using FW4.2 and want to achieve that in FW4.2, so can you clarify more details about your codes? which and where the code are changed by your effort? THX!

IanG