You are here

lispBM on VESC for special algorithm

5 posts / 0 new
Last post
Fusion
Offline
Last seen: 1 month 3 weeks ago
VESC Free
Joined: 2024-10-08 21:14
Posts: 4
lispBM on VESC for special algorithm

Hello!

I am using MKS and FlipSky 50A VESC to control 350W 24V DC motors. I would like to have some special algorithm of current limitations. For example, when motor is idle (DUTY CYCLE =0) I would like to have much more current to start motor under load for few seconds , then I can make it lower. The same for changing direction. When DUTY CYCLE cross "0" we set MAXIMUM CURRENT, after few seconds, we set it to regular current limit.

What do You think, does it make sense?

How to write such lisp script? Can somebody help me with it?

Thank You in advance!

electricfox
electricfox's picture
Offline
Last seen: 5 hours 48 min ago
VESC Original
Joined: 2019-01-01 17:11
Posts: 126

You can check the following video from Benjamin. Its similar to what you want just without a time factor: https://www.youtube.com/watch?v=XUy41dLhOVE

I changed the code to work in both directions, acceleration and braking/reverse.

Fusion
Offline
Last seen: 1 month 3 weeks ago
VESC Free
Joined: 2024-10-08 21:14
Posts: 4

Thanks for your reply, but this video is about interpolation. Can You check it and give correct one? 

Fusion
Offline
Last seen: 1 month 3 weeks ago
VESC Free
Joined: 2024-10-08 21:14
Posts: 4

Here is my script.I would appreciate if somebody will check it. Thank You in advance!

(def oCurr (conf-get 'l-current-max)) ;Read current-max and store it
(def startTimer (systime))
(def delayTime 25000)  ;Set delay time to 2.5sec
(def fChanged false)

(loopwhile t{    ;main loop
(if (< (abs (get-ppm)) 0.08)
{
  (if (not fChanged)
  {
   (conf-set 'l-current-max (* oCurr 3)) ;Set current to oCurr * 3
   (set 'fChanged true)
   (print "CENTER set current to Initial current*3")
  })
   (set 'startTimer (systime))
})
 (var timePassed (- (systime) startTimer))
 (if (and (> timePassed delayTime) fChanged)
 {
     (conf-set 'l-current-max oCurr)  ;Set default current value
     (print "2.5 sec elapsed set current to Initial current")
     (set 'fChanged false)
 })
(sleep 0.01) ; wait for 0.01sec. that means our reading will occure 100 times per second
})

 

Fusion
Offline
Last seen: 1 month 3 weeks ago
VESC Free
Joined: 2024-10-08 21:14
Posts: 4

It works! I have tested it.