You are here

Traction control with diferent motors

2 posts / 0 new
Last post
noel20
Offline
Last seen: 3 weeks 1 day ago
VESC Free
Joined: 2026-05-13 19:22
Posts: 3
Traction control with diferent motors

Hi, I recently built a rather unusual vehicle. I use a wheelchair and have a front-mounted electric drive unit. It has one wheel. I installed motors in the wheelchair's wheels. They're used from a bicycle. I'm powering it with VESC controllers with the latest firmware version 7. The front controller is the master controller and communicates with the two rear slave controllers via CAN. It generally runs well, but I want to enable traction control because the front wheel skids easily. The front wheel also skidded before, so I installed motors in the rear wheels of the wheelchair. And for off-road driving. But the factory-built traction control doesn't work. Leaving aside detailed descriptions, when driving at a constant speed, the front motor spins seven times faster. I'm talking about ERPM. How do I write a script in LISPBM to handle this? Thank you.

MVIMG_20260903_191754.jpg

MVIMG_20260829_100902.jpg

noel20
Offline
Last seen: 3 weeks 1 day ago
VESC Free
Joined: 2026-05-13 19:22
Posts: 3

With AI and manual from:

https://github.com/vedderb/bldc/blob/master/lispBM/README.md

and

https://github.com/vedderb/bldc/blob/master/lispBM/lispBM/doc/lbmref.md

I wrote:

(def print-counter 0)
(loopwhile t {
    (def raw-master (get-rpm))
    (def raw-s11 (canget-rpm 11))
    (def raw-s12 (canget-rpm 12))
    (def rpm-master (if (number? raw-master) (abs raw-master) 0.0))
    (def rpm-s11 (if (number? raw-s11) (abs raw-s11) 0.0))
    (def rpm-s12 (if (number? raw-s12) (abs raw-s12) 0.0))
    (def slave-avg (/ (+ rpm-s11 rpm-s12) 2.0))
    (def is-slipping (and (> slave-avg 10.0) (> rpm-master (* 8.0 slave-avg))))
    (if is-slipping
        {
        (app-disable-output 100)
        (set-current-rel 0.2)
        }
        {
        (app-disable-output 0)
        }
     )
     (setq print-counter (+ print-counter 1))
     (if (>= print-counter 25)
        {
        (def status-str (if is-slipping ">>> TRAKCJA AKTYWNA <<<" "OK"))
        (puts (to-str "Master:" (to-i rpm-master)
                      "ERPM | Slave11:" (to-i rpm-s11)
                      "| Slave12:" (to-i rpm-s12)
                      "| Srednia Slave:" (to-i slave-avg)
                      "ERPM | Stan:" status-str))
        (setq print-counter 0)
        }
        nil
     )
     (sleep 0.02)
   })

and thats works good enaught for now.