All posts by binnur

Publications

Exercise Coach Project

My “Exercise Coach Project” has also an attraction for the non technical committee  and is in interest of press. I have a number of interviews for newspapers, technical and non technical magazines and newsletter which you can find them in detail below (but they are in Turkish).

 

Gazebo Dairies — A summary of last four month — OPW internship

My internship journey finished after the last four great months. I have developed SDF editor for Gazebo which allows to modify the current world model by directly modifying the SDF file loaded in the memory. I have learned a lot, enjoyed more.. Nate Koenig which is my mentor for this internship is always with me with his valuable help in order to direct me though the project and answer my questions. It was my first time to be in such a great international project, working with a person on chat. Many thanks to open source community, many thanks to OPW for encouraging girls to participate in such organizations. I have tried to log my work in this blog which is  http://robot.cmpe.boun.edu.tr/~binnur/  . The codes can be found in https://bitbucket.org/binnur/gazebo/commits/all  . As a future plan, I will continue on this project in order to make it ready for the next release of Gazebo. I will be very proud of it if I can achieve :)

Gazebo Dairies – Vol. 8 (Save – Discard – Exit Events)

Finally, I can come up with saving strategies. I offer some options to the user as listed above:

  • update: As stated before, the user would like to see the visual effect of his change made in the SDF. If he hits the update button, the changes in the SDF is realized in the world model in the memory so the visual effect can be seen in the rendering scene.
  • discard: If the user wants to take back all changes done on the SDF without any modification on the initial SDF, discard button is available. After hitting the discard button, a warning dialog is appeared in order to inform the user that the changes will be discarded. If the user accepts, initial SDF is loaded into the editor and the rendering scene is also updated (which means the changes in the world model in the memory is retrieved)

discard1 discard2 discard3 discard4

  • save as: the user can save the current sdf in the editor by hitting save as button. Save dialog will open and ask for the name of the file and the location. After saving the SDF,  the changes can not be reverted. Revert option is available between two save operations.

save1

  • done:  the user can save the changes in the editor then exits.
  • close:  exits the editor immediately without asking for any save option.

 

 

 

Gazebo Dairies – Vol. 7 (Improvements in SDF Editor)

In order to add code folding property, I searched for more functional editor and encountered with Scintilla. Scintilla is an open source code editing component. It comes with complete code and you can enjoy with it as you like. You can install it also from package manager.

For the ones who want to embed this wonderful component into a QT project, QScintilla is also available.  QScintilla is a port to Qt the Scintilla editor. The SDF editor which is implemented by QScintilla is as follows;

schintilla1

It allows highlighting, code folding, line numbering which are needed for the SDF editor. As the SDF file gets larger, these properties will be vital.

Another point which is implemented in order to make our life easier is adding the “FIND” property. Scintilla provides some functions in order to find a word in the editor. It also provides find next function. I have created a find layout as follows for the find process. It is opened by clicking the find button, or simply by hitting the key combination (CTRL+F).

gazebo12 gazebo13

As seen, if the searched word exists in the code, the find layout turns into green, otherwise it is red. By using prev and next buttons, you can iterate over all matched words. Close button hides the find layout  as we have not large area to include it continuously.

 

 

 

 

 

 

 

Gazebo Dairies – Vol. 6 (SDF Change)

In order to realize the changes made on the SDF, we used factory messages which can contain a SDF string and an edit name (the name of the model). These factory messages are processed in World.cc.

Currently, we can change some properties of a model through the SDF text. The related SDF of the selected model from the ModelListTree (on the left side of the main window) is shown on the SDF editor. Some properties of the model such as pose, box size can be changed within the editor. After hitting the update button of the SDF editor (located in the bottom right side), the changes are sent through the factory messages if they are valid. An example is shown in the below figure where we can change the table top size through the SDF editor.

gazebo1 gazebo2

Gazebo Dairies – Vol. 5 (SDF Validator-2)

Upon obtaining the XSD files generated for the SDF (Simulator Description Format) files of Gazebo, I have validated the text in the editor again the XSD files. If the text does not meet the format described by the XSD files, then the editor highlights the line which causes error by red and shows an error message in the box which is located just below of the editor.

gazebo1

 

 

#! /usr/bin/python
import urllib2
def download_file(file_url, file_name):
print "download " + file_name + " from " + file_url
response = urllib2.urlopen(file_url)
content = response.read()
schema_file = open(file_name, 'w')
schema_file.write(content)
schema_file.close()
file_list = open('file_list.txt')
for line in file_list:
file_name = line.strip('\n')
file_url = "http://sdformat.org/schemas/" + file_name
download_file(file_url, file_name)

By this script, we can download all XSD files from the link. The file_list.txt includes the names of all XSD files.

 

 

#!/usr/bin/python
from xml.dom.minidom import parse
def get_file_ref(file_url):
index = file_url.rfind('/')
file_name = file_url[index+1:]
return './' + file_name
def replace_includes(xml_file):
dom = parse(xml_file)
include_nodes = dom.getElementsByTagName('xsd:include')
for node in include_nodes:
node.attributes['schemaLocation'].nodeValue = get_file_ref(node.attributes['schemaLocation'].nodeValue) 
print node.attributes['schemaLocation'].nodeValue
file_handle = open(xml_file, 'w')
dom.writexml(file_handle)
file_handle.close()
file_list = open('file_list.txt')
for line in file_list:
file_name = line.strip('\n')
replace_includes(file_name)

By this script, we can replace includes with local files. For example, the line <xsd:include schemaLocation=”http://sdformat.org/schemas/types.xsd”/> is replaced by the location of the types.xsd file which is downloaded before by utilizing the above script.

Gazebo Dairies – Vol. 4 (SDF Validator)

I have to validate the correctness of the SDF editor as the user enters new entries or change some parts of it. Since the SDF file is based on XML, I have to check for XML syntax first and then for the SDF syntax. For the XML validator, I found the Xerces C++ library which can be used to parse, manipulate and validate the XML files. It returns the line number where the error is occurred. I highlighted this line with red colour and print the error message in the widget just below the editor. In this way, the user can recognize his/her error while editing the SDF file.

The editor switched to the code editor of QT from plain text editor in order to show the line numbers and highlight the current line. SDFValidator_V1