I want to upgrade my golf push cart with electric motors. Why? Because I am becoming older every second, but I also don’t want to replace my current cart. And making things on your own is more fun than purchasing some finished product.
One of the features I’d like to implement is what I would describe as “push assist”, so when you give it a push, the motors will support you with that speed. If you stop pushing, it will become slower and come to a standstill eventually. So comparable to pedal assist of an ebike. At some later stage I also want to include a remote control as well as a camera/lidar based “follow me” feature, but that is a seperate topic
I have purchased an ODrive 3.6 as well as a hoverboard with a defect PCB, but working motors, battery and charger, and I have connected and calibrated the motors according to the tutorial in the docs.
Where I am struggling now is to set the velocity. My idea was I could use the encoder to detect the speed of the wheel and then also set the motors to that value.
Simple code:
while True:
v = odrive.axis0.encoder.vel_estimate
odrive.axis0.controller.input_vel = v
Now what happend is when I spin the wheel manually, it accelerates to that speed (unfortunately a bit bumpy). When I then try to slow down the wheel, I can see that the value of v also decreases, but when I let it go again, it will accelerate to the previous speed.
Any idea why this happens and what I could do actually achieve what I am trying to achieve? Is it even possible. The alternative to that feature to just work with a potentiometer to set the desired speed, but that is kind of lame.
Cool project! This is definitely a little tricky - especially on uneven terrain, distinguishing from force applied by the user and force from terrain slopes is pretty nontrivial.
Three things you could do - first, you could implement some sort of force sensor on the cart handle, so that it’s able to sense the pushing force from you and convert that into wheel torque – this is similar to what electric bikes do for pedal assist. Second, you could have a button on the handlebars that, when pressed, disables the motor, and when released set the velocity setpoint to the current speed – so you’d hold the button while giving the cart a starting push, then release it and it’ll keep going at the current velocity. Finally, you could make a velocity-to-torque mapping, where you control the wheels in torque mode but the faster the cart goes the more torque you put out – this is how cheap electric bikes that don’t have pedal force sensors work. That being said, that last technique is pretty janky and could definitely have issues with asymmetrical force applied between the two wheels.