Giter VIP home page Giter VIP logo

Comments (6)

dcodeIO avatar dcodeIO commented on August 17, 2024

Perhaps, one way to tackle issues of this kind could be to generalize programmatic shutdown a little more. That is, instead of "holding" shutdown, there could be (shutdown-abort) to cancel shutdown entirely when event-shutdown is received, (shutdown) to shut down programmatically once ready to do so, and (get-powerswitch) to get and monitor the power switch state. Then, in addition to powering on as usual, the application can take control of shutdown behavior whereas the firmware only provides the necessary APIs instead of implementing a specific behavior?

Edit: Figured that in our use case this could be even simpler: Use ALWAYS_ON plus provide programmatic (shutdown) and (get-powerswitch), so holding or cancelling the shutdown event is not necessary since the VESC won't shutdown automatically anyway. That is, if ALWAYS_ON also uses the power switch to turn on.

from bldc.

vedderb avatar vedderb commented on August 17, 2024

The intention is to enable the gates and abort shutdown if it does not succeed after two seconds (as can happen of the button is toggled in-between). Maybe there is something wrong in the logic though. Can you describe the exact steps to reproduce the problem together with a small example lbm program?

from bldc.

dcodeIO avatar dcodeIO commented on August 17, 2024

I don't have a functioning setup at hand right now, unfortunately, but I would imagine that the following program should demonstrate the issue:

(defun do-startup () {
  (looprange i 0 5 {
    (set-duty 0.1)
    (yield 500000)
  })
  (set-duty 0.0)
})

(defun do-shutdown () {
  (looprange i 0 5 {
    (set-duty -0.1)
    (yield 500000)
  })
  (set-duty 0.0)
})

(do-startup)

(event-register-handler (self))
(event-enable 'event-shutdown)

(loopwhile true
  (recv
    (event-shutdown {
      (shutdown-hold true)
      (print "Performing action upon shutdown...")
      (do-shutdown)
      (print "Action complete. Shutting down...")
      (shutdown-hold false)
      ; LBM should terminate now unless
      ; power has been switched back on.
      (yield 500000)
      (print "Shutdown cancelled. Restarting...")
      ; If cancelled, this should work:
      (do-startup)
    })
  )
)

(unreachable)

Upon boot, motor should drive forwards for a bit. Upon shutdown, motor should drive backwards for a bit before the VESC is turned off. Issues appears to arise when cycling the power switch between shutdown-hold true and shutdown-hold false, in that motors won't move anymore and/or the VESC won't turn off afterwards.

Will take a closer look as soon as I have a working setup again, but perhaps that's helpful already?

from bldc.

dcodeIO avatar dcodeIO commented on August 17, 2024

Got around to testing again meanwhile. Appears that the above program is too stripped-down to show the issues originally described. Will try to improve. However, it seems to show that the shutdown event is emitted only once, whereas subsequent toggles skip the event and shut the VESC down immediately.

Btw, I forgot to mention that the power switch setting used is ALWAYS_OFF. Using a 60_75_MK2 atm, 6.05 beta 22.

from bldc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.