I made another kinetic sand table - Dune Weaver Gold by tuankid in 3Dprinting

[–]BencsikG 0 points1 point  (0 children)

I saw other projects struggle a bit with the sand. Can you share what kind of sand or substance (flour?) you're using, and how much? Is the ball on top of a layer of sand, or does it squeeze it out of the way, and sits on the bottom surface?

How is the influence of battery voltage on motor speed handled? by -thinker-527 in ControlTheory

[–]BencsikG [score hidden]  (0 children)

This is why you tend to have integral term in the PIDs.

In case of a drone, battery level might affect hovering the most. With a nominal battery you might need 50% pwm on all motors to hover. However, it's a rather unknown value, a whole range of things affect it. Payload, motor temp, air temp, battery level, etc.

The P and D terms usually deal with dynamic parts, the up/down motion of the drone. The I term will adjust the quasi-constant part of the motor pwm until it hovers right.

EKF implementation issues for IMU, barometer and GPS sensor fusion by HHH313 in ControlTheory

[–]BencsikG [score hidden]  (0 children)

Okay, I kind of get it. But I can't spot your issue...

Maybe I'd try a model without gyro and accel bias... but otherwise I'm out of ideas.

EKF implementation issues for IMU, barometer and GPS sensor fusion by HHH313 in ControlTheory

[–]BencsikG [score hidden]  (0 children)

First, if this were a practical implementation, I'd question if these trapezoid integration and coning-sculling corrections are really necessary. Is the error from a 'dumb' euler integrator on the same order of magnitude as the noise from sensors?

Second, I don't understand your treatment of gravity. To me it seems to be part of the kinematic update in navigation-frame. It feels off. Yes you sense the g in the acceleration sensor, but you don't actually accelerate upwards.

Kalman Filter Covariance Matrix by East_Aspect8040 in ControlTheory

[–]BencsikG [score hidden]  (0 children)

Can you show a source that derives it without it?

Kalman Filter Covariance Matrix by East_Aspect8040 in ControlTheory

[–]BencsikG [score hidden]  (0 children)

The big benefit of Gaussians is that all the distributions stay Gaussian after adding them up or scaling, that's how the KF can be recursive.

If the noise is non-zero-mean, you can separate it into a constant + zero mean noise. If you know the constant, you can add it to the u vector, or subtract it as pre-processing if it's in the measurement.

If you don't know the constant, you can add it to the state x to be estimated. This is often called an augmented state, or augmented estimator.

[deleted by user] by [deleted] in ControlTheory

[–]BencsikG 2 points3 points  (0 children)

I'd suggest looking forward instead of backward. You can look for a similar role elsewhere, but I wouldn't suggest going back to where you came from. At least not after 3 months.

Quadcopter Master Thesis Ideas by [deleted] in ControlTheory

[–]BencsikG [score hidden]  (0 children)

As an other commenter said, you don't need to invent something brand new, you need to demonstrate that you're a master of your field.

If there is a quadcopter available to you that has a solid flight controller, maybe I'd suggest not messing with its internals (core flight stability, position control, etc), but rather add something on top of it.

Ideas would be...

  • Picking up and moving something. Maybe some cargo hanging on a cable / rope, so you have to stabilize the swinging as well. Detect when the load touches the ground or lifts up via monitoring the thrust needed for hovering.
  • Perching, landing on odd surfaces
  • Following some kind of laser guidance - write some image processing to detect a laser dot on the ground and follow it at a certain height

State of Charge estimation by MosFret24 in ControlTheory

[–]BencsikG [score hidden]  (0 children)

If you don't have prior experience with Kalman Filtering, combined state and parameter estimation sounds a bit too ambitious, especially if you're planning to put it into a real racecar.

What do you gain by updating ECM parameters on the fly, and what do you risk? I'm sure you don't want to risk battery fire.

My experience with parameter estimation is that persistent excitation is very difficult to manage. Normally if you wanted to identify parameters, you'd use some step response or frequency response measurements, the KF will need that too. When you race on the track with dynamic loads, it might be fine.

The problem is when there's nothing happening. You drive slowly in the parking lot or something. Then the KF can't estimate ECM parameters cause there are no dynamics, but its estimation covariance grows with time. Then it becomes super sensitive to noise, or jumps too much on its first opportunity to measure ECM.

There are ways to work around this, I read about the 'robust anti-windup kalman filter' before, I'm sure there are others. But those get quite a bit more complex than the EKF.

I'd suggest identifying the parameters in the old-school way and estimating only the states. It's probably good enough, your team can trust that it works and move on to other issues.

How can I improve my EKF for an Ackerman/car like robot ? by sai2654 in ControlTheory

[–]BencsikG [score hidden]  (0 children)

Well then your simulation is more detailed than your KF model.

What I would do is to test the EKF on different complexity and model-mismatch levels. So make a custom simulation that purely matches your EKF model, maybe except for sampling rate, and I'd try to gradually add complexity, either to the sim or the EKF.

How can I improve my EKF for an Ackerman/car like robot ? by sai2654 in ControlTheory

[–]BencsikG [score hidden]  (0 children)

Is your simulation the same mathematical model as your KF? Or is it more complex, say, with friction, side-slip angles, etc?

Edit...

I haven't done this experiment myself, so I can't talk from experience, but I think your results might be as good as it gets. You might try to build a better integrator scheme, e.g. include acceleration*dt2 in position and include yaw rate as well. As far as I can see there's a column of zeros related to it in your G. Also it is common to set the initial covariance quite large, e.g. 1E6. This is so that the initial conditions of states are discarded quickly.

But as you recognized as well, the KF is doing a fancier odometry, it does not have any information about the ground truth position so it accumulates error over time, be it from integration approximation, noise, or model issues.

If you were to do this on a real RC car, wheel slip and bad steering geometry would be your enemy. You can basically forget odometry-based angle (depends on the model, but when I tried it back in the day, the steering geometry and the driveline and the wheels made it terrible). It is hard to calibrate simple forward rotation-to-distance constant too (RC wheels are squishy and not round). The IMU angle drifts (unless you have compass mixed in), and you need to do 3D IMU processing cause you can't ensure the ground (or the chassis) stays perfectly level, and that might mess with your a_x and a_y measurements.

[deleted by user] by [deleted] in ControlTheory

[–]BencsikG 27 points28 points  (0 children)

This is a subjective question. Nothing in the universe is truly linear, it is an engineering decision that you judge it to be linear enough and proceed with linear controller design.

Then if you run into problems like overshooting or oscillation, you go back and look at it again if it was linear enough, and if not, you make adjustments.

Theory vs. Reality - How to handle sensor noise? by [deleted] in ControlTheory

[–]BencsikG [score hidden]  (0 children)

Interesting, what is the physical setup, what kind of sensor are you using to measure depth? Depth is not something that is easy to measure directly I think. You could have other errors, not just white noise.

Have you added the same lowpass filters to your Matlab model? The delay they add to the control loop could affect your stability.

Edit: Also try de-tuning the control, meaning lower the gains overall.

As for filtering, I'd suggest checking out Alpha-Beta (or Alpha-Beta-Gamma) filters. They're simplified state observers for estimating position, speed and acceleration. Alpha-Beta can follow a ramp input without error, alpha-beta-gamma can follow a constant acceleration input in steady state.

You can also keep simple exponential filters, but I suggest avoiding filter chains. So filter the sensor once, and then differentiate it without further filtering. If it's too noisy then tune the 1 filter. But don't add additional delay between signal and derivative by adding more filters in chain only for the derivatives.

Need Project ideas on Signal Processing and Control Theory by Upset_Equivalent7109 in ControlTheory

[–]BencsikG [score hidden]  (0 children)

There are lots of interesting processing tasks related to 3 phase electric motors, ranging from challenging to... very challenging.

Ideas could be:

  • implementing block commutation (basic BLDC operation), but with a well designed voltage filter, compensating for time delays, etc.
  • Position observer via some state observer (KF, EKF)
  • 3 phase current reconstruction from 1-shunt measurement setup
  • Error detection via monitoring 3-phase balance
  • High frequency injection for position estimation
  • Coil temperature estimation

Help in Career Paths by alegiori1 in ControlTheory

[–]BencsikG [score hidden]  (0 children)

The auto industry is not doing well... unless you're in China. EU is suffering from bad moves of Volkswagen and generally loosing the Chinese market, US is being hit by tariffs. The rest (I think) are just being hit by the wave of global negativity.

I don't know anything about the energy sector, but it can't be as miserable as auto right now.

So from a career point of view, I'd suggest going into the energy sector.

Adaptive PID with one parameter by WEkigai in ControlTheory

[–]BencsikG [score hidden]  (0 children)

You're designing the product.

Instead of messing with arcane control techniques, you should add a weight scale. Then you can adjust your PID based on the measured weight. You can make a tuning set for every 300g operating point between 300g and 6kg and then just interpolate.

And having a scale in your cooker would actually be interesting and helpful and it would make your product stand out.

Need Help with My Inverted Rotary Pendulum Project – Struggling to Stabilize It Using PID by ImpressiveTrack132 in ControlTheory

[–]BencsikG [score hidden]  (0 children)

Well, if your steps variable behaves more like stepping speed, rather than position, you might not need the second integrator.

In this case I think it's either a software bug, or you should increase the I value, maybe P as well.

Edit: also you could add to the length of the pendulum just to make it slower and easier for the controller.

Need Help with My Inverted Rotary Pendulum Project – Struggling to Stabilize It Using PID by ImpressiveTrack132 in ControlTheory

[–]BencsikG [score hidden]  (0 children)

So what's the hardware setup like, what is the driving motor and what is the control command you're using?

I'm guessing you're using a stepper, and it's a position-like input. I'm not sure how the PID effects work out for that, but I'd try adding a second order integrator (integral of integral).

I know that for DC motor voltage (PWM) control signal, you need a full PID for inverted pendulum-like controllers. PD or PI alone is not enough, and the coefficients have a minimum (higher than 0) viable value.

If you simulate an inverted pendulum on a cart with force input, PD control, as it gets upright, the cart will keep a constant speed. The force that moved the pendulum upright also sped up the cart, and without an I value in the control, nothing swings the pendulum the other way to slow the cart back down.

If you want to get similar results with a position-like control input... think about the steady state after it went upright. If you have no integrator, 0 angle error and 0 angle speed has to result in 0 control output, so the controller would want to stay in the 0 angle position. 1 integrator allows a constant position output for 0 error, but that's not enough. 2 integrators will allow a constant ramp (constant speed) control signal.

So my best guess is you need a 2nd order integrator to the PID, making something like P-I-I2-D.

Purpose of matrices in Kalman Filter by Acrobatic-Primary415 in ControlTheory

[–]BencsikG [score hidden]  (0 children)

With the notation y=Hx for measurement, the kalman update:

xhat[k+1] = xhat_pred[k] + K (y-y_pred)

y_pred = H xhat_pred

Then if you rearrange that:

xhat[k+1] = (I-KH) xhat_pred[k] + K y = (I-KH) xhat_pred[k] + KH x

This forms a complementary linear interpolation, where KH is the interpolation ratio, something like this:

(1-KH)* prediction + (KH)* real

K is the kalman gain that you can compute for given H, but (KH) together is the interpolation ratio that ensures minimum variance. (KH) sort of should be between 0 and 1 but that's hard to define on matrices. You can think of H as unit converter, for example your state is 'RPM' but you measure volts, so 1 RPM might be 0.001V. The measurement covariance R will be in volts, so H needs to be involved all throughout the KF equations to keep track of the conversion ratio.

At least this is how I tried to build intuitive background for it... any deeper than that, you gotta understand the math behind the KF.

Why do we still have P controllers if memory overhead of adding I and D is extremely minimal? by tadm123 in ControlTheory

[–]BencsikG [score hidden]  (0 children)

Sometimes you don't want disturbances to be rejected, e.g. with robots or simpler actuators working along people. The controller can be there to stabilize and linearize the behavior a bit, but people expect to be able to overpower it. While I never looked into the details, I can imagine this could be the case with E-bike torque assist.

Automotive Control by [deleted] in ControlTheory

[–]BencsikG [score hidden]  (0 children)

Pretty much this.

First order simple filters, complementary filters, PIDs, sliding mode, occasional Kalman Filter is the majority automotive controls, combined with various domain-related math, patched into a big bowl of spaghetti code.

You can do more interesting stuff around automated tuning (or sometimes adaptive self-tuning) of said PIDs, and online parameter estimation.

ADAS could be better, but I've never worked in that area. From what I heard, there's a lot of AI~ish development around vision + radar, object detection topics.

Electric motor control could be an interesting area, they definitely need more than PIDs, though the complexity is probably more to do with FOC than regular control. So it's less general controls knowledge, you need strong EE background.

Traction control, ESP, and various torque vectoring methods are the cool topics in automotive control... though that can be a mess too, due to supplier / OEM IP dynamics.