Unable to control thrusters by C++ code

Hello.
I am trying to control a thruster by the C++ sample code (Servo.cpp).
But the thruster did not run even though it runs when it controled by the Python code (Servo.py).
Additionally, I checked the pwm wave by an oscilloscope.
The pwm wave created by C++ code was same shape as the pwm wave created by the Python code (Servo.py).
Why the thruster cannot control by the C++ sample code ?
If you have any idea, please let me know (m_m).

Hi Yasuyuki,

Thanks for reaching us!

Let me check if there are issues with these sample codes. I’ll come back with feedback to you soon.

Hi Yasuyuki,

I’ve checked both examples - they are working fine.

May I see your setup? Could you, please, send a picture?

Thank you for your reply.

The cofingure is as follows.

Computer: Raspberry Pi 3 Model B+
Expansion board: Navio2
ESC: Basic ESC (Blue Robotics)
Thruster: T100 (Blue Robotics)
Battery: 5,000mAh 11.1V 3S LiPo battery

I tried the C++/Python sample code again.
It rotated in python code but not in C++ code.

Hi Yasuyuki,

We’ve tested our code examples using the setup with motor and ESC driver and indeed they work not just as they were supposed to.

At the moment you can modify code files yourself to test your equipment. To make these examples work properly, try increasing PWS’s period:

//C++

pwm->set_frequency(PWM_OUTPUT, 50);
//Python

pwm.set_period(50)

The default value is 50.

Please, set it to 100 or 500 and let me know if it helped.

Also, you can edit

SERVO_MAX = 1.750

to 1450 in order to decrease your motor spinning during tests.

And thank you for your contribution. We’ll add information to our documents section.

2 Likes

Hi Mikhail,
I appreciate to your intense debugging work and test.
Unfortunately, the motor didn’t spin even though I changed PWM period.

I will write program in Python tentatively.
Thank you.

Hi Yasuyuki,

Unfortunately, since all motor’s model varies a bit there could be no universal control script for all of them.

Please, keep us in touch regarding your progress.

1 Like