Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup motor foc #25

Open
Vincentvlb opened this issue Jan 19, 2022 · 3 comments
Open

Setup motor foc #25

Vincentvlb opened this issue Jan 19, 2022 · 3 comments

Comments

@Vincentvlb
Copy link

Hello, I would like to know if it is possible with your library to make a setup motor foc as in vesc tool.
If possible, do you have an example?
Thanks in advance,
Vincent LAMBERT.

@RKajay2001
Copy link

Hello, I would like to know if it is possible with your library to make a setup motor foc as in vesc tool. If possible, do you have an example? Thanks in advance, Vincent LAMBERT.

Hello Vincent, I'm also search for setup motor foc only. didn't you find any code for that if yes means kindly help me out.

Thanks in advance.

@MelvinWarnet
Copy link

Hello RKajay,

I'm an intern working with Vincent, and I've come back to the motor FOC setup with pyvesc as part of my internship project. Here's what I have so far:

class DetectApplyFOCMessage(metaclass=VESCMessage):
    id = COMM_DETECT_APPLY_ALL_FOC
    fields = [
        ('detect_can', 'i'),
        ('max_power_loss', 'd'),
        ('min_current_in', 'd'),
        ('max_current_in', 'd'),
        ('openloop_rpm', 'd'),
        ('sl_erpm', 'd')
    ]

serial_port = '/dev/ttyACM0'
serial = Serial(port=serial_port, baudrate=115200)
my_msg = DetectApplyFOCMessage(0, 60, -25, 60, 700, 4000)
serial.write(pyvesc.encode(my_msg))

With this setup, the motor makes some noises similar to those when using VESC Tool, but it doesn't really start spinning, and I don't know how to get feedback. The feedback I'm interested in is whether the hall sensors are detected or not.

I've also identified this frame that initiates the motor FOC setup, but again, I don't know how to get the feedback I need.

serial_port = '/dev/ttyACM0'
serial = Serial(port=serial_port, baudrate=115200)
frame = "02 16 3a 00 00 01 d4 c0 00 00 00 00 00 00 00 00 00 0a ae 60 00 3d 09 00 ac 46 03"
serial.write(bytearray.fromhex(frame))

If you have discovered anything new or have any additional insights, I would really appreciate your help!

@RKajay2001
Copy link

I didn't work with COMM_DETECT_APPLY_ALL_FOC I worked with COMM_DETECT_MOTOR_FLUX_LINKAGE and COMM_MCCONF commands only. I need solution in MCCONF command. As I'm worked with pyvesc we can either set or get with one command we can't do both with the same command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants