Page 2 of 4
Re: sharp gp2y0a21yk0f
Posted: Sun Dec 13, 2015 7:20 pm
by chad
mannaris wrote:1. I have the crazyflie2. How is the firmware called? Is it crazyflie firmware or is it crazyflie2-nrf-firmware?
For your purposes, it is
crazyflie-firmware.
mannaris wrote:2. can I use the driver from anasios for the crazyflie2 and my sensor(analog)?
I can't answer this, hopefully someone else can...
mannaris wrote:3. I dont find the place where I have to put the driver. The wiki says : "To compile the driver, place it in deck/drivers/src/ and add it to the Makefile"
But im not able to find these folders. i dont know what you mean with "the master branch".
Since you're using the VM from Bitcraze, you ought to be able to double-click the "Update all projects" file on the Desktop to update the firmware checkout on disk, thereby getting the folders Arnaud mentioned (you are using the GUI, yes? If not, run "startx" at the command prompt). Look inside the "projects/crazyflie-firmware" folder (on the Desktop) and you should see the "deck" folder. If it isn't there, open a terminal and run the following:
Code: Select all
cd ~/projects/crazyflie-firmware
git checkout master
Then look for the "deck" folder inside crazyflie-firmware again. It should be there.
-or-
If you download
the zip file from GitHub, it contains the master branch. If you want to clone
the repository yourself, you will get the master branch by default. If you want to use Git (ie. to clone, update, switch branches, or otherwise), I will point you to
the official Git documentation so you can read up there and learn how to use it.
Re: sharp gp2y0a21yk0f
Posted: Mon Dec 14, 2015 11:03 am
by arnaud
Hi,
2.
The code I posted in this answer would work for analog sensors:
viewtopic.php?f=6&t=1770#p9068
3.
We just published a small howto to help getting started to add code to the Crazyflie:
https://wiki.bitcraze.io/doc:crazyflie: ... deck:howto, as Chad answered you should be on the master branch.
Re: sharp gp2y0a21yk0f
Posted: Fri Dec 18, 2015 6:40 pm
by mannaris
So this is my driver:
Code: Select all
#include "deck.h"
#include "log.h"
#include "FreeRTOS.h"
#include "timers.h"
static xTimerHandle timer;
static float range1;
// This function will be called by the FreeRTOS timer every 100ms
void SensorValue(xTimerHandle timer)
{
range1=analogRead(DECK_GPIO_RX1); // Reading the value of the sensor 1
}
void mySensorInit(DeckInfo *info)
{
pinMode(DECK_GPIO_RX1,INPUT); // Set my sensor 1 as an input
// Create and start the update timer with a period of 100ms
timer = xTimerCreate("irsensorTmr", M2T(100), pdTRUE, NULL, SensorValue);
xTimerStart(timer, 100);
}
static const DeckDriver mySensor_driver = {
.name = "myIrSensors",
.usedGpio = DECK_USING_RX1
.init = mySensorInit,
};
DECK_DRIVER(mySensor_driver);
// Add sensor reading as log variables
LOG_GROUP_START(myIrSensors)
LOG_ADD(LOG_FLOAT, range1, &range1)
LOG_GROUP_STOP(myIrSensors)
and here i ve add this to the makefile:
Code: Select all
# Decks
PROJ_OBJ_CF2 += bigquad.o
PROJ_OBJ_CF2 += exptest.o
PROJ_OBJ_CF2 += ledring12.o
PROJ_OBJ_CF2 += buzzdeck.o
PROJ_OBJ_CF2 += gtgps.o
PROJ_OBJ_CF2 += infrarot.o
but the command "crazyflie-firmware$ make" in the Shell only leads to "crazyflie-firmware$: command not found"
Where is my fault?
and is the enabling of the driver important..?
Re: sharp gp2y0a21yk0f
Posted: Fri Dec 18, 2015 8:21 pm
by chad
mannaris wrote:the command "crazyflie-firmware$ make" in the Shell only leads to "crazyflie-firmware$: command not found"
Where is my fault?
At the command prompt, are you actually typing "
crazyflie-firmware$ make"?
You should change into the directory "crazyflie-firmware" and only type "
make all" at the prompt. As in:
Code: Select all
cd ~/projects/crazyflie-firmware
make all
Re: sharp gp2y0a21yk0f
Posted: Fri Dec 18, 2015 10:34 pm
by mannaris
Then i got this:
Code: Select all
bitcraze@bitcraze-vm:~/projects/crazyflie-firmware$ make all
Makefile:347: tools/make/targets.mk: No such file or directory
make: *** No rule to make target 'tools/make/targets.mk'. Stop.
Re: sharp gp2y0a21yk0f
Posted: Fri Dec 18, 2015 10:52 pm
by chad
mannaris wrote:Then i got this:
Code: Select all
bitcraze@bitcraze-vm:~/projects/crazyflie-firmware$ make all
Makefile:347: tools/make/targets.mk: No such file or directory
make: *** No rule to make target 'tools/make/targets.mk'. Stop.
It sounds to me like either your checkout of the repository is broken or your Makefile broken. First do this... Type the following in the terminal:
Code: Select all
ls ~/projects/crazyflie-firmware/tools
The output should look the same as this:
If there's an error and you don't have a "tools" directory, refer to
this post in this thread.
If you do have a "tools" directory and your output is the same as above, check line #347 of the Makefile:
Code: Select all
nano +347 ~/projects/crazyflie-firmware/Makefile
The output should show the following above the cursor:
If it doesn't, you need to fix your Makefile.
Let us know how it goes.
Re: sharp gp2y0a21yk0f
Posted: Sun Dec 20, 2015 9:15 pm
by mannaris
typing
Code: Select all
ls ~/projects/crazyflie-firmware/tools
leads to:
Code: Select all
bitcraze@bitcraze-vm:~$ ls ~/projects/crazyflie-firmware/tools
ls: cannot access /home/bitcraze/projects/crazyflie-firmware/tools: No such file or directory
I am in the master branch and i have update all projects.
Re: sharp gp2y0a21yk0f
Posted: Sun Dec 20, 2015 10:13 pm
by chad
mannaris wrote:typing
Code: Select all
ls ~/projects/crazyflie-firmware/tools
leads to:
Code: Select all
bitcraze@bitcraze-vm:~$ ls ~/projects/crazyflie-firmware/tools
ls: cannot access /home/bitcraze/projects/crazyflie-firmware/tools: No such file or directory
I am in the master branch and i have update all projects.
Well, that indeed is the problem then. If you'll take a look at
the file hierarchy here on Github, you'll see the the repository
does have a tools directory. I'm left wondering two things:
1) Are the files and folders inside your crazyflie-firmware directory the same as what's shown on Github at the above link?
2) Could you have accidentally deleted directories from your repository clone?
If you run the following command in your terminal (while inside the crazyflie-firmware directory, of course) what does the output contain?
Re: sharp gp2y0a21yk0f
Posted: Tue Dec 22, 2015 5:47 pm
by mannaris
Then I got this:
Code: Select all
fatal: Not a git repository (or any of the parent directories): .git
Re: sharp gp2y0a21yk0f
Posted: Tue Dec 22, 2015 6:35 pm
by chad
Then I got this:
Code: Select all
fatal: Not a git repository (or any of the parent directories): .git
Hi mannaris, this is getting a bit tedious. It's obvious your git clone is destroyed somehow or you are having trouble using the VM or the command line. Let me ask you a few questions:
1) Are you
inside the crazyflie-firmware directory when you run the git status command. i.e.:
Code: Select all
cd ~/projects/crazyflie-firmware
git status
2) Are you sure this is a cloned repository or is it a downloaded zip file from Github? The latter doesn't have git repo information.
3) Have you viewed
the documentation on using git? It would go a long way for you to help yourself if you understood the tools you are working with.
4) Are you actually using the Bitcraze 0.6 VM? Unless you have significantly changed things, the VM is setup correctly to start with. You shouldn't be having the issues you are reporting if you're using the 0.6 VM
Let me suggest here that you start from scratch instead of using my time to hold your hand through each one of these basic problems. Download the VM again, run the update script on the desktop, then add your driver software and see what happens. You'll likely have better luck and be more successful if you have a clean starting point.