SolidGeek / VescUart

An Arduino library for interfacing with the VESC over UART
GNU General Public License v3.0
177 stars 92 forks source link

Control multiple motors #43

Open MatishParmar opened 1 year ago

MatishParmar commented 1 year ago

Hi, how to do I control two motors within VESCUart for speed control? I want both motors to spin at the same speed as one another bidirectional, there's no need for the motors to ever operate at different speeds.

Thanks

MatishParmar commented 1 year ago

what type of vehicle are these motors for? and yes you can set them to be exactly the same with the vest tool On Thu, May 4, 2023 at 2:06 PM MatishParmar @.> wrote: Hi, how to do I control two motors within VESCUart for speed control? I want both motors to spin at the same speed as one another bidirectional, there's no need for the motors to ever operate at different speeds. Thanks — Reply to this email directly, view it on GitHub <#43>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AX6CZDEZUS7AG6BAUNSW2U3XEPV2XANCNFSM6AAAAAAXWDY3JM . You are receiving this because you are subscribed to this thread.Message ID: @.>

The vehicle is a pod operating on magnetic propulsion that simply needs to go forwards. To levitate, the motors need to spin at a set speed. To brake, the motors need to spin in the opposite direction at a set speed.

Hence i need bidirectional speed control for 2 motors and was hoping the joystick gives the same speed to both motors

SolidGeek commented 1 year ago

You should be able to use the CAN bus functionality of the library. You need to connect both your VESC over CAN, and connect over UART to the "master" VESC. Then you can control the speed of both VESCs from one microcontroller using:

https://github.com/SolidGeek/VescUart/blob/master/src/VescUart.h#LL153C12-L153C12