Frivas-pfc-itis
From jderobot
- Project Name:
- Authors: Francisco Miguel Rivas Montero (frivas [at] alumnos [dot] urjc [dot] es)
- Academic Year: 2008-2009
- Degree: Undergree
- Jde Version: jde-4.3
- SVN Repository: Repository
- Tags: webots, opencv, jde, gazebo, webots, nao, Naoqi
- Technology: C, jde suit, C++, opencv, python
- State: Developing
- Source License: GPLv3
- Document License:
Contents
|
First Steps
All first steps have been moved to this page
NaoVision
Version 1
Finally here is my fist schema. Navision incorporates all the algorithms explained previously, goal detection, Opencv filters, color filters (runs with HSV yet) and Ts and Ls detection. All of them joined in an unique schema. With NaoVision you can change directly between the different image sources that you have available (for the moment, gazebo, cam and Naoqi) as you can see in this video:
The next video is an example of the NaoVision options (Goal,detecting, Ts and Ls detection, different OpenCV filters and also how change the Ls and Ts detection if you alter the configuration parameters):
(Note that Ls are drawn on red and Ts on yellow)
NaoVision running receiving images from a webcam.
Version 2 OpenGL 3D display
As I will use all NaoVision utilities to locate the robot in the field I will need a simulate 3D world to show my results. With this aim I incorpored a 3D world to NaoVisio. To manage and draw this world I used OpenGL. Here there is a video showing the most important operating utilities:
Version 3 NaoVision with Progeo
Progeo is a projective geometry library that offers some very useful functions that relates 2D points and 3D points. You can find more information about progeo here. First I will use progeo to show on my 3D simulated world a projection of any pixel of the Nao Cam. To chose the pixel you have to clik on the image and then NaoVision will draw its throw.
Calibrating the Webots cam
To calibrate the webots cam I will use a JDE schema called extrinsics. To use this schema I will need a 3D world (only the lines in a text file) and a cam connected to JDE. We can connect the webots cam to JDE using the NaoBody driver but the world that I have is not webots one. I desingned a 3D world following the 2009 rules but the webots field is from 2008. So I have to create this new world. These are differents fields:
| 2008 with objets: | 2009 with objets: | ||||||||||||
|
| ||||||||||||
| 2008 only lines (for extrinsics): | 2009 only lines (for extrinsics): | ||||||||||||
|
| ||||||||||||
Well, now we are able to use extrincs to calibrate de cam. After proving diferencts values and using an aproximated position of the nao in the webots field we have a great resoult, this is a printscreen of the extrinsics resoults:
![]() |
| |
|
|
|
|
Pixel projection
Now I will use the parameters that I get from extrinsics to calibrate the webots cam and use progeo to project a pixel in the 3D visualizer. The problems that I had to calibrate the camera was that I have to change the roll. Extrinsics give me 0 but I have to use 90º and I have some desviation from the FOA. These are the results:
Problems with progeo, roll and throwing deviation
- Roll problem
This is a video showing the projections with the original cam file configuration saved with extrinsics.
- Deviation problem
This is the same situation but this time with roll at 90º
NaoBody and NaoOperator fisrt version
NaoBody
- Version 1 stopping to process the situation
NaBody is a JDE driver which provides communication between JDE and Naoqi.
There are two variables: v (speed) and w (angular velocity). For the moment the idea is make nao walk a short distance adjusting the walk values depending on the v and w and when Nao finish walking do that again. It is not the best way to do it and I have to change it but for the moment its my best idea. The most important disadvantage is that when Nao finish walking Nao return to a balance position and here Nao spends many time since it continues walking. Here is a video using NaoBody driver through NaoVision schema (with a new functionality called NaoBody).
- Version 2: body driver and head driver
I have included to the naobody driver function to allow the driver control the head motors.
- Version 3: head driver using pantilt standard
I change the driver interface to a standard in JDE pantilt. Here you can find a explication of all thing that you have to control a driver which uses this method. There is a virtual schema called pantiltencoders which provides us many control variables and another virtual schema called pantiltmotors which provides us variables to control the motors.
- Testing naobody with teleoperator
I want to test this driver (only the head part) with an existing schema called teleoperator. Teleoperator is able to work with ptmotors and ptecoders driver. I made it works but I still have a problem, teleoperator only works if the naooperator is working and displayed, I don't know where is the problem because naooperator do not change any parameters if you don't change it in its GUI. Here is a video:
NaoOperator
- NaoOperator to control the Nao head, camera and head
- Version 1: using naobody driver without pantilt stardard
NaoOperators works with two drivers, Naoqi and NaoBody. From NaoQi NaoOperator gets the image and NaoBody provides NaoOperator the head and body motors:
- Version 2: using naobody driver with pantilt starndard
Finally I change the exports of the naobody driver to convert it to pantiltmotors and pantiltencoders so with this operator you can use drivers with this standard. code
- NaoOperator to Improve the nao walk
We need to improve the Nao robot movements mainly its walk. Naoqi gives us two functions which with we can modifiy the walk parameters. setWalkConfig and setWalkExtraConfig. To changes those values I have incorpored to NaoOperator some scales to test the improves between the diferents values easily using a GTK GUI:
![]() |
| |
|
|
|
|
To use this schema I have to change the NaoBody driver to include these funtionalities.
Gazebo's Nao Robocup soccer field
I use a texture for the ground plane, it is an image file wich has the field lines with the correct dimensions (you can find the dimension at the Roboup rules here.)
![]() |
| |
|
|
|
|
The next step is to delimit the field and to add the goals. Gazebo provides many diferents objects that we can use, I will use the SimpleSolid. A type of SimpleSolid is cylinder but if I use this object I cannot put annother object near it (1 meter), so I will use box one. Here are the results:
![]() |
| |
|
|
|
|
Diferences between naoqi and gazebo
Nao Walk
Naoqi gives us two functions which with we can modifiy the walk parameters. setWalkConfig and setWalkExtraConfig:
- setWalkConfig: With this function we can change the most important walk parameteres:
- The footstep length
- The maximum height in a footstep cycloid
- The footstep side length
- The footstep z orientation
- Zero moment point offset in the forward direction
- Zero moment point offset in the sideways direction
- setWalkConfig: With this function we can change extra walk parameteres:
- The amplitude of backlash compensation for LHipRoll
- The amplitude of backlash compensation for RHipRoll
- The Torso orientation along the Y axis during walk process
For the moment the improves comes if we increase the footstep length, height and side length. In this video you can see the improves, first nao walk with the default values and then we changes its as I explained.
| Standard walk: | Improved walk: |
| | |
Here there is a video where you can see how Nao walks arc using the new walk configuration:
Finally the best parameters to use for Nao walk are:
- WalkConfig:'
- The footstep length: 0.075
- The maximum height in a footstep cycloid: 0.02
- The footstep side length: 0.05
- The footstep z orientation: 0.555
- Zero moment point offset in the forward direction: 0.018
- Zero moment point offset in the sideways direction: 0.018
Faced to the standard ones:
- WalkConfig:'
- The footstep length: 0.05
- The maximum height in a footstep cycloid: 0.02
- The footstep side length: 0.02
- The footstep z orientation: 0.350
- Zero moment point offset in the forward direction: 0.015
- Zero moment point offset in the sideways direction: 0.018
Nao Movements generator
I will look deeply into Nao movements with the final idiea to program a JDE schema wich will be able to generate nao motions.
Complete NaoOperator (with all motors and sensors)
The first thing that I need is to improve the NaoBody driver and NaoOperator schema (I will program over nao-walk) to provides all the motors and encoders. Nao Robot has 32 actuators with 32 hall effect sensors. For the moment I only will use 22 of them:
* Head:
| ............................................................ Robot Description: |
| |||||||
Naobody (driver)
I need to implement all this motors and encoders into NaoBody driver. I have separed the robot in six parts:
1. Head (varcolor)
2. Camera
3. Left arm
4. Right arm
5. Left leg
6. Right leg
So NaoBody will provide seven virtual schemas one each unless head that need two (ptencoders and ptmotors) and two aditionals:
7. walk (motors)
8. Walk config
![]() |
| |
|
|
|
|
NaoMoves (schema)
With this schema you can control all Nao motors.
![]() |
| |
|
|
|
|
Sensors
This NaoOperator version (NaoMoves) has the option to visualice all the sensor (motors ones).
Nao Positions creator
This schema is also be able to change the Nao motors positions:
Nao Movement creator
I have improved the nao-move (driver and schema) to be able to save differents positions and go to this positions manually (the next step is to do that automatically).
Here there is a video of Nao "dancing":
In the video the moves are with shoulder and elbow but all motors are implemented, even legs.
Finally using the positions saved in the before step we need to do all the move automatically. The idea is simple: saving differents snapshots with differents positions of the Nao robot and then combine all those positions to create a movement. With all position you must define a time transition between each position.
This is a video of the Nao Movement Creator working (as in previous videos I only use arms because legs must be used carefully, nao can fall over):
This schema also has the option to convert this movement into function written on C++ on a file to use it with other programs easily. This will be a useful utility to program with the nao because this will simplify a programming movements.
Example: nao standing up
This is an example of Nao Movements creator. I will create a movement for nao standing up, first I need to create some snapshot positions and asing to each transition a time. Well if I get with some positions stand the Nao robot from the graund Nao Movements Creator will generate the movement to do it automatically.
In this video you can see the Nao Movements Creator running. I have some snapshot and I will change between them to show the idea and then it will be done automatically:
Then, onces you have a movement working you can save it into a file and change some parameters, remove some invalid snapshot or combine some of them. Then you will have the final sequence:
Last software versions
NaoQi
- NaoQi 1.2.0
- NaoQi 1.3.8
Aldebaran Robotics have developed a new Naoqi version Naoqi 1.3.8 so and I have to change my code (I think I only need to change the driver code because the schema must be totaly independed from the driver but maybe I have to change some things in the schema too as options disabled, changes in configurations, etc).
- NaoQi 1.3.17
New release of NaoQi middleware.
Webots
- Webots 6.1.5
Well, now I have all my programs running with the new NaoQi. The changes I had to do were some libraries names, changes in compilation modules and some functions that now dont exist or its name have been changed. So it wasnt a big problem. Now Im going to use the new Webots version too 6.1.5. Here there are some pics of the new version:
![]() |
| |
|
|
|
|
![]() |
| |
|
|
|
|
- Webots 6.2.0
New Webots version 6.20. In this version cyberbotics made many change on the graphics, field and robot texutes, and also de rendering is high.
![]() |
| |
|
|
|
|
Naobody
I improved the naobody with the new NaoQi version to allow changing the Nao camera configuration throw JDE. Now naobody gives you the posibility of change all the camera parameters, brigthness, shapness... and also now you can change between the cameras. Now I have to include all this new options into the NaoOperator schema to test them. This section will be a manual of the driver and will explain the differents modules that this drivers provides. The NaoBody driver uses a interface library called naotypes.h. In that file we can see how we export all the sensors and actuators. The modules that we have implemented are:
- Camera
- Access to all motors (sensor and actuator)
- Movements player
- Voice Synthesizer
- Inertial sensor (real robot)
- Access to all leds (real robot)
- FSR (pressure sensor) (real robot)
- Ground truth (simulated robot)
With this new component we can locate the robot in the field, the values are provided by the simulator (Webots). The idea is to change the webots supervisor code adding new functios which writes the location of the robot in one of its ports (based on a Francisco Martín Rico idea). The GTLocalization is a player (a program that is developing the teamchaos) and I tried to modify it to incoporporate this functions into the NaoOperator.
- Testing movement tool.
- GetUp Behavior.
You can see how this driver works in the NaoOperator examples.
Now the NaoBody driver have two movements integrated, getUpBack and getUpFront. The idea is to develop a simple behavior with three states.
1. If the now is stand let use all drivers options (new movements, walk.. etc)
2. If the driver detects that the nao have falled down it will kill all proccesses pending in the robot and will start the standing up movement.
During all this proccess the driver will be "disabled", it only will work on nao standing up.
This behavior can be disabled by the user.
DONE!!!
NaoOperator
All the NaoOperator functions uses the NaoBody driver wich provides us the access to all Nao componentes.
Camera
We can capture images from the nao (simulated or from the real robot) and the NaoOperator can show this images as you can see in some previous videos. But also we can change some parametres of the camera, brightess, sharpness... but it only works in the real robot. The simulated camera does not have this options. There is a video showing how it works in the real Nao:
There is one more thing that no works on the simulated robot, the fast switch between the cameras. The only way to change the camares is by the normal mode. You can se how the "normal mode" works in the simulated robot:
Teamchaos movement file format included into NaoOperator
Now you can import movements files from Teamchaos and executing it with the NaoOperator, changing positions or including more new ones. For the moment now we can only export in our own format but we will work on it.
The problem that we have now is that some movements do not work well with the new webots version 6.1.5. My up movements do not stand up the nao and some kicks makes the nao fall over.
SOLVED: The problem was the motors ranges. We have changed them and put all the Aldebaran specifications and change some parameters in the conversion between the files fomat and while loading files. We had also a problem in the consertion between degrees-radians. If the limit of the motor is 120 degrees and we have 120.0001 in some of our movements values the motor will not move. So in those cases we limited the ranges and trunked some values.
We have the same problem with an imported Teamchaos movement. This movement is getUpBack, you can see the problem in the following video:
- getUpBack:
| Problem | Working: | |
| | |
- getUpFront:
This movement works correctly
| Simulated Robot | Real Robot: | |
| | |
Symmetric movements
Once we have a movement correctly creating using the NaoOperator tool we can create the symmetric movement only one click. It also works with a loaded movement:
| From a teamchaos movement: | From a created movement |
| | |
Voice Synthesizer
Inertial Sensor
The inertial unit is located in the chest with its own processor. The output data enables an estimation of the chest speed and attitude (Yaw, Pitch, Roll). The central unit is made of:
- two axis gyrometers (5% precision with an angular speed of ~500°/s)
- three accelerometers (1% precision with an acceleration of ~2G)
| Inertial description: | Inertial working on NaoOperator | ||||||
| | ||||||
Sonar
Nao is equipped with four sonars which allow it to estimate the distance to obstacles in its environment. The detection range goes from 0 cm to 70 cm, but under 15 cm there is no distance information, the robot only knows that an object is present.
| Sonar description: | Sonar working on NaoOperator | ||||||
| | ||||||
Leds
The nao has the following leds:
- Eight fullcolour RGB LEDs in each eye;
- Ten 16 step blue LEDs in each ear;
- One fullcolour RGB LED in the chest;
- One fullcolour RGB LED in each foot.
With the NaoOperator you have access to all this leds, to each led indepently or by groups as you can see in the following videos. Groups are provided from NaoOperator the NaoBody driver only give you access by each led.
FSR
The Nao Robot has 4 pressure sensor in each foot, with this NaoQi module we can know how is the stability of the robot and if the robot have falled down.
|
|
| |
|
|
|
|
The following video shows how it works in the NaoOperator:
| Unig webots: | Real Robot |
| | |
Ground truth
This tool show the position of the robot in a opengl 3D viewer.
- Version 1 2D:
- Version 2 3D
Movement testing tool
With this tool you can test a loaded movement (time, distance...)
GetUp Behavior
If this behavior is active the robot will start getting up if it fall down. All movement will be clear and stopped.
My walk
Now we have the driver and the schema working and providing many things. Using the NaoBody driver and the NaoOperator schema with the movements generator we can create our own walk movement and improbe it using differents algorithms.
Here you can find a mini-inform about the nao motors and movements (spanish).
Creating a parameterizable walk movement
The first step is creating a parameterizable walk movement.
First of all we need a walk movement very rudimentary, the nao must walk without falling down. The idea is creating two movements, one wich prepares the nao to start walking and the second one is the real walk, by steps. The following videos shows both movements.
The first movement is called inicio.mov in the video, and the second is paso.mov.
Testing in the real robot
- Walk v1.
| Webots | Real | |
| | |
- Walk v2: the same movement but faster.
| Webots | Real | |
| | |
- Walk v3: arms
| Webots | Real | |
| | |
Sinusoidal movement
First version of a fully parameterized motion with sine waves. As can be seen, we have to improbe this movement because it is not stable enough.
These are the graphs for robot by joint. In the same graph you can see the original values (of our fixed movement) and the values provided by the parameterized movement.
| Hip Roll: | Hip Pitch: | ||||||||||||
|
| ||||||||||||
| Knee Pitch: | ||||||
| ||||||
| Ankle Roll: | Ankle Pitch: | ||||||||||||
|
| ||||||||||||
Combined movement (sines and own functions)
As you can see the rolls fits correctly with the sine graph but the pitch is different and becouse of that the movement dont work well. We need to change the functions of the pitchs maybe changing the sine to another function or defining our own function.
Here are the final results:
| Hip Roll: | Hip Pitch: | ||||||||||||
|
| ||||||||||||
| Knee Pitch: | ||||||
| ||||||
| Ankle Roll: | Ankle Pitch: | ||||||||||||
|
| ||||||||||||
Movements parametres
Using this algorithm to create gaits to make nao move we based all the movement on waves. One step is represented with one wave (from 0 to 2 PI). Following this idea each actuator has 4 posibles paretres:
- Offset
- Delay
- Amplitude
- Frequency
In total we have 5 actuators that we use to make tha robot walks so we have 5 * 4 = 20 different parametres. As we are going to encapsulate the whole movement all waves the frequency will be the same for all waves, so now we have 5*3 +1 = 16 parametres.
Rolls
We need to simplify this parametres because 16 are too much, we can see what happens with the two rolls. As you can see at videos or analysing the graphics we can see that the minimum value of the ankle roll matchs with the maximum value of the hip rolls so this means that ankle roll and hip roll has a delay of PI radians. So if we can fix the hip roll delay to the hip pitch wave we will reduce in 2 the parametres. The Amplitude value of the rolls waves means the amount of balance that the robot will have while walking so we can fix the two amplitude values into a "Balance" parametre. Setting the values of the rolls as described above we also can set the offset of the wave. The robot at the initial position must have the sole of the foot parallel to the floor and this can be set by the offset. So we have 2 parametres less.
After analyzing the rolls we have 11 parametres:
- Hip-pitch offset
- Hip-pitch delay
- Hip-pitch amplitude
- Knee-pitch offset
- Knee-pitch delay
- Knee-pitch amplitude
- Ankle-pitch offset
- Ankle-pitch delay
- Ankle-pitch amplitude
- Frequency
- Balance
Frequency
To make a symmetrical movement in which the initial position is the same as the final (one step) all the waves must be at the same frequency. The frequency determines the speed at which the robot will walk, so onces we have found a good movement we can increase or reduce the speed of the robot simply by varying the frequency. Because of that we can take the frequency as a fixed value. So now we have 10 parametres.
Restructuration number 1
Following the idea above all waves have their own delay so all waves will start with a value completely separate from each other. If we use the idea of the "onda ombligo" we can set a wave as the wave source and fix the rest wave delays on this. If we set the hip-pitch delay as the source wave we have 9 parametres:
- Hip-pitch offset
- Hip-pitch amplitude
- Knee-pitch offset
- Knee-pitch delay (from the hip-pitch)
- Knee-pitch amplitude
- Ankle-pitch offset
- Ankle-pitch delay (from the hip-pitch)
- Ankle-pitch amplitude
- Balance
Webots restarting tool
First version: reverting the webots simulator
With this new tool added to the NaoOperator Schema we can restart the webots simulator using JDE. It returns the simulator to the initial status. With this tool we are going to be able to test differents movements starting from the same initial state (the webots initial status), that make us sure that all movements starts with the same conditions.
Here there is a video showing how it works.
Second version: moving the robot to an initial position
Due to that we are having many problems with the webots reset tool (near at 50 restarts the simulator is closed) we have created a new way to bring the robot to an initial position to assess the movement. What we have done is basically put the robot in the initial position (motors) of the simulator and then through webots (using the supervisor) we placed (at the world) the robot in a 3d position. Here is a video of showing how it works:
Searching the best movement
Changing two selected parametres
Now you can select two parametres that will change automatically from min to max (you can select those limits from the gui) and the final puntuation of each movement will be saved in a file that can be loaded later. This is an example:
Search results
| | ||||||
Searching algorithm
We have a big search space and searching only with 2 parametres (remember that now we have 9, fixing the hip phase) is not enough. We need a stronger algorithm to search in a bigger space with some restrictions. Fisrt of all we have to create a simple searching algorithm that will search in the hole space fixing the maximum, minimum and the increase. With this algorithm we can make more exhaustive and better searches and will help us to undestand a bit more how the movement varies with diferents parametres values.
Best movements
March
April
BEST
Iphone and Nao
First version
Using this application you can control the Nao movement in your iphone through the NaoOperator JDE schema. You only can test movements loaded by the NaoOperator.
- This video shows how it works:
Final version
Now you have access to all Nao motors and you can change them using a scale or introducing an angle in a text box. You also can change the speed at which the robot walks, start walk and stop it:




























