To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 7937
7936  |  7938
Subject: 
How to communicate sensor value changes to RCX Tower
Newsgroups: 
lugnet.robotics
Date: 
Fri, 5 Nov 1999 14:59:19 GMT
Original-From: 
Farrukh S. Najmi <najmi@east.sunSAYNOTOSPAM.com>
Viewed: 
831 times
  
Hello all,

I am a mindstorm newbie and have just started writing a high level Java
toolkit for mindstorms. It is based on RCXPort by Scott Lewis at the lowest
level. Kudos to Scott for a greta job and for helping me get boot-strapped.

The toolkit is designed in the context of a Java and OO programming course
I am teaching to young middle school students. It is different from NQC,
RCXPort etc in that the main controlling program (controller) is written in
Java and runs on a JVM on a host computer other than RCX (it is never
downloaded as a program). Instead the controller send command to the RCX as
needed and the RCX sends sensor changes to the controller on an event
driven basis. This allows for the controller to not be resource constrained
and can be written in an OO fashion in Java using a high level class
library. It aslo allows me to teach key programming concepts in terms that
my students can appreciate. Once V1.0 is complete, I plan to make the bits
available. I also plan to port the toolkit to Palm Pilot running the KVM
Java Virtual Machine at some point, thus elimination the RCX tower and
using the palm's as a remote controller in addition to the software
controller.

My question to you is... I am not sure how to best send a changed sensor
value to the controller. I know I can always poll from the controller to
the RCX but that seems rather inefficient.  I have got an NQC program that
is attempting to model the event driven notification I am looking for.
Could someone help with some of the reamining detail:

-How to use SendMessage to notify the RCX tower of the new value of
SENSOR_1?
-How to best use the in-line function touchSensorDetector so that it can
use the sensorId and avoid hardcoding SENSOR_1?

Thanks for your help.

-----Begin NQC program

task touchSensor1Detector() {
    touchSensorDetector(1);
}

task main() {
    StopAllTasks();

}


void touchSensorDetector(int sesnsorId) {

    //Initialize sensor
    SetSensor(SENSOR_1, SENSOR_TOUCH);

    //initialize variable
    int lastSensorValue=0;

    while (true) {

        //Keep checking for change in sensor value in a loop
        while (lastSensorValue == SENSOR_1) {
           continue;
        }

        //Sensor value has changed
        //Remember new sesnor val in variable
        lastSensorValue = SENSOR_1;

        //Send the new sensor value to master control program on host
computer
        //SendMessage();

        //Clear the Message so new Messages may come in
        //ClearMessage();
    }

}

Vadim Strizhevsky wrote:

Todd Lehman writes:
[snip]
   3.  Vadim Strizhevsky's & Owen Stenseth's RCXLib (not sure of the
       current status)



Sad to say, but it is more or less dead. No effort or coding for it
has been done since, oh probably New Years time. Both Owen and myself
sort of lost interest and/or time in the project or mindstorms or
maybe both. Speaking from myself I haven't in general touched my
mindstorms set (the only LEGO set I ever owned) since around that time
as well, which is probably the most direct reason for not advancing
this project.  And although I keep alive hopes of getting back into it,
reallisticly it will probably not happen as I moved on to other
things. But as they say, never say never...

I'm glad to see that the topic of Palm->Mindstorms control, which was
of special interest to me, is not dead. And while I haven't tried Mike
Kory's program, looking at its screen shots it looks excellent, and
at much more advanced point than the stuff we did. Good Luck Mike!

Thanks,
Vadim

--

Regards,
Farrukh



--
MIME ATTACHMENTS DISCARDED:

1.  Content-Type: text/x-vcard; charset=us-ascii;
     name="najmi.vcf"
    Content-Transfer-Encoding: 7bit
    Content-Description: Card for Farrukh S. Najmi
    Content-Disposition: attachment;
     filename="najmi.vcf"
    Content-Length: 286



Message has 2 Replies:
  Re: How to communicate sensor value changes to RCX Tower
 
I believe that Variable 0 can be used as a flag and there is a special way to constantly poll for a change in that value. Perhaps you could have a task that logs all sensor values into the RCX DataLog and use Variable 0 to indicate when the DataLog (...) (25 years ago, 5-Nov-99, to lugnet.robotics)
  Re: How to communicate sensor value changes to RCX Tower
 
Farrukh S. Najmi <lego-robotics@crynwr.com> wrote in message news:3822F0C7.A06551...sun.com... (...) I doubt you can beat just polling it to death. Anything else might be a little more efficient, but will probably introduce delay and complexity. (...) (25 years ago, 6-Nov-99, to lugnet.robotics)

Message is in Reply To:
  Re: Palm Pilot to RCX remote controller
 
Todd Lehman writes: [snip] > 3. Vadim Strizhevsky's & Owen Stenseth's RCXLib (not sure of the > current status) > > Sad to say, but it is more or less dead. No effort or coding for it has been done since, oh probably New Years time. Both Owen and (...) (25 years ago, 4-Nov-99, to lugnet.robotics)

14 Messages in This Thread:






Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR