Driving 2 Gimbal Motors in Sync on Same

I’m currently driving two 5208, 200 turn gimbal motors in sync with an ESP32 and two brushless ESCs seen here: https://twitter.com/ProtoG42/status/1091175306684174337

It is too fast for my particular application so I just purchased an ODrive and encoders for the motors.

I would like to be able to stop at each plate in 90 degree intervals with the two motors running together in sync. They are locked together on the same drive “shaft”.

What is the best approach to turn the motors in sync such that they are not fighting with each other? I hoping to be able to use the gimbal motors I have as I really like the look of them but I am open to other motor suggestions as well.

Thanks!

We don’t really have the ODrive setup with an input block for managing two axes “properly” simultaneously, but you should be able to command a position to each of them as quickly enough that it won’t be a problem. One will be a positive position and the other negative. You may also want to run it in “counts in cpr” mode since you only care about positions with respect to the motor position, not some “linear distance” (0 and 8192 are the same position in your case).

With the inertia your system has, I would actually call “move_to_pos” for each one and let the trapezoidal planner handle it

1 Like

I can report ODrive works fine with those 5208-200T motors. You’ll want to use “gimbal motor mode”.

What about running them in sync?

I’ve only tried one at a time.

Care to share any of your settings or code? I’m still waiting for my board to arrive so I haven’t been able to test any code yet.

What kind of encoder are you using? I have the motor in gimbal mode with a 24V supply, and I set resistance_calib_max_voltage to 6, current_lim to 8 and calibration_current to 4 (in gimbal mode the last two are voltages, even though it says current).

Thanks, I’m using the CUI AMT102-V encoders from the ODrive shop.

You may want to talk to @Tobin_Hall about the current state of absolute SPI encoders in the firmware.

The current state is a crude mostly untested implementation in a PR. I haven’t had much time recently for testing this properly and working out all the bugs.

Hi Wetmelon,

Thanks for the info. I have read through the getting started page and other documentation as well as the arduino library.

I have seen how to set to configure the trapezoidal planner and the related parameters but I do not see mention of how to use the move_to_pos function in the arduino library.

Can the arduino library implement move_to_pos or am I stuck to using odrive.SetPosition?

Actually the ASCII protocol supports Trapezoidal Trajectory can be triggered by sending the character ‘t’ followed by the axis and position:

t 0 1234.0 would send axis 0 to position 1234.0

I don’t think this exist as a separate function in the Arduino library today but it should be easy for you to add

I just set up my gimbal motor today in gimbal mode and it is working perfectly via my macbook pro terminal. So after configuring the control mode as trapezoidal, I am assuming something like this would work, correct?

serial_ << "t " << motor_number << " " << position << “\n”;

Is there a method of changing the motion control modes via the ASCII protocol? Is it even necessary to change it or can the different commands for the different modes work as is?

I think once the ODrive is booted into position control mode and working correctly, you can simply send the t command on ascii, and it should execute the move.

Not sure if this question should be posted here so I reposted a new esp32 communication thread here

What libraries did you use to connect the ESP32? As soon as I add ODriveArduino and Set my board to “Esp32 Dev Module” I get conflicts with multiple SoftwareSerial.h and Constructors not existing in the library that work with the example.

Please Help? I have been trying to solve this for over a week now.

The examples work fine when I connect an Arduino Uno, but once the esp32 is connected it does not compile. I even went in and changed the libraries to have constructors that work with example and I can get it to compile. But no connection with odrive.

This setup sounds very close to what I’m trying to run. I’m using 5208-200t motors on two (yaw/pitch) axes and would like to run a control scheme as a simple two axis stabilizer.

The objective to receive the benefit of the Odrive’s power and BASIC gimbal 2 axis stabilization using PX4’s stabilization over PWM input. which is referenced here:

PX4
https://dev.px4.io/v1.9.0/en/advanced/gimbal_control.html

Ardupilot.
https://ardupilot.org/copter/docs/common-camera-gimbal.html#camera-gimbal-with-servos

I’ve been operating my odrive, commanding specific circular positions over USB, but haven’t uses PWM from an outside device yet.

Is this sort of trivial?

Yeah, check out https://docs.odriverobotics.com/interfaces#rc-pwm-input