Positional control with halls

Are there any features that you would like to add to the VESC?
benjamin
Site Admin
Posts: 280
Joined: 15 Dec 2015, 08:38
Location: Sweden
Contact:

Re: Positional control with halls

Postby benjamin » 29 Feb 2016, 09:46

Nice that it works. Angle division is by how much the electrical (or encoder) angle will be divided before before being added to the angle to control. For example, if you have a 14 pole motor and set angle division to 7 (half the number of motor poles), one angle revolution will correspond to one mechanical revolution.

Currently there is a problem with angle division, which is that it is based on floating point numbers. This means that if you for example have a robot that makes similar movements all the time for thousands of cycles, the absolute angle can drift a bit. I will update the implementation to use fixed point (maybe a resolution of 1/1000000 degrees) some time. Having an angle division of 1 does not have this problem since the encoder has fixed point counts.

Is there some reason you limit the positional control of the motor to 0-360 from the panel in the tool? Can I send larger moves from the terminal window? I guess when I have more time to play with this I will be playing with applications for position control with the can bus.

The reason is that the angle wraps around at 360 degrees, and the control loop will use the shortest movement to get there. For example, if the motor is at 10 degrees and you command 350, it will rotate 20 degrees backwards. The intention is that you use separate motion control with small steps to move the angle smoothly. If you have more experience with position control and have some tips on how it should work I can update the implementation when I'm moving things to fixed point.

wdaehn
Posts: 24
Joined: 10 Feb 2016, 10:21

Re: Positional control with halls

Postby wdaehn » 29 Feb 2016, 09:54

As said in the other thread about Positional and Hall, the use case for the majority of people will be to use it as a servo motor. Not as a "clock".

In that sense the target position is the number of revolutions the motor should make, e.g. with 100 revolutions it moves 1mm forward thanks to the attached gear. Therefore hte goal would be to
a) enter the revolution count, not the degree, e.g. move to position 500mm, that is 100*500=50'000 revolutions.
b) an acceleration ramp
c) a max speed

For a clock/angle like application the power and energy consumption is way too high for even little torque, I'd argue. Show me one servo motor without a gear.
Do you concur with the use case, either as a new type of positional control or as a replacement of the current implementation?

jaroslavnovotny
Posts: 49
Joined: 16 Feb 2016, 13:10

Re: Positional control with halls

Postby jaroslavnovotny » 29 Feb 2016, 13:35

@wdaehn:

revolution count, acceleration ramp and max speed is not enough for general application. If you have more motors and you need to keep them in sync you need a control unit. Imagine 2 geared servo-motors driving wheels of a robot and you need to move on a precise bezier curve - you need to control exact position/speed every moment - some acceleration ramp is not enough. You would have to supply exact acceleration profile and prey that every VESC has the same characteristic.

One servo motor without a gear is for example a gimbal to stabilize cameras. Another example is direct-drive low kV application in robotics for locomotion.

For a clock/angle like application the power and energy consumption is way too high for even little torque, I'd argue.


Comparing geared high kV motor with low kV direct drive: the energy consumption and efficiency is way better for the direct drive - better motor efficiency and also no mechanical losses in gearbox. What the geared unit has is more available power in a smaller package (better weight/power ratio). You can get the same torque from both.

Do you concur with the use case, either as a new type of positional control or as a replacement of the current implementation?


If you have a simple application where rev count, accel and max speed is enough then what you propose will simplify things for you as the VESC will become the control unit itself. But it removes the fine precise control possible with angle control. The current implementation shouldn't be replaced.

wdaehn
Posts: 24
Joined: 10 Feb 2016, 10:21

Re: Positional control with halls

Postby wdaehn » 29 Feb 2016, 14:14

Okay, granted. Let me ask a few questions:

1. Do you need a 360° movement only? I could see two cases, the one is a robot arm with direct drive as you say. The joint needs to rotate between +-180° only. The other application would be a robot on wheels (or a skateboard) which should drive 3 revolutions forward.

2. What is the precision you expect? Down to 0.0001° likely not. It will be in the area of 1 to 0.1° I would expect is practically possible. Everything below is unrealistic. Or maybe 0.01°.

3. That geared motor versus direct drive is a difficult discussion. And likely not worth it as you either have the mechanics as direct drive or as geared motor and then you need the one or the other. The reason I said what I said is mostly because of the holding momentum. With enough reduction you can hold steady a relatively high load with almost no energy. But if there is no gear then my arguments are nil for this use case, of course. So let us ignore my arguments on that.

4. Would you benefit from accel ramps and top speeds even when the max movement is 180°? Maybe, certainly it would not hurt, right? It could avoid swinging when the speed is high an so are the masses as it avoids abrupt stops.

If we all can compromise on above, we could unify both use cases in one implementation. A position value of 1000.3333 means 1000 revolutions plus 120° (=360*0.3333). So everything before the comma is the revolutions, the fraction value the fraction of 360°.

The only feature that would really prevent an unified solution is if we want the controller to decide on the shortest way like it does today - a movement of +270° is turned into a -90° movement.


Regarding the multiple motors in sync and complex patterns, yes, that is beyond the feature scope. But when I think about my CableCam, an e-skateboard, an RC car,.... they all have a single drive motor only. My point is, there are a lot of use cases where positional control with ramps would help.

Thoughts?

jaroslavnovotny
Posts: 49
Joined: 16 Feb 2016, 13:10

Re: Positional control with halls

Postby jaroslavnovotny » 29 Feb 2016, 22:52

1. 360° angle control is enough for all use cases when the motion is driven externally realtime (realtime actually means faster than the motor spins 180°). The control unit reads an encoder (VESC reads it and also sends it to controller) and the control unit sends position updates at for example 1kHz (depends on motor speed) to the VESC which tries to reach that position. Before the position is reached another update is send. There is no need to send a position update bigger than 180° because the updates are frequent. You could drive many revolutions like this - for example turn the motor 1080° with variable speed profile.

Driving like this has the advantage of continuous control - you can decide to stop the motor when you want, you can synchronize multiple motors etc. On the other hand if you send a command to turn many turns with accel ramp and max speed then you have no control until that command is executed.

2. This depends mostly on encoder resolution which is mostly common at 4096 pulses per 360° - so the resolution is usually 0,09°.

3. Yes I agree - a small motor with enough gearing can hold high load easily. To hold easily this load (with same current consumption) a big diameter high-number of coils direct drive motor would have to be used which is a lot bigger package.

4. In the angle control scenario there is a PID control loop inside VESC with adjustable parameters so you can tune the motor response behaviour for a angle command. High inertia rotors will have different parameters than low inertia ones (they would overshoot the angle with wrong settings). So there is no need for ramp setting because these parameters are basically it.

I don't think the scenarios can be unified, but rather the approach you proposed added as another position control option when you don't need precise realtime control but just want to turn the motor some amount of turns. This would save your setup of that realtime control unit because basically VESC would do that functionality.

michael_wintergarden
Posts: 85
Joined: 10 Aug 2016, 16:14

Re: Positional control with halls

Postby michael_wintergarden » 08 Oct 2016, 12:16

benjamin wrote:Nice that it works. Angle division is by how much the electrical (or encoder) angle will be divided before before being added to the angle to control. For example, if you have a 14 pole motor and set angle division to 7 (half the number of motor poles), one angle revolution will correspond to one mechanical revolution.


In the code, I think it is described by these lines, right?
mcpwm_foc.c

Code: Select all

    if (m_conf->p_pid_ang_div > 0.98 && m_conf->p_pid_ang_div < 1.02) {
      m_pos_pid_now = angle_now;
   } else {
      static float angle_last = 0.0;
      float diff_f = utils_angle_difference(angle_now, angle_last);
      angle_last = angle_now;
      m_pos_pid_now += diff_f / m_conf->p_pid_ang_div;
      utils_norm_angle((float*)&m_pos_pid_now);
   }

Atrer
Posts: 2
Joined: 04 May 2017, 18:01
Location: Oregon

Re: Positional control with halls

Postby Atrer » 30 Jun 2017, 16:46

I have a BLDC motor I'm trying to do position control with but I'm having trouble figuring out how to get it set up. When I enter any position the motor will just spin. Is there any way to see what position it thinks it is? The graphs show "Current Position" changing, but the Rotor Position tab doesn't seem to do anything.

I tried changing around angle division but no luck.

Any thoughts?


Return to “Feature Requests”

Who is online

Users browsing this forum: No registered users and 1 guest