To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcxOpen lugnet.robotics.rcx in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / 2075
2074  |  2076
Subject: 
Re: Remote control under linux
Newsgroups: 
lugnet.robotics.rcx
Date: 
Fri, 23 May 2003 17:59:38 GMT
Viewed: 
2938 times
  
In lugnet.robotics.rcx, Bapt Denaeyer writes:
Like
http://www.drvegetable.com/

I've devellop a program to emulate the mindstorms remote controller
under linux

I'm using GTK, here is a snapshot :
http://nanobapt.homelinux.com/img/essais/linremote.png

if you want to have it download it here :
http://nanobapt.homelinux.com/linremote.c

to compile it you have to install gtk-dev 2.0
and compile with this option :

gcc -Wall -g linremote.c -o linremote `pkg-config --cflags gtk+-2.0`
`pkg-config --libs gtk+-2.0`

Default tty use is /dev/ttyS0 see source to change it

I'll include it on legnoppix

Have fun

nanobapt

Nice work!  Glad to see a native Linux version of this.

Quickly scanning your source code (no Linux machine to run it on today!) I
notice that you send RCX opcodes in order to emulate the effect of each
button on the remote.  This is an interesting approach, but is subtly
different than how the MindStorms remote works.  The remote uses a special
opcode to control the RCX.  I've been meaning to document this protocol for
awhile now, so here goes...

The remote always sends the same basic packet for all keypresses.  It
continues to send this message for as long as one or more keys is held down,
and then sends a final packet to indicate when the last key has been
released.  The RCX will also assume "all keys up" if it stops receiving
these packets for a short amount of time.  The packet format is as follows,
where "~" indicates taking the 1's complement of the byte that follows:

    0x55 0xFF 0x00 0xD2 0x2D msb ~msb lsb ~lsb chk ~chk

The data in the packet is a 16-bit value (msb/lsb) containing a "1" bit for
each button that is pressed at any given time.  The checksum byte, chk, is
formed the same as for other RCX packets.  A key value of 0x0000 indicates
that all keys have been released.  You form the msb/lsb by ORing together
the bits for each button that is held down:

   Message 1:  0x8000
   Message 2:  0x4000
   Message 3:  0x2000
   Motor A Fwd:  0x1000
   Motor B Fwd:  0x0800
   Motor C Fwd:  0x0400
   Motor A Rev:  0x0200
   Motor B Rev:  0x0100
   Motor C Rev:  0x0080
   Program 1:  0x0040
   Program 2:  0x0020
   Program 3:  0x0010
   Program 4:  0x0008
   Program 5:  0x0004
   Stop:  0x0002
   Beep:  0x0001
   All keys up:  0x0000

I could be reading your code incorrectly, but it would appear that your
program will run the motor in the desired direction for a short time
interval before shutting it off again?  Does your program allow the user to
hold a button down for an extended period of time to keep the motor
spinning, or does each button click provide a short motor burst?  Do you
allow the user to press more than one button at a time?

The advantages to using the remote's protocol instead of the discrete
opcodes that you have used is that you can send multiple simultaneous button
presses at the same time and the RCX will automatically stop the motors when
you release the buttons.  Not to create more work for you, but you might
find some benefits in modifying your program to use the remote protocol
instead.  (If I'd known you were doing this, I would have documented this
sooner.)

Again, very nice work!  I hope this information is helpful.

- Chris.



Message has 1 Reply:
  Re: Remote control under linux
 
Oh chris I have a litle problem. I want to execute the program 1 and it stop when I stop to send the message Is there an other code to send to hand this progrma ? nanobapt (21 years ago, 25-May-03, to lugnet.robotics.rcx)

Message is in Reply To:
  Remote control under linux
 
Like (URL) devellop a program to emulate the mindstorms remote controller under linux I'm using GTK, here is a snapshot : (URL) you want to have it download it here : (URL) compile it you have to install gtk-dev 2.0 and compile with this option : (...) (22 years ago, 23-May-03, to lugnet.robotics.rcx)  

6 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