Page 1 of 1

Control crazyflie's motor with a PWM command

Posted: Sat Jul 20, 2019 3:35 am
by LucasR
Hello,

I'm working on a crazyflie 2.0. I want to control the speed of each motors remotly thanks to a PWM signal. Basically what i want to do use a .launch with 4 args (PWM for each motors).
As I am new is ROS and with the crazyflie I dont really know where to start.

I think that i need to create a new message type called pwm.msg like that :
Int16_t pwm1
Int16_t pwm2
Int16_t pwm3
Int16_t pwm4

And create a new topic "Command_PWM".

In the firmware i saw that the powerDistribution_stock file control the motors speed. So i could fed in my 4 PWM there.

If someone can tell me if my approach is good or if i should look for a different way it would be appreciated.

Re: Control crazyflie's motor with a PWM command

Posted: Mon Jul 22, 2019 11:20 am
by kimberly
Hi,

What you are trying to do right now will not work unfortunately. So why do you want to use ROS and which ROSpackage are you using right now?

You should be able to set the PWM in the Crazyflie directly from our Python library: https://github.com/bitcraze/crazyflie-lib-python. Then you are able to set parameters directly (motorPowerset.m1, .m2 etc).

If you are new to ROS but you don't necessarily need it, the Python library is the better option for you.

Re: Control crazyflie's motor with a PWM command

Posted: Mon Jul 22, 2019 12:17 pm
by LucasR
Thanks for your answer,

For this project i use this package : https://github.com/whoenig/crazyflie_ros.
I use ROS instead of python since some previous works was done on the crazyflie on this package.

I found a way to fed a value to each motor by modifying "position.py" and the "stabilizer.c"
i know need to make a proper code and it should be alright (i hope so atleast) !