Jetson nano running YOLO and control Odrive

Hi, guys. I am developing the object named ‘TWAS’. It works in YOLOv5 model by Jetson nano. When we detect any car, the odrive will control the Brushless Motor.
Now I have installed and runned the YOLOv5 in Windows. (for testing)
And detection part is great and awesome. It can provide the current video stream with the distances from different cars. However, the code about controlling the Motor switch parameter only will work one time. Then it goes into the loop…(downloading the json data from Odrive…)
Is anyone met the similar question before?



Hi! Can you post set_controller_param? Or upload your whole codebase?

Which ODrive and what ODrive firmware version is this?

Hi, guy. I solved this problem. However, I also need to get the Iq and the Torque value. Do you know where can I find it? I need to use it to be a feedback for my system.

Are you using CAN, UART, or USB?

I am using the USB.

Which ODrive is this? v3.6 or S1/Pro/Micro?

v3.5

It is a homemade development board with version 3.5 firmware installed. Odrivetool is functional.

Ah I see, you’ll have to check the v3.6 docs then. I don’t think there’s an actual torque estimate value, you’d need to take the Iq (Iq_measured) and multiply it by the torque constant.

Yes, I got it. Thank you so much. Did you follow the topic of traoezoidal?

I am considering which is better. You know, I try to control the handlebar of bicycle(motor). The difficult point is how to get the balance between manual and machine. I don’t think we should get to the setting position very fast, however it should generate a force (torque) to reminder us which side coming car. Do you have any idea?

Setting a PID parameter for vel_gain, vel-integrator and pos_gain was completed. And also I got some data which is suit for this project. However, is there any way to change the parameter by itself? I am not only saying just two group data, but also a self-adjusting.

Usually for HID applications, running in torque mode is a good idea – you can provide force feedback for the user.

Can you elaborate what you mean by “change the parameter by itself”? As in only set one parameter? Or as in have the ODrive self-tune?

The Odrive self-tune. I think that will be more intelligent. Why you consider a torque mode is good? Any special? I am trying to applying the position mode LOL.

If you’re trying to give force feedback / torque assist to a human, that should generally be in torque mode, maybe with an algorithm running on your Jetson to control how much torque to use. Or, you can use velocity mode, but should ideally have a vel_integrator_gain of 0 so that there’s a constant spring response.

Auto-tuning is a bit less useful than it may seem, unfortunately :slight_smile: but it may be functionality in the future.

Good idea. However, I consider that will rotate constantly. In the application, the handlebar(motor) should be stationary.

If you have the appropriate external control loop, you can stabilize it, and more easily respond to user commands. However, if your primary function is keeping it in one position, then yes position mode makes more sense.

yes, I think so. Sorry for late to reply you. I met some problem last week. And now try it again. Do you have any idea of monitoring the motor position?

You can just monitor the encoder position, yes? e.g. ODrive Reference — ODrive Documentation 0.5.6 documentation

Yes, I got it. I have a question about reboot the Odrive. In some situation for my project, I have to stop the motor. Therefore, I use “odrv0.axis0.requested_state = AXIS_STATE_IDLE” to cut off the pwm signal to stop control the motor. Afterwards, I need to restart it. So I try “odrv0.axis0.requested_state = AXIS_STATE_STARTUP_SEQUENCE”. It works.

However, the motor haven’t rotate to the primary position which I set 0. Do I need to reset the parameter and calibrate the motor and encoder again?

You definitely don’t have to put it in startup sequence to re-enter closed loop control, that’ll do a full motor calibration and everything, which is unnecessary. You can simply run odrv0.axis0.requested_state = AXIS_STATE_CLOSED_LOOP_CONTROL. Then you just set your input_pos back to 0 and it’ll rotate to the original position.