Author Archive

Mechatronics Open Source Software

Right now all the engineering disciplines do a great use of computational programs, in the design of any appliance you have in home or in your car a great use of software was made. That’s totally true with the Mechatronics world where you can have the bless to integrate very useful discipline to create a truly “intelligent” or automate process.

The use of private software in the field has made some time difficult for a hobbies or student to use it because his highly price. A alternative way has been in progress for some time with the Free Software Community willing to develop software and share it with the world for free (as free spech). Among all those Open Software Projects there are many related with the mechatronics field, that I will describe here and give some advice in it use from my own experience.

I’ll would really like to incentive you to participate in some of this projects, the first you can do is give it a try.

CAD Software

QCAD: QCad is an application for computer aided drafting in two dimensions (2d). With QCad you can create technical drawings such as plans for buildings, interiors, mechanical parts or schemas and diagrams. QCad works on Windows, Mac OS X and many Linux and Unix Systems. The source code of the QCad community edition is released under the GPL (Open Source).

BRL-CAD: The BRL-CAD package is a powerful Constructive Solid Geometry (CSG) solid modeling system with over 20 years development and production use by the U.S. military. BRL-CAD includes an interactive geometry editor, parallel ray-tracing support for rendering and geometric analysis, path-tracing for realistic image synthesis, network distributed framebuffer support, image-processing and signal-processing tools. The entire package is distributed in source code form.

Electronics squematic diagrams

Kicad: is an open source (GPL) software for the creation of electronic schematic diagrams and printed circuit board artwork.

gEDA Project: The gEDA project is working on producing a full GPL‘d suite of Electronic Design Automation tools. These tools are used for electrical circuit design, schematic capture, simulation, prototyping, and production. Currently, the gEDA project offers a mature suite of free software applications for electronics design, including schematic capture, attribute management, bill of materials (BOM) generation, netlisting into over 20 netlist formats, analog and digital simulation, and printed circuit board (PCB) layout.

Electronics PIC Microcontrollers

GPUTILS: GPUTILS is a collection of tools for the Microchip (TM) PIC microcontrollers. It includes gpasm, gplink, and gplib. It’s distributed under the terms of the GNU Public License. See the gnupic page for other GNU PIC tools such as gpsim, a gputils compatible simulator.

PiKdev: is a simple graphic IDE for the development of PIC-based applications.
It currently supports assembly language. C language is also supported for PIC 18 devices.

Programming software

GCC: the GNU compiler collection

CodeBlocks: Code::Blocks is a free C++ IDE built to meet the most demanding needs of its users. It is designed to be very extensible and fully configurable.

Cross platform GUI

wxWidgets: wxWidgets lets developers create applications for Win32, Mac OS X, GTK+, X11, Motif, WinCE, and more using one codebase. It can be used from languages such as C++, Python, Perl, and C#/.NET. Unlike other cross-platform toolkits, wxWidgets applications look and feel native. This is because wxWidgets uses the platform’s own native controls rather than emulating them. It’s also extensive, free, open-source, and mature.

Mathematical analysis

Scilab: Scilab is a scientific software package for numerical computations providing a powerful open computing environment for engineering and scientific applications.

The descriptions has been copied from the projects websites. Surely there are a lot of other projects, but my idea is to post here the ones I have used. If you know another one feel free to posted. To help me show all the benefits we can get by using open source software.

April 4, 2007 at 10:17 pm 2 comments

QCad Fluid Power Library

Hi all, I create a fluid power library for QCad based on the ISO1219 standard in the fluid power technology for the automation industry.

Here is a screeshot of what you can do:

QCad example

Another screenshot showing QCad and the library.

QCad screenshot

At the moment I can’t upload the file here. So please post here and I’ll send you the library. Bye.

January 27, 2007 at 12:20 pm Leave a comment

Adding a Lexer to wxStyledTextCtrl

This is my 2 days work to create a new lexer for wxStyledTextCtrl (wxSTC). The first think you should now is that wxSTC is a wrapper around a widely know text control named scintilla. So if you want to add a lexer you really are adding it to the scintilla distribution that wxSTC comes with.

There is this web page where you can found how to add a lexer to scintilla and his Text Editing application called SciTE. The first step are basically the same.

You should have a $(wxDIR)/contrib/src/stc dir where you have all the thinks that goes with the control, I not a expert in this just I saw what I needed to add the lexer, in the documentation you will find more information. for the moment you shold go to that directory and follow the step. We supposed we’re adding some language call it foo.

1. So go to the scintilla/include dir and open the SciLexer.h file, ther you will add a ID value:
#define SCLEX_FOO=79, (supposed the last ID was 78)
And any lexical class IDs:

2. Now you should add the ID value to stc.h locate in $(wxDIR)/contrib/include/wx/stc.
#define wxSTC_LEX_FOO 79 and
#define wxSTC_FOO_DEFAULT 0
#define wxSTC_FOO_COMMENT 1

I think you should be able to recognize a order in the file so you can do it that way.

3. In the scintilla/src/LexOthers.cxx write a ColouriseFooDoc function similar to one of the other functions such as ColouriseLatexDoc. For a more detailed guide open the file LexCpp.cxx and see the ColouriseCppDoc. What I did just to copy and paste that function and fit it to my needs.

LexerModule lmfoo(SCLEX_FOO, ColouriseFooDoc, “conf”);

4. If this is a complex lexer then it may be better off in its own file, in which case clone one of the current files and then add the file to all of the make files where LexOthers is currently referenced

5. You should be able to compile wxSTC and does all.

That was the steps I followed to get the lexer working, you should see this page to understand what the Colourise function does: []

To get the lexer working we would modify the sample that comes with wxSTC, you should find it in $(wxDIR)/contrib/samples/stc, here what we need to do is to modify the prefs.cpp file, this contains all the preferences for the lexers:

1. If you have some Keywords you should added just follow the way C++ and Python does.

2. To the g_LanguagePrefs const add _T(“FOO”) with your definitions.

That’s all you should be able to compile the sample and select the Foo language from the View->Highlight Language->Foo

I hope that serves you.

January 26, 2007 at 3:23 am 1 comment


This is just a adaption from the one existing in wxPyWiki to the c++ language. It will include al least the information posted there and any other you will like to contributed. Some parts has been just copy-paste, my apologize if this violate some copyrights. Anyway I like to thanks the contributors from the wiki described above.


Development Status

  • OGL development appears to be dead.
  • There does not appear to be OGL maintenance.
  • Object Graphics Library (OGL) is a C++ library supporting the creation and manipulation of simple and complex graphic images on a canvas. It can be found in the directory $WX_PATH/contrib/ogl/src in the wxWidgets distribution. The file ogl.h must be included to make use of the library.

    Documentation Status

    The standard OGL documentation is old and erronius.

  • Standard OGL docs consist of:

  • class library documentation
  • notes
  • a complicated sample
  • This wiki entry is an effort to fix the situation.

    If you are using OGL, please post your notes and corrections to this wiki page..!

    Sample code

    Minimal wxOGL Application

    This is a minimal application demonstrating wxOGL, contributed by LionKimbro

    #include "wx/wx.h"
    #include "wx/ogl/ogl.h"class MyApp: public wxApp
    virtual bool OnInit();
    class MyFrame: public wxFrame
    MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
    bool MyApp::OnInit()
    MyFrame *frame = new MyFrame( "wxWidgets - Object Graphics Library", wxPoint(50,50), wxSize(450,340) );
    return TRUE;
    MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
    : wxFrame((wxFrame *)NULL, -1, title, pos, size)
    wxShapeCanvas *canvas = new wxShapeCanvas(this, wxID_ANY, pos, size, 0, wxT("a"));
    wxDiagram *diagram = new wxDiagram();
    wxCircleShape *shape = new wxCircleShape(20.0);

    The above code just create the wxShapeCanvas and graph a circle on it. Although that not so much that will help you get started.

    Mouse event in circle

    This example code, let you define some events in the shape, for example It has implemented the left ans right click.

    #include "wx/wx.h"
    #include "wx/ogl/ogl.h"
    class MyApp: public wxApp
    virtual bool OnInit();
    class OGLFrame: public wxFrame
    OGLFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
    class OGLCanvas: public wxShapeCanvas
    OGLCanvas(wxWindow *parent = NULL, wxWindowID id = wxID_ANY,const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,long style = wxRETAINED);
    class MyEvtHandler: public wxShapeEvtHandler
    MyEvtHandler(wxShapeEvtHandler *prev = NULL, wxShape *shape = NULL,
    const wxString& lab = wxEmptyString):wxShapeEvtHandler(prev, shape) {}
    ~MyEvtHandler(void) {}
    void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
    void OnRightClick(double x, double y, int keys = 0, int attachment = 0);
    bool MyApp::OnInit()
    OGLFrame *frame = new OGLFrame( "wxOGL", wxPoint(50,50), wxSize(450,340) );
    return TRUE;
    OGLFrame::OGLFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
    : wxFrame((wxFrame *)NULL, -1, title, pos, size)
    OGLCanvas *canvas = new OGLCanvas(this);
    OGLCanvas::OGLCanvas(wxWindow *parent, wxWindowID id, const wxPoint& pos,
    const wxSize& size, long style):
    wxShapeCanvas(parent, id, pos, size, style)
    wxDiagram *diagram = new wxDiagram();
    wxCircleShape *circle = new wxCircleShape(100);
    MyEvtHandler *evthandler = new MyEvtHandler();
    void MyEvtHandler::OnLeftClick(double WXUNUSED(x), double WXUNUSED(y), int keys, int WXUNUSED(attachment))
    wxMessageBox(wxT("Left click"),
    wxT("wxOGL"), wxOK | wxICON_INFORMATION);
    void MyEvtHandler::OnRightClick(double WXUNUSED(x), double WXUNUSED(y), int keys, int WXUNUSED(attachment))
    wxMessageBox(wxT("Right click"),
    wxT("wxOGL"), wxOK | wxICON_INFORMATION);

    Compiling sample code

    Although this is a very basic thing, maybe some newbies like I was (or am?) need it.

    g++ ogl.cpp -o ogl `wx-config --libs` `wx-config --cxxflags` -lwx_gtk2_ogl-2.8

    January 26, 2007 at 12:48 am Leave a comment

    Hello world!

    Welcome to Mechatronics Things. This is my first try to do thid kid of thing. I will like to share here anything I’m learning this days like a Mechatronics Engineer, in the other hand this blog will be a opportunity to share with the Open Software Community.

    January 25, 2007 at 5:15 pm Leave a comment

    Recent Posts