Pages: [1]   Go Down
Author Topic: QP state machine framework for Arduino  (Read 6456 times)
0 Members and 1 Guest are viewing this topic.
Chapel Hill, NC, USA
Offline Offline
Newbie
*
Karma: 5
Posts: 11
Quantum Leaps, LLC provides lightweight, open source active object frameworks and graphical modeling tools for real-time embedded systems, such as single-chip microcontrollers. We bring quantum leaps of innovation to embedded systems programming by making
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The QP state machine framework has been just released (see http://arduino.cc/playground/Code/QP).

The QP framework very nicely complements the Arduino platform and provides everything you need to build well-structured, responsive, robust, and power-efficient Arduino programs based on modern hierarchical state machines. In many ways the open source QP state machine framework is like a modern real-time operating system (RTOS) specifically designed for executing event-driven state machines.

The QP development kit for Arduino provides also an example model for the free QM graphical modeling tool. QM takes Arduino programming to the next level, by eabling automiatic code generation of complete Arduino sketches.

The extensive Application Note "Event Driven Arduino Programming with QP" describes the main concepts and how to get started.

An Arduino port of the QP framework has been requested in this forum (see http://arduino.cc/forum/index.php/topic,38787.0.html), but it is no longer possible to post responses to the older forum.
Logged


Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 169
Posts: 12441
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Bookmarked !
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice!  Thanks!
Logged

Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 331
Posts: 16515
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This looks like it could possibly be a significant software tool for the Arduino community. I look forward to reviews and feedback from the our various software gods that hang around here.

Lefty
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8443
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Worth looking into I think. I hate learning new tools but every now and then you have to move to a better way of doing things.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

In my opinion, Mr. Samek's book is well worth the money.  "Hierarchical state machines" are an excellent solution to a class of problems often encountered in Arduino projects.  While Mr. Samek didn't introduce hierarchical state machines to the world his implementation is elegant, powerful, safe, and easy to maintain.

In my case, I couldn't wait for an "Arduino port" and created a simplified variant (QHsm with a shallow event queue).  But, even that, has allowed me to quickly build bug free easy to maintain applications. 

The big draw-back is the additional Flash requirements.  My simple applications would very likely fit into 4k (or maybe even 2K).  QHsm pushes them from 6K to just under 8K.
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 169
Posts: 12441
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Coding Badly, do you have an ISBN number of the book? or exact title?
Logged

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 176
Posts: 12283
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This is the one I own...
http://www.state-machine.com/psicc/

Looks like there is a version 2...
http://www.state-machine.com/psicc2/index.php
Logged

Chapel Hill, NC, USA
Offline Offline
Newbie
*
Karma: 5
Posts: 11
Quantum Leaps, LLC provides lightweight, open source active object frameworks and graphical modeling tools for real-time embedded systems, such as single-chip microcontrollers. We bring quantum leaps of innovation to embedded systems programming by making
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The book "Practical UML Statecharts in C/C++, Second Ed." (PSiCC2) has not been written with the beginner in mind. As the author of this book I just don't want anybody to get disappointed, especially because Arduino itself is targeted for non-specialists in embedded software development.

So, before you rush to buy the book based on some buzzwords, like "UML", "statecharts", or "ARM Cortex-M3", please play with the provided examples on your Arduino (see http://arduino.cc/playground/Code/QP) and take a closer look at the code. You can also read the introduction and the first chapter of the PSiCC2 book online at http://www.state-machine.com/psicc2/PSiCC2_excerpts.pdf. This first chapter is designed as a quick tutorial.

Event-driven programming can feel very unnatural for many people. That's alright. You have other alternatives, like the traditional RTOS, the venerable superloop with polling, protothreads (which are specifically designed to avoid state machines), and so on.

On the other hand, some studies indicate that event-driven programming introduced early in the teaching of software development can be beneficial (see "Event-driven Programming can be Simple Enough for CS 1" at http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.33.9431). So, if you like the event-driven approach, you would need an event-driven framework. QP is one of such frameworks and the PSiCC2 book is the ultimate resource for it.
Logged


nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8443
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried to download the PDFs from

http://www.state-machine.com/arduino/http://www.state-machine.com/arduino/AN_Event-Driven_Arduino.pdf

But got a 404 error. Notified the webmaster

webmaster@quantum-leaps.com.

but the email bounced.  smiley-confuse

Aaah, I just noticed the problem, the link is no good, it has the domain twice.
______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Chapel Hill, NC, USA
Offline Offline
Newbie
*
Karma: 5
Posts: 11
Quantum Leaps, LLC provides lightweight, open source active object frameworks and graphical modeling tools for real-time embedded systems, such as single-chip microcontrollers. We bring quantum leaps of innovation to embedded systems programming by making
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The broken link in the article http://arduino.cc/playground/Code/QP has been corrected.
Logged


Chapel Hill, NC, USA
Offline Offline
Newbie
*
Karma: 5
Posts: 11
Quantum Leaps, LLC provides lightweight, open source active object frameworks and graphical modeling tools for real-time embedded systems, such as single-chip microcontrollers. We bring quantum leaps of innovation to embedded systems programming by making
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The QP state machine framework for Arduino has been updated to the latest QP version 4.5.02 and is compatible with the latest graphical QM modeling tool version 2.2.02. The main improvement in these version is compliance of the source code with the strict MISRA-C++:2008 guidelines. 

The QP framework is described in the updated Arduino Playground article http://arduino.cc/playground/Code/QP, which describes how to download the code and tools.

Enjoy!
Logged


nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8443
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

This does look real nice, I'll have to save for future use as I'm not working with Arduino hardware at present.

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am very interested in using this framework for my project.  I am an experienced but rusty programmer but new to Arduino.  I'm used to thinking in higher level object oriented methods, know UML and understand state machines.

Becasue the QP framework uses the timers and interupts of the Arduino does this interfere with other functions that also use times such as Pulse Width Modulation for the built in analogwrite functions or the functions in the standard Servo library?

I am using an ATMega2560 board with the AdaFruit Motor Shield on it and the AFMotor library (which used PWM) and the Servo to control several motors and servos.  I've only done simple test code at this point to verify all my hardware works together in a very simple run time environment. 

I'd like to make sure there won't be a conflict before investing the time in learning and implementing anything in the QP Framework.

So far I have not been able to find any examples of project using this framework on Arduino, could you point me to any?

Thanks in advance.
Logged

Pages: [1]   Go Up
Jump to: