Need help with development for the buzzer deck
-
- Member
- Posts: 31
- Joined: Sat Jan 23, 2016 5:38 pm
Need help with development for the buzzer deck
Hello, I just barely received a buzzer deck for my Crazyflie 2.0 and I wish to create my own melodies with it. The problem is that I can't seem to find any project folder in order to modify/create any melodies. My Crazyflie is currently able to run through my MacBook pro, I could never get the VM to work so I ended up installing the software natively. So I am at a dead end and I don't know how to continue. I installed Eclipse just yesterday and I have no idea where to start with it. So if I could please get some direction for what I need to do next in order to start buzzer deck development I'd sure appreciate it. Surely there is a way to get this working. Thank you for reading this.
-
- Member
- Posts: 31
- Joined: Sat Jan 23, 2016 5:38 pm
Re: Need help with development for the buzzer deck
Im still trying to figure out how to create project folders for development. This is just a shot in the dark, but I downloaded "Docker". I hope that was one step that was okay to do, it's just that I don't wish to clutter my computer up with unneeded files. Someone let me know how to work this whole Docker thing please. I have included a screenshot depicting my problem. It's saying something about an "alias", I literally have no idea what that means. I also think I have to do something at the root of a specific folder? I'm dying to get some insight on this before I make a big mistake or anything. I'll be waiting for any assistance, thank you.
-
- Bitcraze
- Posts: 630
- Joined: Tue Jun 30, 2015 7:47 am
Re: Need help with development for the buzzer deck
Hi!
I'm also on Mac and I created the docker flavour of the development environment to solve the problems you are facing. I wanted to minimise the number of applications/languages/frameworks to install on the system while staying in the Mac world of tools. I'm using the toolbelt to build the firmware but has settled for running the python library/client natively (installing the required dependencies using pip3).
Looks like you have installed docker and run the toolbelt, that's a good start. A bit further down in output from the toolbelt you should find the following lines
The toolbelt is using an alias to make it easy to run it. Just add
to one of the files that are loaded when your shell is started, I use ~/.profile. If ~/.profile does not exist, create a new file in your home folder named .profile and paste the line above into it, save and restart your terminal.
If all is good you should now be able to run the toolbelt using the alias "tb"
When I run it (located in the crazyflie-firmware directory) I get
The idea is that the toolbelt acts on the project in the current directory, so make sure you are located where you have cloned the firmware code.
To build the crazyflie binary:
To build the crayflie binary with 4 CPUs:
To clean the binaries there is no need to use the toolbelt (assuming you have developer tools installed)
If you have pip3 installed the python library you can flash the crazyflie using
Hope this helps to get the toolbelt up and running.
This post is growing, I'll write a second one on how to work with projects.
I'm also on Mac and I created the docker flavour of the development environment to solve the problems you are facing. I wanted to minimise the number of applications/languages/frameworks to install on the system while staying in the Mac world of tools. I'm using the toolbelt to build the firmware but has settled for running the python library/client natively (installing the required dependencies using pip3).
Looks like you have installed docker and run the toolbelt, that's a good start. A bit further down in output from the toolbelt you should find the following lines
Code: Select all
Installation on linux, OSX and Windows:
Add "alias tb='docker run --rm -it -e "HOST_CW_DIR=${PWD}" -e "CALLING_HOST_NAME=$(hostname)" -e "CALLING_UID"=$UID -e "CALLING_OS"=$(uname) -v ${PWD}:/tb-module -v ${HOME}/.ssh:/root/.ssh -v /var/run/docker.sock:/var/run/docker.sock bitcraze/toolbelt'" to your .profile or .bashrc
Code: Select all
alias tb='docker run --rm -it -e "HOST_CW_DIR=${PWD}" -e "CALLING_HOST_NAME=$(hostname)" -e "CALLING_UID"=$UID -e "CALLING_OS"=$(uname) -v ${PWD}:/tb-module -v ${HOME}/.ssh:/root/.ssh -v /var/run/docker.sock:/var/run/docker.sock bitcraze/toolbelt'
If all is good you should now be able to run the toolbelt using the alias "tb"
When I run it (located in the crazyflie-firmware directory) I get
Code: Select all
Kristoffers-MacBook-Air-2:crazyflie-firmware kristoffer$ tb
Usage: tb tool [arguments]
The toolbelt is used to develop, test and build Bitcraze modules. When the toolbelt is called, it will first try to find the tool in the belt, after that it will try the tools in the module if the working directory is the root of a module. Module tools are executed in the context of a docker container based on the module requirements configured in the module.json config file.
Tools in the belt:
help, -h, --help - Help
update - Update tool belt to latest version
version, -V, --version - Display version of the tool belt
ghrn - Generate release notes from github milestone
Tools in the current module:
build
clean
compile
make
test
To build the crazyflie binary:
Code: Select all
tb make
Code: Select all
tb make -j4
Code: Select all
make clean
Code: Select all
make cload
This post is growing, I'll write a second one on how to work with projects.
-
- Bitcraze
- Posts: 630
- Joined: Tue Jun 30, 2015 7:47 am
Re: Need help with development for the buzzer deck
Part 2, working with source code and the firmware
Start by getting the firmware from github
Change your working directory to the root of the code tree
Build the binaries
Put the crazyflie in boot loader mode (see https://www.bitcraze.io/getting-started ... /#bootload)
Flash the newly built binaries in the Crazyflie using the Crazyradio
The Crazyflie should restart and is now running the newly compiled firmware.
Editing the code
If you want to edit your code you are free to use any tool you like. In the VM we use Eclipse, I use IntelliJ, if you prefer anything else that is fine. The toolbelt are just working with the files in your file system.
Changing the buzzer melodies
All melodies are defined in the file src/modules/src/sound_cf2.c
To play a melody use the function
If you search the code base for soundSetEffect you will find examples of where it is used, for instance at start up.
Start by getting the firmware from github
Code: Select all
git clone https://github.com/bitcraze/crazyflie-firmware.git
Code: Select all
cd crazyflie-firmware
Code: Select all
tb make -j4
Flash the newly built binaries in the Crazyflie using the Crazyradio
Code: Select all
make cload
Editing the code
If you want to edit your code you are free to use any tool you like. In the VM we use Eclipse, I use IntelliJ, if you prefer anything else that is fine. The toolbelt are just working with the files in your file system.
Changing the buzzer melodies
All melodies are defined in the file src/modules/src/sound_cf2.c
To play a melody use the function
Code: Select all
soundSetEffect()
-
- Member
- Posts: 31
- Joined: Sat Jan 23, 2016 5:38 pm
Re: Need help with development for the buzzer deck
Code: Select all
[color=#00BF00]alias tb='docker run --rm -it -e "HOST_CW_DIR=${PWD}" -e "CALLING_HOST_NAME=$(hostname)" -e "CALLING_UID"=$UID -e "CALLING_OS"=$(uname) -v ${PWD}:/tb-module -v ${HOME}/.ssh:/root/.ssh -v /var/run/docker.sock:/var/run/docker.sock bitcraze/toolbelt'
[/color]
I didn't fully understand this particular step, do I just input this code above into the terminal? Also "loaded when your shell is started", what is the shell? I really appreciate your help, I just need this whole explanation put more into Layman's terms. I have all of my crazyflie files in one specific folder on my desktop, is this the "home folder" you are referring to?to one of the files that are loaded when your shell is started, I use ~/.profile. If ~/.profile does not exist, create a new file in your home folder named .profile and paste the line above into it, save and restart your terminal.
We should be able to resolve this soon, thank you for your patience with a noobie like me.
-
- Member
- Posts: 31
- Joined: Sat Jan 23, 2016 5:38 pm
Re: Need help with development for the buzzer deck
Okay, somehow I got to this step, but I'm not sure which location I "cloned" the firmware code. I'm so close to getting this working.
-
- Member
- Posts: 31
- Joined: Sat Jan 23, 2016 5:38 pm
Re: Need help with development for the buzzer deck
This is just all over my head, i try using the cfclient and I'm getting "env: python3: No such file or directory" I about at my whits end, if you're able to help me that would be great.
-
- Bitcraze
- Posts: 630
- Joined: Tue Jun 30, 2015 7:47 am
Re: Need help with development for the buzzer deck
To move forward in a smooth way, you probably want to read up a bit on unix, what can be done in a terminal, shells, basic scripting and such. Some examples could beI didn't fully understand this particular step, do I just input this code above into the terminal? Also "loaded when your shell is started", what is the shell? I really appreciate your help, I just need this whole explanation put more into Layman's terms. I have all of my crazyflie files in one specific folder on my desktop, is this the "home folder" you are referring to?
* http://www.ee.surrey.ac.uk/Teaching/Unix/
* http://ryanstutorials.net/bash-scripting-tutorial/
* http://blog.teamtreehouse.com/introduct ... mmand-line
* http://www.theunixschool.com/2011/07/wh ... -file.html
Hopefully the tutorials above will help you find the tools you need to find your way around your file system using the terminal.Okay, somehow I got to this step, but I'm not sure which location I "cloned" the firmware code. I'm so close to getting this working.
When you "git cloned" the repository you should get a new directory with the same name as the repository in your current working directory.
Code: Select all
cd crazyflie-firmware
I'm not really sure why you get this error. How did you install the client? Did you follow the instructions in https://github.com/bitcraze/crazyflie-clients-python?i try using the cfclient and I'm getting "env: python3: No such file or directory"
-
- Member
- Posts: 31
- Joined: Sat Jan 23, 2016 5:38 pm
Re: Need help with development for the buzzer deck
I don't even know what I'm doing anymore, I'm just so inferior to all of you coding geniuses. I think I'm just going to completely restore my Mac (again) because I feel like I've installed a bunch of bull crap on my laptop. I went to github.com/thoughtbot/laptop and I don't even know why. Who knows I probably installed like 10 things and for what? Just to be at the rock bottom of confusion again? If you feel so inclined I guess try and help me. Waste your time I guess. I simply wanted to change sounds on a stupid little buzzer deck and this is what I get. I've about had it with this bull crap! Hours wasted just trying anything at all.
-
- Bitcraze
- Posts: 630
- Joined: Tue Jun 30, 2015 7:47 am
Re: Need help with development for the buzzer deck
I understand your frustration!
We feel really bad that our VM is not currently working as intended on OSX (see https://github.com/bitcraze/bitcraze-vm/issues/31). The VM was intended to support users like you by providing a development environment that is easy to set up and play with.
Sorry about this and let us hope the problem will be fixed in the future.
We feel really bad that our VM is not currently working as intended on OSX (see https://github.com/bitcraze/bitcraze-vm/issues/31). The VM was intended to support users like you by providing a development environment that is easy to set up and play with.
Sorry about this and let us hope the problem will be fixed in the future.