Is it possible to use PWM input to control motor speed while in Velocity Control mode?
I see that PWM can be used to control position while in Position Control mode, but have not yet found any descriptions or functions for controlling Velocity using PWM.
Yes I believe you can use the PWM signal to control any function that you like (within reason). See the interface docs here.
I have not tested this myself but I believe you should be able to follow the example given in the docs with the only change being:
In [1]: odrv0.config.gpio4_pwm_mapping.min = -1500
In [2]: odrv0.config.gpio4_pwm_mapping.max = 1500
In [3]: odrv0.config.gpio4_pwm_mapping.endpoint = odrv0.axis0.controller._remote_attributes['pos_setpoint']
to
In [1]: odrv0.config.gpio4_pwm_mapping.min = -1500
In [2]: odrv0.config.gpio4_pwm_mapping.max = 1500
In [3]: odrv0.config.gpio4_pwm_mapping.endpoint = odrv0.axis0.controller._remote_attributes['vel_setpoint']
You would also need to setup the board with odrivetool to be operating in CTRL_MODE_VELOCITY_CONTROL. Let us know how you go as I donāt think too many people have tested this feature yet.
AttributeError: āRemoteObjectā object has no attribute āgpio3_pwm_mappingā
I have no issues controlling the motor using USB (odrivetool). I followed the hoverboard example and had no issues up until I try to configure the gpio.
Is it possible that this is due to having firmware [0.4.1] installed?
With some basic modification to the current PWM input code, we should be able to use PWM to control the spindle speed. Currently it is set up to understand the 1ms to 2ms style PWM signal used for hobby RC stuff, but I take it that spindle speed PWM signals are 0 to 100% style.
I just ran odrivetool dfu and when the system restarted the odrive does not connect to USB. If I connect and disconnect the USB the computer does not recognize the connection.
If I set the dip switch to dfu mode the STM32 BOOTLOADER shows up in Device manager and when run odrivetool dfu I get:
ODrive control utility v0.4.0.post3
Waiting for ODrive...
IndexError Traceback (most recent call last)
~\Anaconda3\Scripts\odrivetool in <module>()
139 print_version()
140 import odrive.dfu
--> 141 odrive.dfu.launch_dfu(args, logger, app_shutdown_token)
142
143 elif args.command == 'liveplotter':
~\Anaconda3\lib\site-packages\odrive\dfu.py in launch_dfu(args, logger, cancellation_token)
448 firmware = FirmwareFromFile(args.file) if args.file else None
449
--> 450 update_device(device, firmware, logger, cancellation_token)
451
452
~\Anaconda3\lib\site-packages\odrive\dfu.py in update_device(device, firmware, logger, cancellation_token)
266 if otp_data[0] == 0:
267 otp_data = otp_data[16:]
--> 268 if otp_data[0] == 0xfe:
269 hw_version = (otp_data[3], otp_data[4], otp_data[5])
270 else:
IndexError: array index out of range
Thank you everyone. I was able to get it reflashed and everything seems to be working. And yes, the PWM control I need is a 0~100% type. I will submit a feature request.
It is not. This feature has come up several times recently as a request, so itās moved up my priority list, but it is not yet available in the master branch, sorry
Hi bickelaļ¼can you illustrate how to config ODrive if i intend to use PWM input to control motorās position?
I did the config for the former targetļ¼
odrv0.axis0.config.enable_step_dir = True
odrv0.config.enable_uart = False
odrv0.configā¦counts_per_step = 100
may I do other configrations,it is great appreciate for your any reply!
Sorry, I am just a user. I am in same position as you. I would like to use a PWM input control for motor velocity, but functionality has not yet been implemented in a manner that I can use.
Is there any update when this feature will be available? I have a Dynomotion kflop CNC controller which outputs a 0-100% PWM at 10khz ( I can change this and lower it, but not recommended to lower ) also a direction output ( held high to change direction ) I require precise velocity control, It will also be closed loop the Kflop controller and the Odrive or may setup Odrive to run motor just off the hals. I did have a look through the PWM part of the code but not sure what exactly needs to be changed. I see mentioned else where the PWM is using interrupt and not recommended to go over 500hz?
Hi, my robotic team is using this with hoverboard wheels, with the RC PWM to control the speed. There seems to be no perfect way to stop, I was just wondering if others have any solution to this? Setting it to half way between full speed forward and full speed backwards doesnāt get it to āstopā only very slow. Any advice?
Question about the PWM implementation: After parsing through the code youāve linked Iām gathering that the PWM is getting converted through an ADC from a timing perspective, not an analog signal perspective, correct?
Reason I ask is because Iāve noticed (with other controllers) that the analog signal generated from the arduino can vary depending on whether or not the arduino is connected to a PC via a USB cable. In this case Iām using an arduino to generate the PWM in an effort to get around this analog signal issue, with the hopes that the odrive is utilizing the PWM signalās timing to convert regardless of the signalās amplitude.