Controlling a single motor

Firmware/software/electronics/mechanics
Post Reply
f-rower
Beginner
Posts: 16
Joined: Wed Jun 14, 2017 10:19 am

Controlling a single motor

Post by f-rower »

Hello, I am very new to the development of the Crazyflie 2.0 quadcopter, and I am having a hard time understanding the code structure, as my background is more oriented towards engineering:

I need to be able to control a single motor from my pc to keep it at a desired number of rpm (none of the motors in particular), and was wondering what files I should modify to achieve this. I want to avoid the use of a joystick, as my current goal is not flying the quadcopter, and this would not allow for precise rpm control. I am using the Bitcraze VM for development.

Thanks very much in advance,

f
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Controlling a single motor

Post by tobias »

In the somewhat resent firmware release there are some parameters where you can hard set the PWM value to the motors. So from the cfclient you can go into the parameters tab and set e.g. the motorPowerSet->m1 value to e.g. 3000 to make it spinn when enable is set to 1.
f-rower
Beginner
Posts: 16
Joined: Wed Jun 14, 2017 10:19 am

Re: Controlling a single motor

Post by f-rower »

That's great, thank you very much!

However, I was hoping on developing some code where a sequence of pwm values are automatically sent to the motor, without me having to go into the cfclient and changing them by hand. Any help with this?

Thanks very much,

f
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: Controlling a single motor

Post by arnaud »

You can look at the Crazyflie lib example, you can write a python program that sets parameters: https://github.com/bitcraze/crazyflie-l ... am.py#L125
Post Reply