WebbotLib Project Designer
This Java application can be downloaded from here and will install shortcuts on your Desktop.
For a video tutorial then WebbotLib user Bill Porter has created this...
Step by step instructions ....
The Project Designer allows you to start from a board design and then add the relevant devices for your project.
The Project Designer comes with some 'built in' boards such as the Axon, Axon II, Roboduino etc or, if you have access to the Board Designer you can create your project from a custom board.
Projects can also be shared over the internet, even for custom boards, by the originator uploading a 'File, Export' to the web and the recipient using 'File, Open Project From URL'.
When starting a new project you need to specify the battery you are using. This helps to make sure that devices are connected to a suitable voltage.
You are then shown an image of your board along with all of the pin descriptions and whether they are available on header pins. Obviously some boards may have certain hardware built onto the board such as LEDs, switches, and USB connectors.
So the first thing you will want to do with your project is to add some devices to the board. This can be done by dragging and dropping them from the tree list of devices at the side of the window into the list of devices at the bottom.
Adding a new device will cause a new window to appear prompting you for a unique name of the device (as used by your C code) and also various settings depending on the kind of device. This can be things like uart details, pin numbers, adc channels etc.
Wherever relevant an image is shown showing you how to connect the device to your board as well as any DIP switch settings on the device itself.
Each of the options in the drop down is valid in its own right - ie an ADC input can only be connected to an ADC pin. However: there are several things that go wrong!! Assume you add an accelerometer requiring 3xADC pins - then you can choose the same ADC pin for all 3 or you may have another device that already uses the same ADC pins.
No worries - you can still add the device but you will note that the device has an error flag against it. And if it is upsetting another device then that also has an error flag.
As you add more devices you may get more and more errors - but dont worry! You can either fix these yourself by editing each device to have unique settings or try the 'Tools, Autoroute' function to automtically layout your devices so that there are no errors. Yes, thats right, let WebbotLib fix your errors before you even start your program!
The only caveat is that each device, motor, servo etc must have a unique name and the Autoroute function will not fix that for you. Why? Well these names are used by your C code so if I auto-changed them then your program would no longer compile.
Throughout the design process the application shows how much current is being drawn from each power source.
Alright: I've designed a project, removed all errors so now what?
Well the final stage is to use the Tools|Generate option to generate the source file into the same directory as your project.
This will create the following files:-
- hardware.h. This file should be included by your main C file
- xhardware.h. If your project is made up of many C files then all of your C files, except for the main one, should include this file instead
- example.txt. This text file gives an example of what your main WebbotLib C file should be doing and includes examples of how to handle the devices you have include in your project.
These three files will always be generated to reflect your current project design - so if you add new devices and generate some new code then you may want to refer to the latest example.txt to see how to access the new devices you have just added.
Equally you should never modify any of these files by hand as they will be overwritten the next time you generate the project.
If this is the very first time you have generated the code for your project then the following additional files will be produced:-
- An AVRStudio project file (if you are running on Windows)
- A C file with your appControl loop (this is the same as example.txt)
When looking at the WebbotLib documentation then please note that for a 'generated' project you no longer need to incude a sys/*.h file as all the info is in hardware.h or xhardware.h.Sounds fancy but whats the point? Well the point is that you can change one device for another compatible device and regenerate hardware.h. The rest of your code stays the same.
Yeah but WebbotLib already lets me do that - so what? WebbotLib has a lot of code to initialise things. Lets say you are using pwm for motors and servos and other stuff that requires timers. The existing WebbotLib does not know that until runtime and does what it can and may signal errors if it finds problems, The Project Designer Code Generation will find these errors at the point that you generate the code. This means I can get rid of all those checks from the runtime. So not only will Project Designer stop you from generating illegal code but the final compiled program may also be smaller.