Turn on motors from cfclient

Firmware/software/electronics/mechanics
Post Reply
luisruiz
Beginner
Posts: 14
Joined: Fri May 31, 2013 7:39 am

Turn on motors from cfclient

Post by luisruiz » Fri Aug 16, 2013 10:24 am

Hello,

I am trying to turn on the motors from the cfclient using:

self.crazyflie.param.set_value("motor.m1", 10001)

but I get the following warnings:

Fri, 16 Aug 2013 19:12:36 WARNING cflib.crazyflie.toc Unable to find variable [motor.m1]
Fri, 16 Aug 2013 19:12:36 WARNING cflib.crazyflie.param Cannot set value for [motor.m1], it's not in the TOC!

motor.m1 is indeed in the TOC, I can print it:

toc = self.crazyflie.log.toc
for group in toc.toc.keys():
for param in toc.toc[group].keys():
toc_element = toc.toc[group][param]
logging.info("name=%s.%s, index=%d, pytype=%s, ctype=%s" %
(group, param, toc_element.ident, toc_element.pytype, toc_element.ctype))

Is it possible to turn on the motors this way???
Do I need some setup before it??

Thanks.
--Luis



luisruiz
Beginner
Posts: 14
Joined: Fri May 31, 2013 7:39 am

Re: Turn on motors from cfclient

Post by luisruiz » Thu Aug 22, 2013 9:28 am

Hello,

I am able to control the motors from the cfclient changing the values in the firmware :) !!!. Now, something I noticed, is as explained in the wiki, "Sending a command makes it apply for 0.5 seconds, after which the firmware will cut out the power". After navigating the firmware code I am afraid to say I could not find the timer/delay for that signal. I want the commands sent to the motors last for 10 ms, do you know where is that timer/delay in the firmware?

I tried changing the delay in stabilizer.c -> stabilizerTask -> vTaskDelayUntil(&lastWakeTime, F2T(IMU_UPDATE_FREQ));, but the system crashes :(, I got the red led turned on.

Thanks.
--Luis

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

Re: Turn on motors from cfclient

Post by tobias » Thu Aug 22, 2013 12:46 pm

They are defined in the commander module.

Code: Select all

#define COMMANDER_WDT_TIMEOUT_STABALIZE  M2T(500)
#define COMMANDER_WDT_TIMEOUT_SHUTDOWN   M2T(2000)

Post Reply