Dyunta-pfc-itis

From jderobot
Jump to: navigation, search
  • Project Name:
  • Authors: David Yunta Garro (dyunta [at] alumnos [dot] urjc [dot] es)
  • Academic Year: 2008-2009
  • Degree: Undergrad
  • Jde Version: jde 4.3.0
  • Tags: webots, opencv
  • Technology: c, c++, opencv
  • State: Developing
  • Document License:


Contents

Python

Programming a simple graphical interface to visualize an image. This has been used wxPython (library binding for the wxWidgets graphical programming language Python).


  • By selecting Button: This will create a frame with two panels, one containing the buttons and other image display, which will change depending on the selected button. This case has been done through the creation of various kinds, which communicate with each other.


  • By choosing to list: In this case we used a ComboBox, that pressing a button on it displays a list, where you can choose to display the image. The image is constructed by a Bitmap panel.



Visual Programming

The concept of visual programming is a little confusing because it is now considered visual programming to textual programming languages have a graphical interface to visualize what one is developing. This visual programming concept is wrong because this is one that by creating programs icons you can go without a back of the textual language.

The visual programming refers to software development where the graphical notations and interactively manipulate software components are mainly used to define and compose programs. The visual programming provides the necessary knowledge to design and develop applications using a visual environment friendly and easy to use for the user.

Visual programming languages (LVP) tend to make it easier for programmers since the first programming languages to create a window was a task of months of development and teamwork. Pueden definirse como: Can be defined as:

 	 - A programming language that uses a visual representation (such as graphics, drawings, animations or icons, partially or completely).

	 - A visual language manipulates visual information or supports visual interaction, or allows programming with visual expressions. 
 
	 - A visual language is a set of spatial arrangements of text and graphics symbols with a semantic interpretation that is used to 
        communicate in an environment actions.

	 - The LVPS are programming languages where visual techniques are used to express relationships or changes in the information.

Visual languages such as Visual Basic.Net, Borland Delphi, Visual C + + ...

  • Visual Basic:

    It is a programming language developed by Alan Cooper for Microsoft. The programming language is a dialect of BASIC, with important additions. Its first version was presented in 1991 with the intention to simplify programming by using a fully graphical development environment to facilitate the creation of graphical interfaces and to some extent the same programming. Since 2001 Microsoft has proposed to abandon the development based on Win32 API and go to work on a common framework or context independent bookstores version of the operating system. NET Framework through Visual Basic. NET (and other languages as C Sharp (C #) easy transition of code between them) who are serious incompatibilities with the existing Visual Basic code.

    Visual Basic is an IDE (integrated development environment or in English Integrated Development Environment) that has been packaged as an application program, ie, consists of a code editor (program where you type the source code), a debugger (program correcting errors in the source code so it can be either compiled), a compiler (a program that translates source code into machine language) and one builder GUI or GUI (is a form of programming in which it is not necessary write code to the graphical portion of the program, but can be done visually).

  • VISUAL C++:

    Windows environment is the most popular graphical user interface (GUI). From this point of view, Windows is a multitasking environment based on windows, accounting programs, and allows concurrent execution.

    To develop programs, Windows provides a library of routines and functions (SDK - Software Development Kit) that can handle components such as menus, dialogs, windows, etc...

    Visual C + + is an integrated development environment that enables object-oriented programming (OOP) in conjunction with the SDK development system (also called API) of Windows. Being an integrated environment for Visual C + + includes, inter alia, the following development tools:

     * Text Editor

     * Compiler / Linker

     * Debugge

     * Data Viewer and dependencies (Browser)



--Dyunta 00:46, 20 February 2009 (CET)


Finite Automata

An automaton can be described as formal operation of a system.

An automaton is an abstract model of a digital computer

   * Read symbols in the input
   * It produces the output symbols
   * It has a control unit

possible internal states

   * It can change the internal states in terms of the input
   * It may have some type of memory 

transducers / generators / acceptors Automata

  • Autómatas Finitos Deterministas:

    An AFD is a state machine that has access to input data. It's always in a state and can move to another state. That is achieved through these steps:

         * You read input data.

         * Depending on the data and the current state the automaton transits to another state.

  • Autómatas Finitos No Deterministas:

    The difference from previous is, while in a DFA there is only one possible action, a AFDC can choose among several alternatives of transition.


What is XML?

XML English acronym for Extensible Markup Language, is an extensible meta tags.

XML is a language very simple, but strict that plays a key role in the exchange of a wide variety of data. It is a language very similar to HTML but its main function is to describe data and not display them as is the case with HTML. It is a format that allows reading of data across different applications.

It is a simplification and adaptation of SGML and defines the specific language grammar.

Se propone como un estándar para el intercambio de información estructurada entre diferentes plataformas. It is proposed as a standard for exchanging structured information between different platforms. Se puede usar en bases de datos, editores de texto, hojas de cálculo y casi cualquier cosa imaginable. It can be used in databases, text editors, spreadsheets, and almost anything imaginable. Permite la compatibilidad entre sistemas para compartir la información de una manera segura, fiable y fácil. Allows compatibility between systems to share information in a safe, reliable and easy.

XML no es más que un conjunto de reglas para definir etiquetas semánticas que nos organizan un documento en diferentes partes. XML is not just a set of rules for defining semantic tags that we organize a document in different parts. XML es un metalenguaje que define la sintaxis utilizada para definir otros lenguajes de etiquetas estructurados. XML is a metalanguage that defines the syntax used to define other structured markup languages.


Ejemplo documento XML: Sample XML document:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<ficha>

<nombre>Angel</nombre>

<apellido>Barbero</apellido>

<direccion>c/Ulises, 36</direccion>

</ficha>


Interface

Build the interface using Gtk+, Glade and LibGnomeCanvas.

First step

Build a window to display an image, a button, and locate the position of the pointer. (inicio-posicion-Ventana-puntero.c)

Second step

Insertion of a canvas, which represent states (squares) and transitions (lines). Load and save in process. (interfaz-v1.cpp)

Third step

Reorganization of the window, insertion of buttons and frames. (interfaz-v2.cpp)

Move, copy, delete, change color item functionality.

Fourth step

Assign functionality to the buttons. Help button. Show extra windows depending on the pressed button. Appoint item. Redial Canvas.

Fifth step

Auxiliary window insertion of code. Painting selected item (insert). Show text typed in the window. Paint color item before leaving the window. Appoint item, name input through a window. Test XML file creation. Window open / save file. (interfaz-v3.cpp)

Sixth step

Fixed size square. Connecting squares by lines: each square will be connected to another by a line connecting the points (corners) closest to each square. Remove Square / Line taking into consideration any conexexiones between them (cascade delete). Restore color to close window. Save / load text. New structure element node (state) and trasnición (line). Help window, array of messages. Move figure taking into consideration any connections there with other figures (repaint lines). Embed line. Focus Change button. Move / delete names when the figure (state) moves / deletes. (interfaz-v4.cpp)


Seventth step

Correct the retarder to move states with name. Paint direction transitions. Upload file xml. Problem loading the file, because the act of painting was not performed until gtk is in control, so that one should "wait" before taking action on the items. (interfaz-v6.cpp)

Eighth step

Paint transitions loading file. Start with window maximized. Snippets. Button Compiling / Generate code. Initial state as editing states. Modify "save" to preserve the state's position if it has changed. Modify "load" to move the states. Upload text item. (interfaz-v7.cpp)

Ninth Step

Troubleshooting bidirectional transitions between states. Solve "move transitions." Solve display help text. Troubleshooting generate code .C (Calling "generate" process) (interfaz-v8.cpp)

Tenth Step

Incorporate schema name "Button Generar.c" and "Compile button" working. Troubleshooting connection states (interfaz-v9.cpp)

Eleventh Step

Add button "Save As". Default schema name = "Default". Save / Save As saves the schema name and the address where the generated schema will be saved. "Building C" and "Compiling" generate .C and .OS files and will be saved in the direction of the scheme.

Incorporation of temporal conditions in transitions.

Incorporation of selection of variables (sensors and actuators) to incorporate in the scheme.

Remove help button.


Eleventh Step

generated schema "Go Online" in gazebo. Correct error loading xml schema (bad connections transitions). Modification editing windows (interfaz-v11.cpp)


THE APPLICATION'S FUNCTIONALITY

This video shows all the basic functionality to create the automata.



Code Generator

First step

Generate a code that generates, from the file. Xml generated by the interface, a code .C

To this end, I have generated an automaton that computes the summation of a number, in this case 3. (generate-v1.cpp)

Second step

Make a bump & go.

This has generated a 2-state automaton (walking and obstacle). In the state walking, the robot walks until he finds an obstacle. In the state obstacle, the robot rotates 20 degrees, and if it encounters an obstacle enters the state walk.

Once the automata generated, is generated. C, with the above code.

To test the performance of the robot, we used Stage.

Third step

Bump & go in jde.

Fourth step

Building the intergaz from the scheme. No navegation.c The scheme starts directly. (generate-v2.cpp)

Fifth step

Add variables required. Show window automata. Incorporate timer condition.


Solved the state change. Automata engine coupled to the engine of the scheme.

Bump & Go

Sigue Linea

Raton y Gato

Raton & Gato with obstacles

Retrieved from "http://www.jderobot.org/index.php?title=Dyunta-pfc-itis&oldid=5062"
Views
Personal tools
main
docs
projects with jderobot
Toolbox