Need help with development for the buzzer deck

Post here to get support
TheYoyoFreak
Member
Posts: 31
Joined: Sat Jan 23, 2016 5:38 pm

Need help with development for the buzzer deck

Post by TheYoyoFreak »

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.
TheYoyoFreak
Member
Posts: 31
Joined: Sat Jan 23, 2016 5:38 pm

Re: Need help with development for the buzzer deck

Post by TheYoyoFreak »

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.
Screen Shot 2017-06-18 at 10.26.19 PM.png
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: Need help with development for the buzzer deck

Post by kristoffer »

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

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
The toolbelt is using an alias to make it easy to run it. Just add

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'
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

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
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:

Code: Select all

tb make
To build the crayflie binary with 4 CPUs:

Code: Select all

tb make -j4
To clean the binaries there is no need to use the toolbelt (assuming you have developer tools installed)

Code: Select all

make clean
If you have pip3 installed the python library you can flash the crazyflie using

Code: Select all

make cload
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.
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: Need help with development for the buzzer deck

Post by kristoffer »

Part 2, working with source code and the firmware

Start by getting the firmware from github

Code: Select all

git clone https://github.com/bitcraze/crazyflie-firmware.git
Change your working directory to the root of the code tree

Code: Select all

cd crazyflie-firmware
Build the binaries

Code: Select all

tb make -j4
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

Code: Select all

make cload
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

Code: Select all

soundSetEffect()
If you search the code base for soundSetEffect you will find examples of where it is used, for instance at start up.
TheYoyoFreak
Member
Posts: 31
Joined: Sat Jan 23, 2016 5:38 pm

Re: Need help with development for the buzzer deck

Post by TheYoyoFreak »

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]
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.
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?

We should be able to resolve this soon, thank you for your patience with a noobie like me.
TheYoyoFreak
Member
Posts: 31
Joined: Sat Jan 23, 2016 5:38 pm

Re: Need help with development for the buzzer deck

Post by TheYoyoFreak »

Screen Shot 2017-06-19 at 4.03.53 PM.png
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.
TheYoyoFreak
Member
Posts: 31
Joined: Sat Jan 23, 2016 5:38 pm

Re: Need help with development for the buzzer deck

Post by TheYoyoFreak »

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.
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: Need help with development for the buzzer deck

Post by kristoffer »

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 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 be
* 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
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.
Hopefully the tutorials above will help you find the tools you need to find your way around your file system using the terminal.
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
should take you to the newly cloned file tree.
i try using the cfclient and I'm getting "env: python3: No such file or directory"
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?
TheYoyoFreak
Member
Posts: 31
Joined: Sat Jan 23, 2016 5:38 pm

Re: Need help with development for the buzzer deck

Post by TheYoyoFreak »

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! :evil: Hours wasted just trying anything at all.
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

Re: Need help with development for the buzzer deck

Post by kristoffer »

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.
Post Reply