[Tweets]

12/02/2018 11:18am
Indeed! [LINK]
08/02/2018 4:07pm
The advert video for @iros_2018 is really good! I wish robots really served coffee at the conference [LINK]
07/02/2018 10:10am
RT @NatureEcoEvo: Cockroach and termite genomes reveal molecular basis of termite eusociality [LINK] [LINK]
06/02/2018 1:29pm
Robotics for Nuclear Environments - a really cool website for a really cool project that I am currently a part of a… [LINK]
02/02/2018 8:09pm
RT @RIFBristol: Everything you need to know about Bristol’s sci-tech scene [LINK] via @siliconrepublic [LINK]

[NXC UserInteraction Library]

Date: Mar 2012
Tags: robotics :: Mindstorms

Current version: 1.2 :: Follow me on Twitter for updates

The User Interaction (UIn) Library helps you create standard user interfaces (multi-line aligned texts, buttons, menus, etc.) and capture user actions on the NXT Mindstorms brick.

The library works with the intelligent brick buttons and keeps all your sensor ports free for your program to use.

The UIn Library is a single .h file that can be included with your NXC project. It has been tested with NBC version 1.2.1 r4 and requires the NXC extended firmware. Please read the development setup tutorial if you are not sure how to get extended firmware.

Main features

How it works

Download a demo (XCode) project to try out the whole UserInteraction library.

This is an example of using a sliding menu in order to decide which task to exectute. UIn function createSlidingMenu() is called with appropriate arguments and the program waits until user selects an option from the menu. The user choice is then resolved by the calling task. Note that ExitTo(Task newTask) is used in order to close the current task and start a new one. This prevents unpredictable behaviour of the new task when calling UIn and other functions.

#include "UserInteraction.h"

task main() {

    //-- create menu with 2-line option items
    string menuItems[3] = {"First#Option","Second#Option", "Third#Option"};
    int userResponse = createSlidingMenu("Select#an option",menuItems, 0);

    //-- resolve answer from the sliding menu
    switch (userResponse) {
        case 0:
            // Selected 'First Option'
            ExitTo(onFirstOption);
            break;
        case 1:
            // Selected 'Second Option'
            ExitTo(onSecondOption);
            break;
        default:
            // Selected 'Third Option'
            ExitTo(onThirdOption);
            break;
    }
}

task onFirstOption() {}
task onSecondOption() {}
task onThirdOption() {}

}

Other features

Text drawing functions

Shape-drawing functions

Helper functions

  • int getTextPixelLength (string text_)
  • int getAlignedTextPosition (string text_, UIN_ALIGNMENT alignment_)
  • int normaliseTextXPosition (string text_, int xPosition_)
  • int lastPos(string substr_, string string_)

Math functions

  • int round (float number_)
  • float abs (float number_)

Other


Please comment or email me if you have questions or ideas about new functionality.

Comments

Lenka
[26/03/2013]


Hi Raj, I'm glad you got it sorted, although that is a strange solution as those two macros are defined in the library file itself so you would only add those lines if you wanted to change the values. Anyways, I wish you luck, thanks for downloading the library.
Raj
[26/03/2013]
oh, I got it solved by adding following two lines.

#define QUESTION_DIALOG_BOTTOM_LINE_Y 18
#define SCREEN_PADDING 5

thanks
Raj
[26/03/2013]
hi,

my long wish has been answered by your excellent interface library. I'm getting error while compiling your demo code with lot of syntax error.

I'm using Bric Command Center Version 3.3(build 3.3.8.10) in windows xp. I can see that UserInteraction.h does exist on the same directory.

Am I missing anything ?

thanks
raj


{Please enable JavaScript in order to post comments}

[You might also be intested in...]

NXTPong
A custom-built lego machine for playing pong, featuring two controllers connected to the Mindstorms NXT brick. Programmed using NXC.
Developing in NXC using XCode
After comparing a number of options, I chose NXC as a pretty good alternative to Robot-C. It supports a lot of things like sensor and motor management, playing of sounds, basic 2D and 3D graphics, etc. Most importantly, you can compile your programs from the command line or from XCode. This tutorial assumes knowledge of XCode 4 and of C. The NXC programming guide is a good reference.
Setting up NXC Development on a Mac
This tutorial provides a step-by-step guide for setting up your Mac or Linux machine and your NXT brick for development with NXC. We will use the enhanced NXC firmware in order to enable extended functions for development.
V-REP, Gazebo or ARGoS? A robot simulators comparison
Let’s have a look at three commonly used open-source simulators for robotics: V-REP, Gazebo and ARGoS, to find out which one suits your project the best.
Designing Effective Roadmaps for Robotics Innovation
Automated factories, autonomous delivery drones, self-driving cars: these and similar technologies will soon touch every aspect of our lives. An engaging discussion about how these technologies are regulated and innovated took place at the IROS 2017 conference.
The Information-Cost-Reward framework for understanding robot swarm foraging
The Information-Cost-Reward (ICR) framework relates the way in which robots obtain and share information about where work needs to be done to the swarm’s ability to exploit that information in order to perform work efficiently in the context of a particular task and environment.