Programming in linux

Mar 17, 2005 8 Replies

This is a take off from the "sharing ideas" thread. I have a robot that is controlled from a laptops serial port. My control software has been in VB but now I'm switching it over to linux. My code is all in C. I'm at the point now where I need to start developing a mapping system. I have this all working in vb but I'm not sure how to handle the graphics in linux. I'm looking into using GTK since it looks easy enough to add buttons and other widgets to my existing C code. Has anyone done any mapping in C in linux? I'm just wondering what is the best way to draw the map? The way I did it in VB was using lots and lots of square "shapes". It worked well but was slow. Everytime I got a sensor update it took like 400ms to redraw the screen. Any suggestions? Thanks Ringo



Ringo,

For the simple, output only displays I have done so far (strip charts, logic displays, and XY plots), I just use Xlib calls. When I actually get around to implementing control screens, I guess I will have to learn a widget library.

Jeff.

R> This is a take off from the "sharing ideas" thread. I have a robot that

: the graphics in linux. I'm looking into using GTK since it looks easy : enough to add buttons and other widgets to my existing C code. Has : anyone done any mapping in C in linux? I'm just wondering what is the : best way to draw the map? The way I did it in VB was using lots and

GTK is great for the interface, but for actually drawing the image I would look at the GD library, which is specificly designed for on the fly creating of images. It's a standard part of most distros (it is in RedHat/ Fedora). Even has a Windows version.

formatting link

I might strongly suggest that you look at tcl/tk. Firstly, it is a scripting language which has a minimal learning curve, has a widget library which is simple to use, and runs on windows, unix, linux and elsewhere. Secondly, linking c code, or even extending the language is ridiculously simple.

Cheers, Rob.

I looked at TCL/tk briefly and it is extremely easy to make buttons and that sort of thing, but I didn't see anything for drawing. Did I miss something? I need to be able to draw teh sonar scans, and maps and such. Thanks Ringo

I like Java for this. I'm doing most of my robotic programming in Java now.

And besides which, I don't do graphics programming on my robot. If I need to do something like that, I send the data over the net and write a client to display the results in humna-readable form.

-- D. Jay Newman

formatting link

Ringo,

Check out the .canvas widget. Drawing is VERY easy. Further, there are

3rd party extensions like Zinc, which further extend the usefulness of canvas, and the photo (image) extensions which facilitate raster style images as well .jpg, and tcl bindings for imageMagick and GraphicsMagick.

While Java is popular, I have never really taken to the language.

Tcl/Tk has many advantages which make development quick and simple. I find that like forth, incremental development is very easy to accomplish with tcl procs, but unlike forth, there is no stack based expression stuff to learn and weird syntax stuff. Perhaps the best benefit of Tcl/Tk is the simplicity with which you can link C/C++ based extensions into the scripting tools (loading .dll's (.so's) at runtime, and calling C procedures directly ...

Info at the wiki:

formatting link
(C based extensions)
formatting link
(Canvas based information)

see also: comp.lang.tcl for an active developer base and user assistance.

Ringo,

I've been developping applications in C or C++ for linux/windows/solaris/Irix/QNX for a long time now. The same application runs on all the enumerated OS. I've done a small patch for the QNX version. That's what I use.

For buttons, menus, interface: FLTK

formatting link
there is an application called "fluid" from which you can design your interface. FLTK works great with OpenGL or Mesa3D for the 2D/3D rendering.
formatting link
and
formatting link
if opengl is not available "same function calls for both library"). Many library can be used with that combinaison. (
formatting link
,
formatting link
,
formatting link
)

There a lot of examples that come with FLTK.

OpenGL/Mesa3D are the fastest rendering library I've been working with. All new graphic cards support OpenGL. On my cheap graphic card, I have a refresh of 100 ms for 10000 Triangles in full 3D! For linux, QNX and W2K.

Hope it'll help!

Jean

R> I looked at TCL/tk briefly and it is extremely easy to make buttons and

If you like Visual Basic, you might want to check out the Gambas basic package. Webiste is:

formatting link
It has a development environment very near visual basic and it works well with Linux. It has a useful number of visual-basic like controls.

Cheers, Ed L

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required