vedderb / bldc

The VESC motor control firmware
2.08k stars 1.31k forks source link

Suport UART commands VS LispBM commands #718

Open casainho opened 2 months ago

casainho commented 2 months ago

I see the LispBM has access to almost all variables while the UART don't. I need to set motor currents in real time and so I had to add the l_current_min and l_current_max UART commands, just duplicating the LispBM existing ones.

Should I expect that my pull request will be accepted or it is strategic that VESC do not support most command in UART as it support in LispBM?

The possibility of doing scripting programing is amazing!!! LispBM is very important for VESC, I can understand this in the technical user perspective, as I am this type of user.

But I really prefer Python and Linux, as also modularity in a way to bring costs down - like, If a VESC burn, I would prefer to be a simple and cheap part, and put the scripting language outside in another module (as also Wifi and Bluetooth communications), just like the VESC Express. The only thing needed is a robust and fast BUS connection to VESC.

I am using a similar ESP32-Sx as VESC Express, to run the high level firmware in Python script. But for simplicity and lowest price, I am using UART to communicate with VESC, glued to the VESC case and with very short wires.

Currently we can buy for 20€ or less, this SDCard size Linux boards, running at 1GHz with 256MBytes RAM, with Bluetooth and Wifi, that run the popular Linux Ubuntu or others, and run any programming language as Pyhton or C++. Will have for sure this boards costing less in recent future, probably similar cost as an ESP32-Sx.

image

vedderb commented 2 months ago

You can read out the entire motor configuration over UART or USB using VESC Tool. If you want to make a config serializer/deserializer yourself that is possible too from the VESC Tool source code and config XML files. Another approach would be to upload a LBM-script that supports your UART-commands. You can also send REPL-commands directly over UART, they will respond with the values back on the UART. There are many ways to achieve this already and I don't want to use limited firmware space for adding even more commands. I also have to maintain them over the releases, which is an additional burden.

Personally I'm not a fan of tiny embedded linux boards for things like this as there are so many ways to corrupt the sd-card (or other memory chips) and something like buildroot is inconvenient to work with. If you run regular ubuntu you also get terrible boot time. Then even if you spend a lot of time setting up your perfect buildroot environment and get everything running somewhat smoothly that same linux board might not be available next year and you have to adapt to another one. I spent some time a while ago going down that path and even though I got it working I'm not a fan of it: https://github.com/vedderb/vesc-os-pi

casainho commented 2 months ago

You can read out the entire motor configuration over UART or USB using VESC Tool. If you want to make a config serializer/deserializer yourself that is possible too from the VESC Tool source code and config XML files. Another approach would be to upload a LBM-script that supports your UART-commands. You can also send REPL-commands directly over UART, they will respond with the values back on the UART. There are many ways to achieve this already and I don't want to use limited firmware space for adding even more commands. I also have to maintain them over the releases, which is an additional burden.

Personally I'm not a fan of tiny embedded linux boards for things like this as there are so many ways to corrupt the sd-card (or other memory chips) and something like buildroot is inconvenient to work with. If you run regular ubuntu you also get terrible boot time. Then even if you spend a lot of time setting up your perfect buildroot environment and get everything running somewhat smoothly that same linux board might not be available next year and you have to adapt to another one. I spent some time a while ago going down that path and even though I got it working I'm not a fan of it: https://github.com/vedderb/vesc-os-pi

Oh, I do understand all your points!! I think I will implement the LISP script that supports my UART-commands.

About the hardware changing, yes, I am seeing that a lot on the years I am being using the chinese motor controllers and displays - now even with chinese VESCs. I developed firmware for TSDZ2 ebike mid drive motor but then they changed to a different microcontroller, without SDK, no cheap available dev tools like the STM. The same on the displays, the same display outside but different hardware versions that make the firmwares incompatible.... That is why I decided to move to VESC as the motor controller, then build my own DIY high level software EBike/SCooter/EMotorcycle board, as also my DIY display. If possible, I prefer to use well known hardware modules, that I can easily reuse over the projects and repair - even if that is not the most recent technology.

And about the Linux, I think it is inevitably, because of the demand for software complexity and more and more powerful, cheap and power efficient processors.