FAQ
From jderobot
The very beggining
What is this FAQ for?
This FAQ aims to solve some questions about:
- using the tools around Jde project like Svn, Trac, MediaWiki, Blog, etc
- using third-party software like Gazebo, Player, OpenGL, etc..
- it also explains some good community conventions and good practices.
For a detailed description about using JDE software or programming applications with JDE, better check the Manual page.
What is JDE?
This is better explained at the Manual page.
How can I download and compile JDE?
This is better explained at the Manual page.
Player, Stage and Gazebo
Stage is a multiple robot 2D simulator and Gazebo is a multiple robot 3D simulator. Player provides a network interface to a variety of robot and sensor hardware. It has become a de facto standard in robotics. They all belongs to the same open source project, check their official web page for further details and downloads.
JDE works fine with these three robotic tools. It may smoothly use Player-2.0.5, Stage-2.0.4 and Gazebo-0.7.
If you are going to work only with Player and Stage, the releases Player-2.1.1 and Stage-3.0.1 and known to work fine with JDE-4.3, but they are not compatible with Gazebo-0.7.
How to install Stage 2.0.4 and Player 2.0.5 on Ubuntu 8.04
The following directions are also valid for Stage-2.0.3 and Player-2.0.3. In order to install them:
(0) Install some packages they depend on, like gtk libraries:
# apt-get install build-essential libltdl3 libltdl3-dev libgtk2.0-dev libgtkglext1 libgtkglext1-dev libglade2-dev
(1) Download their tarballs from their official webpage. Maybe you will have to digg a little bit as they are now very old releases.
(2) Install player
$ bunzip2 player-2.0.5.tar.bz2 $ tar -xvf player-2.0.5.tar $ cd player-2.0.5 $ ./configure $ make # make install
In some cases, due to compilation errors, you should run "./configure --disable-erratic". Player is a very modular system. The compilation of its "erratic" component, which provides support for the Erratic robot from Videre, results in some compilation errors in player-2.0.3. We don't have such robot, so, just disable its compilation.
(3) Install stage
$ bunzip2 stage-2.0.4.tar.bz2 $ tar -xvf stage-2.0.4.tar $ cd stage-2.0.4 $ ./configure $ make # make install
By default, they will be installed at /usr/local, but this can be changed.
To check if the installation is successful, just run the following demo program. Before that just change the line with "gui_disable 1" by "gui_disable 0" in the worlds/simple.world file. A small robot should appear and move fast through a simulated world.
$ src/stest worlds/simple.world robot1
(4) You should export the environment variables PATH and LD_LIBRARY_PATH
$ export PATH=/usr/local/bin:$PATH $ export LD_LIBRARY_PATH=/usr/local/lib/
(5) In some Ubuntu machines you may find this error: err: unable to open color database /usr/X11R6/lib/X11/rgb.txt : No such file or directory (stage.c stg_lookup_color) Segmentation fault (core dumped) In such a case just make a symbolic link to help it to locate rgb.txt. Something like:
# ln -s /usr/lib/X11/rgb.txt /usr/X11R6/lib/X11/rgb.txt
If there is no rgb.txt file in your machine use this one and copy it at the /usr/X11R6/lib/X11 directory.
(6) Run player with a configuration file that tells it to use Stage and a simulated world named simple.cfg
$ player /usr/local/share/stage/worlds/simple.cfg
Lucky enough, you should see something like
jmplaza@minimac:~/research/software/stage/stage-2.0.4$ player worlds/simple.cfg Player v.2.0.5 * Part of the Player/Stage/Gazebo Project [http://playerstage.sourceforge.net]. * Copyright (C) 2000 - 2006 Brian Gerkey, Richard Vaughan, Andrew Howard, * Nate Koenig, and contributors. Released under the GNU General Public License. * Player comes with ABSOLUTELY NO WARRANTY. This is free software, and you * are welcome to redistribute it under certain conditions; see COPYING * for details. trying to load /home/jmplaza/research/software/stage/stage-2.0.4/worlds/libstageplugin... trying to load /usr/local/lib/libstageplugin... success invoking player_driver_init()... Stage driver plugin init ** Stage plugin v2.0.4 ** * Part of the Player/Stage Project [http://playerstage.sourceforge.net] * Copyright 2000-2006 Richard Vaughan, Andrew Howard, Brian Gerkey * and contributors. Released under the GNU General Public License v2. success Stage driver creating 1 device 6665.31.0 is a Stage world [Loading worlds/simple.world][Include pioneer.inc][Include map.inc][Include sick.inc] Stage driver creating 1 device 6665.42.0 is "cave" Stage driver creating 2 devices 6665.4.0 is "robot1" 6665.6.0 is "robot1.laser:0" Listening on ports: 6665
![]() |
| |
|
|
|
|
How to install Gazebo 0.7 on a Ubuntu 8.04
Gazebo is a very nice open source 3D simulator. It depends on many software packages.
(1) Install OpenGL
Gazebo image rendering (both for simulated cameras or for the human observer camera) lies on top of OpenGL. To install OpenGL on your machine just follow [this FAQ entry]
(2) Install several software packages:
# apt-get install libgnomecanvas2-dev ffmpeg python2.5-dev libxml2 libxml2-dev libxmu-dev libxmu-headers libxt-dev libxpm-dev
(3) Install SWIG (Simplified Wrapper adn Interface Generator)
# apt-get install swig
(4) Install wxPython (Python bindings for wxWidgets)
wxPython is required for wxgazebo to run, that is the simulator and a GUI for the human user to see the simulated world.
# apt-get install python-wxgtk2.8 python-wxtools python-wxaddons wx2.8-i18n
The python-wxgtk2.8 has a known bug. Just modify the file /usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wxPython/_misc.py changing the line with:
wxDateTime_GetNumberOfDaysinYear = wx._misc.DateTime_GetNumberOfDaysinYear
by this one:
wxDateTime_GetNumberOfDaysInYear = wx._misc.DateTime_GetNumberOfDaysInYear
(note the capital "InYear")
(5) Install ODE (Open Dynamics Engine)
You should download de ode-0.7 release from the official ODE site. Releases newer than 0.7 will not work with gazebo-0.7. For instance, ode-0.8 results in runtime errors when executing gazebo, and ode-0.10.1 results in compilation errors when making gazebo-0.7.
$ unzip ode-src-0.7.zip $ cd ode-0.7 $ ./configure $ make # make install
(6) Install Gdal library (Geospatial Data Abstraction Library)
# apt-get install gdal-bin python-gdal libgdal1-1.4.0 libgdal1-dev
(7) Install Gazebo-0.7 itself
$ tar -zxvf gazebo-0.7.0.tar.gz $ cd gazebo-0.7.0 $ ./configure $ make # make install
(8) Run gazebo with a sample file
$ wxgazebo worlds/pioneer2dx.world
Hopefully you will see something like the following image:
![]() |
| |
|
|
|
|
How to install Gazebo 0.7 on a Ubuntu 8.10
The installation of Gazebo 0.7 on Ubuntu 8.10 is almost the same that in the version 8.04, with only a little difference, at step 6.
(6) Install Gdal library (Geospatial Data Abstraction Library)
# apt-get install gdal-bin python-gdal libgdal1-1.5.0 libgdal1-dev
Configuration files for Gazebo 0.7
Here you can find several sample worlds. For instance, pioneer2dx-rendering.world is basically the pioneer2dx.world file at the worlds directory of gazebo source code with the following line added for the observer camera:
<renderMethod>xlib</renderMethod>
As the Gazebo documentation states, 0.7 support four different rendering methods: glx, glxp, xlib and sgix. Modify that file in order to test whether your system supports those rendering methods. Probably, your system will support only one of this rendering methods, don't worry.
How to install Stage 3.0.1 and Player 2.1.1
If you can't install the oldest version of Player and Stage then you can follow this steps to install the lastest released version of those tools.
1. Installing Player 2.1.1
You can find a packaged of Player 2.1.1 on this link: http://sourceforge.net/project/showfiles.php?group_id=42445
And now you only must follow the installation manual here: http://playerstage.sourceforge.net/doc/Player-2.1.0/player/install.html
2. Installing Stage 3.0.1
Like with Player you can fin a packaged of Stage 3.0.1 on this link: http://sourceforge.net/project/showfiles.php?group_id=42445
And the installation manual in this link: http://playerstage.sourceforge.net/doc/stage-3.0.1/install.html
3. Running Player
To run Player you need a configuration file, are in the directory ../Stage-3.0.1-Source/worlds, so you must be place in this directory to run Player with your prefer world.
- NOTE:
This version isn't tested at 100% so is highly recommended visit the web site of the project to solve any problem in the next link: http://playerstage.sourceforge.net/
3. Pioneer Configuration File
We can find the pioneer configuration file on this path /usr/local/share/player/config/pioneer.cfg. The default configuration is:
driver
(
name "p2os"
provides ["odometry:::position2d:0"
"compass:::position2d:1"
"gyro:::position2d:2"
"sonar:0"
"aio:0"
"dio:0"
"power:0"
"bumper:0"
"gripper:::gripper:0"
"blobfinder:0"
"sound:0"
]
port "/dev/ttyS0"
)
driver
(
name "sicklms200"
provides ["laser:0"]
port "/dev/ttyS2"
)
But now, because of we use a new scanning laser (Hokuyo), the configuration file must be like this:
driver
(
name "p2os"
provides ["odometry:::position2d:0"
"power:0"
"bumper:0"
]
port "/dev/ttyS0"
)
driver
(
name "urglaser"
provides ["laser:0"]
port "/dev/ttyACM0"
pose [0.0 0.0 0.0]
baud "19200"
min_angle -90.0
max_angle 90.0
alwayson 1
)
The Pioneer platform is connected by serial port (S0) and the new Hokuyo laser by USB (ACM0). Sometimes we'll have to change it by ACM1 (thanks to Ubuntu features...). And we don't recommended to change the rest of parameters (baud, min_angle, max_angle and alwayson); the device can stop working.
How to install Gazebo 0.8 on a Ubuntu 8.04
Gazebo is a very nice open source 3D simulator. It depends on many software packages.
Some new features of 0.8 version are:
· New Stereo camera model: generates stereo image pairs, disparity and depth maps.
· New Completely re-written GUI using wxPython: most devices can now be directly controlled/inspected through the simulator GUI (it needn't wxgazebo to display the GUI).
· New Plugin models: users can develop their own robot/sensor models, and have these models loaded dynamically at run time.
· New Skins: simple geometric models may be augmented with realisitc 'skins' from 3D modelling programs.
Install OpenGL
Gazebo image rendering (both for simulated cameras or for the human observer camera) lies on top of OpenGL. To install OpenGL on your machine just follow this FAQ entry
Install Player (>= 2.1.1)
Visit this FAQ entry.
Install required libraries
# apt-get install libboost-dbg libboost-dev libboost-python-dev libboost-python1.34.1 libxaw-headers libxaw7 libxaw7-dbg # libmng-dev libtiff4-dev libxxf86vm-dev libxml2 libxaw7-dev nvidia-cg-toolkit
scons (>= 0.97)
# aptitude install scons
fltk ( >= 1.1.7)
You can download it from here.
# ./configure # make # make install
Ode ( >= 0.8)
You can download it from here.
# sh autogen.sh # ./configure --enable-double-precision --with-trimesh=opcode # make # make install
Ogre
If you want to install Gazebo 0.8-pre3, then your version of ogre should be 1.5. If you want to Gazebo SVN, then your version of ogre should be 1.6.
Dependences
- zziplib
You can download it from here.
# ./configure
# sudo make
# sudo make install
# sudo nano /usr/local/lib/pkgconfig/zziplib.pc
# After the line prefix= add datarootdir=${prefix}/share
# PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
- FreeImage (>= 3.10)
You can download it from here.
# make # sudo make install
- Ois (>= 1.10 )
You can download it from here.
# ./bootstrap # ./configure # make # make install
Now, We can install ogre libraries.
# ./bootstrap # make # sudo make install
Install gazebo
Now, we are going to install gazebo. Remember, if you have installed ogre 1.5, you have to install gazebo 0.8-pre3, you can download onhttp://sourceforge.net/project/showfiles.php?group_id=42445 . But, if you have installed ogre 1.6, you have to download the sources via svn:
svn co https://playerstage.svn.sourceforge.net/svnroot/playerstage/code/gazebo/trunk gazebo
To install gazebo:
# export PATH=/usr/local/bin:$PATH # export CPATH=/usr/local/include:$CPATH # export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH # export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
# scons # scons install (as root) # gazebo /usr/local/share/gazebo/worlds/pioneer.world
After install if you want try gazebo you must type this on gazebo folder:
gazebo worlds/pioneer2at.world
Troubleshoot
Gazebo compilation errors related to boost library
Solution:
1. Download boost (>=1.35.0) library from here.
2. Build the library.
3. Make sure it has been installed at the path where gazebo will search it: /usr/local/include/boost. It is likely that it has been installed at /usr/local/include/boost-<version>/boost, so you should fix it through a symbolic link.
4. Rebuild gazebo.
Gazebo install error
Error:
scons: *** [install] /usr/local/share/gazebo/Media: Is a directory scons: building terminated because of errors.
Solution:
This is not a real error, directories are copied to install path though, but the build process is interrupted, probably prematurely. To fix it, simply run 'scons install' twice.
Gazebo running error because of library path
Error:
$ gazebo /usr/local/share/gazebo/worlds/pioneer2dx.world gazebo: error while loading shared libraries: libgazebo.so: cannot open shared object file: No such file or directory
Solution:
export LD_LIBRARY_PATH=/usr/local/lib
Gazebo running error
Error:
$ gazebo worlds/pioneer2at.world ... [server/GazeboConfig.cc:84] Gazebo Path[/usr/local/share/gazebo] [server/GazeboConfig.cc:92] Ogre Path[/usr/local/lib/OGRE] terminate called after throwing an instance of 'int' Aborted
Solution:
Make sure you have installed FreeImage version (>= 3.10).
How to install on Ubuntu 9.04
Player 2.0.5
(1) Download Player 2.0.5
wget http://freefr.dl.sourceforge.net/sourceforge/playerstage/player-2.0.5.tar.bz2
(2) Install player.
bunzip2 player-2.0.5.tar.bz2 tar xvf player-2.0.5.tar cd player-2.0.5
You have to add includes to some files, you can do it modifying the files or executing those commands in a shell:
fichero=`mktemp` echo "#include <cstdlib>" >> $fichero cat server/drivers/mixed/erratic/erratic.cc >> $fichero mv $fichero server/drivers/mixed/erratic/erratic.cc fichero=`mktemp` echo "#include <cstring>" >> $fichero cat client_libs/libplayerc++/actarrayproxy.cc >> $fichero mv $fichero client_libs/libplayerc++/actarrayproxy.cc fichero=`mktemp` echo "#include <cstring>" >> $fichero cat examples/libplayerc++/clientgraphics.cc >> $fichero mv $fichero examples/libplayerc++/clientgraphics.cc fichero=`mktemp` echo "#include <cstring>" >> $fichero cat client_libs/libplayerc++/test/test.cc >> $fichero mv $fichero client_libs/libplayerc++/test/test.cc ./configure make sudo make install
Stage 2.0.4
(3) Install stage 2.0.4
sudo aptitude install libstage2 libstage2-dev libstageplugin1 libstage-dev wget http://freefr.dl.sourceforge.net/sourceforge/playerstage/stage-2.0.4.tar.bz2 bunzip2 stage-2.0.4.tar.bz2 tar xvf stage-2.0.4.tar cd stage-2.0.4 ./configure make sudo make install
Gazebo and Wxgazebo
OpenGL
(4)Install OpenGL
sudo apt-get install libgl1-mesa-dev libgl1-mesa-glx mesa-common-dev gle-doc sudo apt-get install libglu1-mesa libglu1-mesa-dev sudo apt-get install freeglut3 freeglut3-dev freeglut3-dbg libglut3 libglut3-dev glut-doc glutg3-dev
ODE
(5) Install ODE (Open Dynamics Engine)
wget http://freefr.dl.sourceforge.net/sourceforge/opende/ode-src-0.7.zip unzip ode-src-0.7.zip cd ode-0.7 ./configure make sudo make install
Gdal
(6) Install Gdal (Geospatial Data Abstraction Library)
sudo apt-get install gdal-bin python-gdal libgdal1-1.5.0 libgdal1-dev
SWIG
(7) Install Swig (Simplified Wrapper adn Interface Generator)
sudo apt-get install swig
(8) Install gazebo needed libraries (python, wxpython...)
sudo apt-get install python-wxgtk2.8 python-wxtools python-wxaddons wx2.8-i18n sudo apt-get install libgnomecanvas2-dev ffmpeg python2.5-dev libxml2 libxml2-dev libxmu-dev libxmu-headers libxt-dev libxpm-dev python2.6-dev
(9) Install gazebo
wget http://freefr.dl.sourceforge.net/sourceforge/playerstage/gazebo-0.7.0.tar.gz tar zxvf gazebo-0.7.0.tar.gz cd gazebo-0.7.0 ./configure make sudo make install
(10)Configuring rgb: There are some problems with the rgb.txt file. You must copy this file to some directories. If there is no rgb.txt file in your machine use this one.
wget sudo rm /usr/share/X11/rgb.txt sudo cp rgb.txt /usr/share/X11/ sudo mkdir /usr/X11R6/lib/ sudo mkdir /usr/X11R6/lib/X11/ sudo cp rgb.txt /usr/X11R6/lib/X11/ sudo chmod 777 /usr/X11R6/lib/X11/rgb.txt
If you have problems running wxgazebo and me error message is like: "no module named wxgazebo.main" is that the python paht is not correct. You have to run:
locate gazebo.py
And then you have to export a variable called PYTHONPATH with the folder where gazebo.py is located. Maybe it will be something like:
export PYTHONPATH=/usr/local/lib/python2.x/site-packages
How to install on Ubuntu 9.10
Gazebo and Wxgazebo
The steps to take to install Gazebo are the same to install it on Ubuntu 9.04, except that it's not installed the "gazebo.py" file. You need to create the variable PYTHONPATH anyway but not with that path.
export PYTHONPATH=/usr/lib/python2.x/site-packages
OpenGL
What is OpenGL? What's new in OpenGL?
OpenGL is the industry's most widely used, supported and best documented 2D/3D graphics API making it inexpensive & easy to obtain information on implementing OpenGL in hardware and software. There are numerous books, tutorials, online coding examples, coding seminars, and classes that document the API, Extensions, Utility Libraries, and Platform Specific Implementations.
OpenGL (for "Open Graphics Library") is a software interface to graphics hardware. The interface consists of a set of several hundred procedures and functions that allow a programmer to specify the objects and operations involved in producing high-quality graphical images, specifically color images of three-dimensional objects.
How do I get the OpenGL libs?
You only need to download the next packages:
# apt-get install libgl1-mesa-dev libgl1-mesa-glx mesa-common-dev gle-doc # apt-get install libglu1-mesa libglu1-mesa-dev # apt-get install freeglut3 freeglut3-dev freeglut3-dbg libglut3 libglut3-dev glut-doc glutg3-dev
Does my system have accelerated graphics?
Check whether you have accelerated graphics on your system or not. Your graphics driver should support it. In the case of not having accelerated graphics all the OpenGL rendering will be performed by the CPU, slowing down the execution. You can probe it with:
$ glxinfo | grep direct
It should display something like: "direct rendering: Yes". That means that all the rendering is done by the GPU (not the CPU) and your application will run faster. You can see how fast your acceleration is running "glxgears". A number greater than 1000 FPS is good.
How can I start?
Here, you've a simple OpenGL code. This code just creates a window and draws a rectangle in it.
#include <gl/gl.h>
#include <gl/glut.h>
void init(void);
void display(void);
int main (int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(250, 250);
glutInitWindowPosition(100, 100);
glutCreateWindow("My First OpenGL Application");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
void init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glColor3f(0.0, 0.0, 1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-10.0, 10.0, -10.0, 10.0, -10.0, 10.0);
}
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glRectf(-5.0, 5.0, 5.0, -5.0);
glutSwapBuffers();
}
Now, we're going to describe this step by step. First, I called the glutInit function, which provides general initialization for the GLUT library:
glutInit(&argc, argv);
Next I initialize the display mode:
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
This tells OpenGL that I want a double buffered window, with RGB color. The next few lines create the window:
glutInitWindowSize(250, 250);
glutInitWindowPosition(100, 100);
glutCreateWindow("My First OpenGL Application");
As you can see, with GLUT this is fairly straightforward. Now it's time to initialize OpenGL. Here's the code:
void init(void) {
glClearColor(0.0, 0.0, 0.0, 0.0); /* set the background (clearing) color to RGB(0,0,0) -- black */
glColor3f(0.0, 0.0, 1.0); /* set the foreground color to blue */
glMatrixMode(GL_PROJECTION); /* Initialize the matrix state */
glLoadIdentity();
glOrtho(-10.0, 10.0, -10.0, 10.0, -10.0, 10.0);
}
In OpenGL, matrices are used to manage the view. There are two matrix modes, projection and modelview. Projection is used to set up the viewport and clipping boundry, while modelview is used to rotate, translate and scale objects quickly. Lets take a look at these two lines:
glLoadIdentity(); glOrtho(-10.0, 10.0, -10.0, 10.0, -10.0, 10.0);
glLoadIdentity() loads the identity matrix into the current matrix state (in this case the projection matrix). You can consider this the resetting matrix... it resets everything back to zero. Next comes the call to glOrtho. This function sets up a clipping volume. You can think of a clipping volume as a box in which your drawing commands are rendered. As the viewer, we are positioned outside the box, looking in the front. What we see is whatever is inside the box, projected onto the flat surface that is the side. Anything outside the box is invisible. The glOrtho function creates an orthographic view -that is, one with no perspective. We'll get to perspective drawing later in the tutorial.
The arguments for glOrtho are as follows:
void glOrtho(double left, double right, double bottom, double top, double near, double far);
Now, lets continue with the application:
glutDisplayFunc(display); glutMainLoop();
The first function sets the function that GLUT will use whenever it needs to update the view. We then call glutMainLoop() which actually runs the program. From this point on our work is done; GLUT will handle the details of managing the window and calling our painting function to display it. Here is the display function again:
void display(void) {
glClear(GL_COLOR_BUFFER_BIT);
glRectf(-5.0, 5.0, 5.0, -5.0);
glutSwapBuffers();
}
The first thing we do is call glClear with GL_COLOR_BUFFER_BIT parameter. This will clear the window with the color we specified earlier using glClearColor. Next, we actually draw our rectangle, using the glRectf function.
Now is the time I should bring up something about OpenGL function calls, because they often come in different forms. For example, take glColor, which sets the current foreground color. This function has several prototypes, for example:
glColor3f(float, float, float); glColor4f(float, float, float, float); glColor3d(double, double, double); glColor3i(int, int, int); ...
As you can see, OpenGL functions are usually formatted like this:
gl Color 3 f
However, even though most OpenGL functions can accept any type, it's usually best to pass floats. OpenGL uses floating point values for all its internal calculations, so passing any other type is a waste of time since OGL will just convert it back to floating point anyway.
The next function:
glutSwapBuffers();
swaps the back buffer to the screen buffer. In double-buffered mode, the drawing commands do not draw to the screen. Rather, they draw to an offscreen buffer. Once you are done drawing, you copy the entire back buffer to the screen at once, thus producing smooth animation. Of course, in this simple example there is no animation, but without a double buffer even moving the window around the screen will cause the rectangle to flicker. Besides, it's good to get into the habit of producing smooth graphics!
Points, Lines, and Polygons
You will find drawing to a 3D canvas is in fact very similar to plain old 2D applications. This is because OpenGL uses a coordinate system called the Cartesian plane. The difference here is that instead of having two axis which stretch horizontally and vertically, we add a third axis, the z (or depth) axis. You can think of this as a line which runs through the origin (0,0 on a Cartesian coordinate system), going in the direction from away from you to straight towards you (in OpenGL, the positive z-axis always points towards you, while the negative points away). Using this system, we can represent a point in 3D space, called a "vertex", with three coordinates, representing x, y, and z.
We can use the function glVertex to specifiy vertices, flanked by calls to glBegin and glEnd:
glBegin(GL_POINTS); /* We want to draw points */ glVertex3f(2.0, 0.0, 4.0); /* Specify a couple of vertices */ glVertex3f(3.0, -4.0, -2.0); glEnd(); /* End points */
As you can see, glBegin tells OpenGL we want to start drawing (as well as WHAT we want to start drawing), and glEnd tells it to stop. The great thing about OGL's method of 3D drawing is it's flexibility; lets say we want to draw some lines:
glBegin(GL_LINES); /* lets do some lines now */ glVertex3f(6.0, 4.0, 2.0); /* here's one */ glVertex3f(2.0, -4.0, 3.3); glVertex3f(5.0, 8.0, 8.0); /* here's another */ glVertex3f(-4.7, 5.0, -3.0); glVertex3f(0.0, 0.0, 0.0); /* and another! */ glVertex3f(6.0, -1.0, -7.0); glEnd();
Note that we now have one line for every two vertices. If you specify an odd number, the last vertex is ignored. Now lets do some shapes. OpenGL specifies 6 different polygon primitives: GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_QUADS, GL_QUAD_STRIP, and GL_POLYGON. Triangle and quad strips are shortcuts for building polygons next to each other, and likewise a triangle fan is a group of triangles that share a center point. GL_POLYGON can specify a general polygon with any number of vertices. The one you should use most often is GL_TRIANGLES, since most graphic accelerators are optimized for triangle operations. Here's an example of a generic triangle:
glBegin(GL_TRIANGLES); glVertex3f(-3.0, -3.0, 2.0); glVertex3f(3.0, -3.0, -1.0); glVertex3f(0.0, 3.0, 4.0); glEnd();
Now, I present a new example. In this example I've created an abstract shape made out of one square surrounded by four triangles. One point of the triangles is red, while the other two are blue. This creates a smoothing purple effect across the face of the triangle.
I'm also using this example to demonstrate some of the UI routines that GLUT uses. In this case we are going to be using the function glutKeyboardFunc(). This function defines a callback handler that will be called whenever a key is pressed while our window has focus.
#include <windows.h>
#include <gl\gl.h>
#include <gl\glut.h>
void init (void);
void display (void);
void keyboard (unsigned char, int, int);
int main (int argc, char **argv) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(600, 600);
glutInitWindowPosition(50, 50);
glutCreateWindow("A 3D Object");
init();
glutDisplayFunc(display);
glutKeyboardFunc(keyboard); /* set keyboard handler */
glutMainLoop();
return 0;
}
void init(void) {
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-15.0, 15.0, -15.0, 15.0, -15.0, 15.0);
}
void display(void) {
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_QUADS);
glColor3f(0.0, 0.0, 1.0); /* center square */
glVertex3f(-3.0, -3.0, 0.0);
glVertex3f(3.0, -3.0, 0.0);
glVertex3f(3.0, 3.0, 0.0);
glVertex3f(-3.0, 3.0, 0.0);
glEnd();
glBegin(GL_TRIANGLES);
glColor3f(1.0, 0.0, 0.0); /* now draw the four triangles */
glVertex3f(0.0, 6.5, 0.0);
glColor3f(0.0, 0.0, 0.9f);
glVertex3f(-3.0, 3.0, 0.0);
glVertex3f(3.0, 3.0, 0.0);
glColor3f(0.0, 0.0, 0.9f);
glVertex3f(-3.0, -3.0, 0.0);
glVertex3f(-3.0, 3.0, 0.0);
glColor3f(1.0, 0.0, 0.0);
glVertex3f(-6.5, 0.0, 0.0);
glColor3f(1.0, 0.0, 0.0);
glVertex3f(0.0, -6.5, 0.0);
glColor3f(0.0, 0.0, 0.9f);
glVertex3f(3.0, -3.0, 0.0);
glVertex3f(-3.0, -3.0, 0.0);
glColor3f(1.0, 0.0, 0.0);
glVertex3f(6.5, 0.0, 0.0);
glColor3f(0.0, 0.0, 0.9f);
glVertex3f(3.0, 3.0, 0.0);
glVertex3f(3.0, -3.0, 0.0);
glEnd();
glutSwapBuffers();
}
void keyboard(unsigned char key, int x, int y)
{
/* this is the keyboard event handler
the x and y parameters are the mouse
coordintes when the key was struck */
switch (key)
{
case 'u':
case 'U':
glRotatef(3.0, 1.0, 0.0, 0.0); /* rotate up */
break;
case 'd':
case 'D':
glRotatef(-3.0, 1.0, 0.0, 0.0); /* rotate down */
break;
case 'l':
case 'L':
glRotatef(3.0, 0.0, 1.0, 0.0); /* rotate left */
break;
case 'r':
case 'R':
glRotatef(-3.0, 0.0, 1.0, 0.0); /* rotate right */
}
display(); /* repaint the window */
}
Perspective, Animation, and Depth Testing
In OpenGL the only thing required to use perspective is to set up the clipping volume for that operation. This can sometimes be tricky, since instead of a cube, a perspective clipping volume is actually sort of a truncated pyramid, called a frustum. The typical OGL function to do this is glFrustum, shown here:
void glFrustum(double left, double right, double bottom, double top, double near, double far);
In this case, near and far are the distances to the front and back clipping planes. This function may look simple at first, but it gets tricky once you start dealing with windows that can be resized, etc. A far better solution is gluPerspective:
void gluPerspective(double fovy, double aspect, double near, double far);
Now, if you know how to rotate each individual vertex around a circle (using the cosine and sine to determine the x and y coordinites), you can rotate the entire object in this manner. The problem with these types of operations is they're slow... it's easier to compute all the coordinate positions at once using a matrix. Matrices are kind of like tables that can encapsulate these types of operations. I'm not going to go into detail about it here, since OpenGL contains built in support for handling matrices. The problem is they don't always do what you want; a transformation matrix, when applied, will transform the *entire* scene, not just the object you wanted to move! There are some neat tricks you can use involving the matrix stack to put any combination of transforms into a matrix, but space will not permit me to discuss that here :(. In the meantime we can use matrices to move our objects at times when we want the entire scene to move as a unit.
Here are the functions in OpenGL which deal with matrices:
void glLoadIdentity(void);
You've seen this one before... this function loads the "identity" matrix into the current matrix. This has the effect of resetting everything back to its original position, i.e. an object drawn centered at (0,0,0) will appear in the center of the screen.
void glTranslatef(float x, float y, float z);
This function translates (moves) the entire scene forward, left and up the specified amounts. Use negative values to translate in the other direction.
void glRotatef(float angle, float x, float y, float z);
Again, this function rotates the entire scene. The way this is called might be a little confusing; the amount of rotation is determined by angle (0-359), and the scene is rotated around the vector specified by x, y, and z.
void glScalef(float x, float y, float z);
This is a more rarely-used function; it scales (makes larger or smaller) the scene by the specified factor. For example, scaling by a factor of 2.0 makes the scene appear twice as large, whereas a factor of 1.0 does nothing and a factor of 0.5 will halve the size. You can scale each axis independently to produce a squishing or stretching effect.
So now you know how to move stuff around using OpenGL, lets do one more thing: depth testing. This is the process of determining what falls in front of what...in other words, is the house in front of the dog or is the dog in front of the house? This may sound trivial at first, but in order to get realistic looking scenes we usually use something called a z-buffer, which tests each pixel to see if it should is unhidden and should therefore be drawn. This would normally be a big to-do, but OpenGL is nice enough to handle all the details for us. Be warned though: unless you have a video accelerator with a lot of video memory, z-buffering will slow down rendering immensely. Z-buffers can make for really cool effects (such as objects passing through other objects), but watch out for the performance hit. That being said, applying a z-buffer to your scene is easy; first, put a call to glEnable in your initialization, like so:
glEnable(GL_DEPTH_TEST);
Then, clear your z-buffer at the end of every frame. You can do this at the same time you clear your drawing window, like so:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Lets continue on to the final example: a fully interactive 3D world with OpenGL.
#include <windows.h>
#include <gl\gl.h>
#include <gl\glut.h>
#include <gl\glu.h> /* GLU extention library */
void init(void);
void display(void);
void keyboard(unsigned char, int, int);
void resize(int, int);
void drawcube(int, int, int);
int is_depth; /* depth testing flag */
int main (int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(600, 600);
glutInitWindowPosition(40, 40);
glutCreateWindow("The Cube World");
init();
glutDisplayFunc(display);
glutKeyboardFunc(keyboard);
/* this time we're going to keep the aspect ratio
constant by trapping the window resizes */
glutReshapeFunc(resize);
glutMainLoop();
return 0;
}
void init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glEnable(GL_DEPTH_TEST);
is_depth = 1;
glMatrixMode(GL_MODELVIEW);
}
void display(void)
{
if (is_depth)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
else
glClear(GL_COLOR_BUFFER_BIT);
/* draw the floor */
glBegin(GL_QUADS);
glColor3f(0.2f, 0.2f, 0.2f);
glVertex3f(-100.0, 0.0, -100.0);
glColor3f(0.4f, 0.4f, 0.4f);
glVertex3f(-100.0, 0.0, 100.0);
glColor3f(0.6f, 0.6f, 0.6f);
glVertex3f(100.0, 0.0, 100.0);
glColor3f(0.8f, 0.8f, 0.8f);
glVertex3f(100.0, 0.0, -100.0);
glEnd();
/* draw 12 cubes with different colors */
drawcube(75, 57, 2);
drawcube(-65, -12, 3);
drawcube(50, -50, 1);
drawcube(-56, 17, 2);
drawcube(67, 12, 3);
drawcube(-87, 32, 1);
drawcube(-26, 75, 2);
drawcube(57, 82, 3);
drawcube(-3, 12, 1);
drawcube(46, 35, 2);
drawcube(37, -2, 3);
glutSwapBuffers();
}
void keyboard(unsigned char key, int x, int y)
{
/* This time the controls are:
"a": move left
"d": move right
"w": move forward
"s": move back
"t": toggle depth-testing
*/
switch (key)
{
case 'a':
case 'A':
glTranslatef(5.0, 0.0, 0.0);
break;
case 'd':
case 'D':
glTranslatef(-5.0, 0.0, 0.0);
break;
case 'w':
case 'W':
glTranslatef(0.0, 0.0, 5.0);
break;
case 's':
case 'S':
glTranslatef(0.0, 0.0, -5.0);
break;
case 't':
case 'T':
if (is_depth)
{
is_depth = 0;
glDisable(GL_DEPTH_TEST);
}
else
{
is_depth = 1;
glEnable(GL_DEPTH_TEST);
}
}
display();
}
void resize(int width, int height)
{
if (height == 0) height = 1;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
/* note we divide our width by our height to get the aspect ratio */
gluPerspective(45.0, width / height, 1.0, 400.0);
/* set initial position */
glTranslatef(0.0, -5.0, -150.0);
glMatrixMode(GL_MODELVIEW);
}
void drawcube(int x_offset, int z_offset, int color)
{
/* this function draws a cube centerd at (x_offset, z_offset)
x and z _big are the back and rightmost points, x and z _small are
the front and leftmost points */
float x_big = (float)x_offset + 5;
float z_big = (float)z_offset + 5;
float x_small = (float)x_offset - 5;
float z_small = (float)z_offset - 5;
switch(color)
{
case 1:
glColor3f(1.0,0.0,0.0);
break;
case 2:
glColor3f(0.0,1.0,0.0);
break;
case 3:
glColor3f(0.0,0.0,1.0);
break;
}
glBegin(GL_QUADS);
glVertex3f(x_small,10.0,z_big); /* front */
glVertex3f(x_small,0.0,z_big);
glVertex3f(x_big,0.0,z_big);
glVertex3f(x_big,10.0,z_big);
glVertex3f(x_big,10.0,z_small); /* back */
glVertex3f(x_big,0.0,z_small);
glVertex3f(x_small,0.0,z_small);
glVertex3f(x_small,10.0,z_small);
glVertex3f(x_big,10.0,z_big); /* right */
glVertex3f(x_big,0.0,z_big);
glVertex3f(x_big,0.0,z_small);
glVertex3f(x_big,10.0,z_small);
glVertex3f(x_small,10.0,z_small); /* left */
glVertex3f(x_small,0.0,z_small);
glVertex3f(x_small,0.0,z_big);
glVertex3f(x_small,10.0,z_big);
glVertex3f(x_small,10.0,z_big); /* top */
glVertex3f(x_big,10.0,z_big);
glVertex3f(x_big,10.0,z_small);
glVertex3f(x_small,10.0,z_small);
glVertex3f(x_small,0.0,z_small); /* bottom */
glVertex3f(x_big,0.0,z_small);
glVertex3f(x_big,0.0,z_big);
glVertex3f(x_small,0.0,z_big);
glEnd();
}
And that's all :)
OpenCV
What is OpenCV?
OpenCV is a computer vision library originally developed by Intel. It is free for commercial and research use under a BSD license. The library is cross-platform, and runs on Windows, Mac OS X, Linux, PSP, VCRT (Real-Time OS on Smart camera) and other embedded devices. It focuses mainly on real-time image processing, as such, if it finds Intel's Integrated Performance Primitives on the system, it will use these commercial optimized routines to accelerate itself.
Released under the terms of the BSD license, OpenCV is open source software.
What do I need to use OpenCV?
How to install OpenCV on Ubuntu 8.04 from debian packages
You only need to download the following packages:
# apt-get install opencv-doc libcv-dev libcv1 python-opencv # apt-get install libhighgui-dev libhighgui1 libcvaux-dev libcvaux1
How to install OpenCV from the source code
First you need to install these packages:
sudo apt-get install libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev
Then, download the latest version of opencv from (current latest version is 1.1)
http://sourceforge.net/projects/opencvlibrary
If you download a .deb package, you can install it with:
dpkg -i opencv-*.deb
else, if you download a .tar.gz file, install it with these commands:
tar -zxvf opencv-*.tar.gz cd opencv-* ./configure --prefix=/opt/opencv --enable-apps --enable-shared --with-ffmpeg --with-gnu-ld --with-x --without-quicktime CXXFLAGS=-fno-strict-aliasing make sudo make install sudo echo "/opt/opencv/lib" >> /etc/ld.so.conf.d/opencv.conf sudo ldconfig
Developing with OpenCV
Let's show a example using OpenCV and canny filter:
First, we need to include the OpenCV library:
#include <cv.h>
We need two buffers to store the image source and the image destination:
char *image_src; char *image_dst;
and we need to import the image and its properties from a driver which supports VarcolorA (videoforlinux2, mplayer, firewire, etc..) :
int* width;
int* height;
char** color;
resumeFn color_resume;
suspendFn color_suspend;
void schema_imports(){
....
width=myimport("varcolorA","width");
height=myimport("varcolorA","height");
color=myimport("varcolorA","varcolorA");
color_resume=(resumeFn)myimport("varcolorA","resume");
color_suspend=(suspendFn)myimport("varcolorA","suspend");
...
}
After import these variables, we have to assign memory to our variables. We are creating a image with dimensions "width", "height" and 3 channels (red, green, blue).
... image_src=(char *)malloc(width[0]*height[0]*3); image_dst=(char *)malloc(width[0]*height[0]*3); ...
Then in our iteration function we need to get the image from our variable "color", and after that we call to another function called "cannyFilter":
void schema_iteration() {
int i;
....
for (i=0;i<width[0]*height[0]; i++){
image_src[i*3]=(*color)[i*3+2];
image_src[i*3+1]=(*color)[i*3+1];
image_src[i*3+2]=(*color)[i*3];
}
cannyFilter();
....
}
In this function, we are going to use the function of OpenCV "cvCanny", to do that we need to know some things about OpenCV:
To use this function we can't use directly our buffers, we have to use formats of OpenCV, IplImage, CvMat, etc, in this example we are goint go use IplImage.
This IplImage format is a structure which store the image in the atributte "imageData", to copy our image from and to this structure we will use memcpy.
To use this canny function we have to use images with 1 channel, and our images have 3 channels, so we need to convert our image from 3 channels to 1, we can do it using "cvCvtColor" function, besides, canny function returns a 1-channel image, so we are going to convert this 1-channel image in a 3-channels image using the functions cvZero (set to 0 a IplImage) and cvCopy (copy a image into another using a mask as third parameter).
void cannyFilter() {
IplImage *src;
IplImage *gray;
IplImage *edge;
IplImage *dst;
/*Save memory for our images*/
src = cvCreateImage(cvSize(width[0],height[0]), IPL_DEPTH_8U, 3);
dst = cvCreateImage(cvSize(width[0],height[0]), IPL_DEPTH_8U, 3);
gray = cvCreateImage(cvSize(width[0],height[0]), IPL_DEPTH_8U, 1);
edge = cvCreateImage(cvSize(width[0],height[0]), IPL_DEPTH_8U, 1);
/*Copy our buffer to src variable*/
memcpy(src->imageData, image_src, src->width*src->height*src->nChannels);
/*Change from 3 channels to 1*/
cvCvtColor(src, gray, CV_RGB2GRAY);
/*Aply cvCanny function*/
cvCanny(gray, edge, 1, 1*3, 3);
cvZero(dst);
/*Copy the image using a mask)
cvCopy(src, dst, edge );
/*Copy our dst variable to our buffer*/
memcpy(image_dst, dst->imageData, dst->width*dst->height*dst->nChannels);
/*Free memory*/
cvReleaseImage(&src);
cvReleaseImage(&gray);
cvReleaseImage(&edge);
cvReleaseImage(&dst);
}
The result of this example would be something like this:
![]() |
| |
|
|
|
|
More info on OpenCV
- http://sourceforge.net/projects/opencvlibrary
- http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html
GTK Library
What is GTK?
The GTK Library is the library of GTK+, a package intended to be used to build up graphical user interfaces (GUI). The GTK Library only uses the services provided by GTK+, and should be compatible on all machines that have X installed and have an ANSI compatible compiler. It can be used both in C programs and in C++ programs.
What do I need to use the GTK libraries?
You only need to download the following packages:
# apt-get install libgtk2.0-0 libgtk2.0-dev libgtk2.0-0-dbg libgtk2.0-doc libgtkextra-x11-2.0-1 libgtkextra-x11-2.0-dbg libgtkextra-x11-2.0-dev # apt-get install libgnomecanvas2-dev # apt-get install libgtkglext1 libgtkglext1-dev libgtkglext1-doc
libgtkglext1 is the OpenGL Extension to GTK
Glade
Glade Interface Designer is a graphical user interface builder for GTK+, with additional components for GNOME. Glade let us create forms, called widgets, like labels, buttons, sliders, scrollbars, toolbars, etc. The created interfaces are saved in .glade files. It works similarly to like fdesing works with the Xforms Library.
How do I get Glade?
Download the following packages:
sudo apt-get install glade-gnome libglade2-0 libglade2-dev
XForms Library
What is XForms? What is Forms Library?
The Forms Library (XForms) is a library of C routines that allows you to build up interaction forms with buttons, sliders, input fields, dials, etc in a very simple way. The Forms Library only uses the services provided by Xlib, and should be compatible on all machines that have X installed and have an ANSI compatible compiler. Being based on Xlib, Forms Library is small and efficient. It can be used both in C programs and in C++ programs.
How do I get the XForms libs?
You only need to download the following packages:
# apt-get install libforms1 libforms-dev libforms-bin libforms-doc libxpm-dev # apt-get install libformsgl-dev libformsgl1
libformsgl1 is the OpenGL XForms graphical interface widget library
The designer
The XForms package contains an excellent designer called fdesign to create and maintain a graphical user interface. The designer lets you create forms, add objects to the forms, set the objects' properties, such as colors, etc., and define the callbacks of the objects.
The designer can be finely tuned. I strongly suggest that you read the chapter in the documentation about the subject. When tuning the designer, you specify the type of the generated code, whether the designer should emit a main() function and/or templates for your callbacks, the stepsize in pixels of the size and placement of objects when designing a form, and lots more.
In fact, you should never modify the code the designer generates; if you want to add special fl_...() calls to modify the objects' appearance, do so outside of the generated code. The reason for this is that later on you may want to change the look of your program, e.g., by changing some colors. All you have to do then is to start up the designer, perform your changes, save the files and re-make. If you modify the generated code, the changes are lost once you re-save the designer file.
SVN repository
Svn is the repository for Jde software, PFC projects and associated projects, so you better know how to use it.
How do I get a version from svn repository?
In any directory of your machine, write:
svn co https://svn.jde.gsyc.es/users/LOGIN/NAME_REPOSITORY
Important: It's necessary that you download the svn repository by means of https method. This method allow authentication for writting in the repository,
Example:
svn co https://svn.jde.gsyc.es/jde/jdec/trunk/
How do I update the repository?
Go to the local copy of svn repository and write:
svn update
How do I add a new file?
svn add [file | directory]
It's necessary execute svn commit for update changes in the server.
How do I delete an existing file?
svn delete [file | directory]
Warning: This command delete the file of your file system.
It's necessary execute svn commit for update changes in the server.
How do I compare different versions and why?
For compare two file versions, write:
svn diff [fichero] -r [version]
The next example compare the head version with revision 114.
svn diff jde.c -r 114
Why do I need tags and how create them?
A tag is just a "snapshot" of a project in time. In Subversion each revision is a snapshot of the repository filesystem after each commit, and it can be used as a tag. But people often want to give some human-friendly names to tags, like release-1.0. Tag is a named snapshot, a symbolical connection with the specified revision of a project.
For generate a tag, go to your local work copy and write:
svn commit svn copy trunk/ tags/label-1.0.0
It's necessary execute svn commit for update changes in the server.
More information
You can find more information about how to use svn in the following links:
- http://www.yolinux.com/TUTORIALS/Subversion.html
- http://www.kopernix.com/?q=node/41
- http://svnbook.red-bean.com/
Basically you will need to know how to download software (checkouts or updates in svn terms), uploads (commits), merge patches, create tags. It is also useful to know how to create patches (diff, or svn diff), apply them to merge software (see patch manual in linux) and to solve merging conflicts.
How do I get a subversion repository for my project?
If you want a subversion repository for "control version source" of your PFC, follow these steps:
- If you are new user, create a file with your password as follows:
htpasswd -cs /tmp/login.pass YOUR_LOGIN
- Send an e-mail with subject Repository SVN to rocapal [at] gsyc [dot] es specifying the name of the repository you want (this name can not be the same as your login). If you are a new user, you must attach the previous file '/tmp/login.pass'.
JDE Wiki's FAQ
How do I show video in the wiki?
This wiki can show videos with flv format and youtube format.
Youtube videos
The syntax is:
{{#ev:youtube|id_youtube}}
FLV Videos
The syntax is:
<video [width=XX height=YY image=src] > path_to_video </video>
The parameters width, height and image are optionals:
- width: set the video's width (default: 320)
- heigth: set the video's height (default: 240).
- image: set the image that appears at the beginning of the video ( by default appears "peloto"). This value can be show through an extern url (
)
path_to_video is the path where the video is saved in flv format. The path may be local ( in DocumentRoot of mediawiki ) or external as http://server/video.flv
Example 1: Only specify the video's path. Others parameters are taken by default.
<video>http://gsyc.es/jmplaza/multimedia/multiwatcher.flv</video>
Example 2: Specify all the values
<video width=400 height=320 image=http://gsyc.es/jmplaza/pioneer.png> http://gsyc.es/jmplaza/multimedia/atencion3d2006.flv </video>
All videos must be in flv format. This not a problem because mencoder can convert to this format.
How do I convert OGG to FLV video
ffmpeg -i videoOGG.ogg videoFLV.flv
If you want to add some features; for example bitrate, aspect ratio,... You must write something like this:
ffmpeg -i videoOGG.ogg -b 163840 -s 512x288 -ar 44100 videoFLV.flv
How do I convert AVI to FLV video
You can use mencoder tool
mencoder video.avi -o video.flv -noskip -mc 0 -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=500:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -srate 22050
How do I upload a file?
If you have an active user account at jderobot.org, you can upload files using "scp" or "sftp" utilities.
It's possible to establish a secured ftp connection to jderobot in order to upload/download files to/from your account directory (/users/${USERNAME}). See below one example, where not only a video file is uploaded but also some directories are created by using standard ftp commands:
jvazquez@ubuntu:~/ROBOTICS/SVN/users/jvazquez/tfm/trunk/practica1_introrob$ sftp jvazquez@jderobot.org Connecting to jderobot.org... The authenticity of host 'jderobot.org (193.147.71.110)' can't be established. RSA key fingerprint is be:23:2d:19:6b:49:d2:13:ac:3c:49:3f:35:79:d0:0d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'jderobot.org' (RSA) to the list of known hosts. jvazquez@jderobot.org's password: sftp> pwd Remote working directory: /users/jvazquez sftp> sftp> mkdir videos sftp> cd videos sftp> put vff_obstacles_v2.ogv Uploading vff_obstacles_v2.ogv to /users/jvazquez/videos/vff_obstacles_v2.ogv vff_obstacles_v2.ogv 100% 5142KB 32.8KB/s 02:37 sftp>
You could access to "/user/${USERNAME}" contents with a HTTP URL like http://jderobot.org/users/${USERNAME}.
As an alternative to "sftp" command, secured copy is also available.
jvazquez@ubuntu:~/ROBOTICS/SVN/users/jvazquez/tfm/trunk/practica1_introrob$ scp vff_obstacles_v1.ogv jvazquez@jderobot.org:/users/jvazquez/videos/ jvazquez@jderobot.org's password: vff_obstacles_v1.ogv jvazquez@ubuntu:~/ROBOTICS/SVN/users/jvazquez/tfm/trunk/practica1_introrob$
JDE Blog's FAQ
How do I register to the blog?
- First, you must register here.
- Later, you send an e-mail to jde [at] gsyc [point] es commenting your register to elevate your role on the blog.
How do I add content to the blog?
It's easy. You must go to this link: http://blog.jde.gsyc.es/wp-admin. And then, log in with your username and password. Now, you can go to "Write" tab. When you have finished to write it, click on the "Publish" button.
How do I show video in the blog?
You can insert youtube video and flash video in this blog. When you write a post, you can see the buttons “YT Video” and “FLV” (see image). Use this buttons to insert videos in your post
How to collaborate with the JDE community
How do I notify a bug?
If you found a bug, the first step that you should do is update ot last version of subversion, and check that bug may be reproduced. If you can reproduce the bug and you haven't permits in trac tool, you can send an e-mail to jde [at] gsyc.es with subject [BUG] - little description, tell us:
- The steps to reproduce the bug.
- Jde's version.
- Operative System and version.
- Traces of bug ( if is possible ).
If you want to get traces of bug, you can do it this way:
$ gdb ./jde (gdb) run [put here the options that you use for this execution]
When the execution crash, write:
(gdb) bt
Attach the result in your mail.
How do I notify a bug through JDE trac?
If you want to notify a bug and you have permits on trac tool, you should create a new ticket in order to developers can solve it. Before creating the ticket, you should check that the bug hasn't been notificated previously. The first step to create a ticket is logging in the trac tool as you log in your project svn. After that, you have to push 'New Ticket' button in the menu:
|
|
| |
|
|
|
|
Then, you have to fill some information about the bug in this form:
![]() |
| |
|
|
|
|
You should write a short summary that explains the bug quickly. In the box below, you should write a full description including the same information mentioned in the previous section:
- The steps to reproduce the bug.
- Jde's version.
- Operative System and version.
- Traces of bug ( if is possible ).
In the ticket properties, you should fill some fields, most important are:
- Component: specify type of component that has the bug.
- Milestone: select 'improving' by defect.
- Version: select 'trunk' by defect.
- Assing to: you don't need to fill it.
- Cc: if you want to receive news about the ticket state, you can put your e-mail here.
Finally, you have to push 'Submit ticket' button.
How do I send a patch or new feature?
If you are able to find the solution of a bug or you have added a new feature, send:
- An e-mail to jde [at] gsyc.es with subject [FIX-BUG - little description] or [FEATURE - little description]
- Attach the patch generate with this command (execute this command in work local copy of subversion):
$ svn diff > path_[date]_[versionJDE].patch
It's very important that you say us the version of JDE you used to create the patch. The more recent the jde version at svn, the easier is to integrate into the development release of Jde.
Ideally, in order to solve a given bug:
- first, download the latest release,
- second, modify the source code to solve the bug
- third, generate the patch,
- and fourth, send the patch to the email list, as mentioned before.
Programming style
Documenting the code
We use doxygen as code documentation system, so we can easily generate an online version of the API documentation. Adding doxygen comments to your code is as easy as adding regular comments, you just have to follow some rules and learn a small set of tags. You can find a complete manual here.
This is a documented code snippet with some examples of doxygen documentation:
/**
* A test class. A more elaborate class description.
*/
class Test
{
public:
/**
* An enum.
* More detailed enum description.
*/
enum TEnum {
TVal1, /**< enum value TVal1. */
TVal2, /**< enum value TVal2. */
TVal3 /**< enum value TVal3. */
}
*enumPtr, /**< enum pointer. Details. */
enumVar; /**< enum variable. Details. */
/**
* A constructor.
* A more elaborate description of the constructor.
*/
Test();
/**
* A destructor.
* A more elaborate description of the destructor.
*/
~Test();
/**
* a normal member taking two arguments and returning an integer value.
* @param a an integer argument.
* @param s a constant character pointer.
* @see Test()
* @see ~Test()
* @see testMeToo()
* @see publicVar()
* @return The test results
*/
int testMe(int a,const char *s);
/**
* A pure virtual member.
* @see testMe()
* @param c1 the first argument.
* @param c2 the second argument.
*/
virtual void testMeToo(char c1,char c2) = 0;
/**
* a public variable.
* Details.
*/
int publicVar;
/**
* a function variable.
* Details.
*/
int (*handler)(int a,int b);
};
And here you can see the html generated documentation.






