Reading RS Media Sensors and Positions via Serial Link

13 posts / 0 new
Last post
skinnymathew
skinnymathew's picture
Reading RS Media Sensors and Positions via Serial Link

Hi,

I'd like to know if it's possible to read the positions of the RS Media joints via the serial link. I'm toying with the idea of developing a microcontroller add-on to connect to the robot in order to both control it and add more sensors, but after reading the forums it looks like the feedback available from the robot is limited. Can someone confirm this, please?

Thanks.

gerber
gerber's picture

Hi Skinnymathew

I looked into this myself and as you said there isn't a way of getting the joint positions very easily unfortunately. I wanted to do this for my RS media controls station software so I could get the robot graphic in my software to represent exactly the same position as the actual robot. There is a possible solution to do this but I need to learn a bit of java first to achieve it and have never got round to doing so. If you download the Java SDK for the RS media from the download area

http://www.robocommunity.com/download/17591/Java-SDK-for-RS-Media-with-U...

and write a small program that will run on the robot and will retieve all sensor positions and then write these to a file on the rs media so you can read these via a pc. I am planning to do this myself at some point in the future but at the moment I am spending all my spare time working on the next release of my software.

Hope this info helps you.

Cheers
Gerber

skinnymathew
skinnymathew's picture

gerber said: a small program that will run on the robot and will retieve all sensor positions and then write these to a file on the rs media

This sounds ideal - the microcontroller can parse this file over the serial link and figure out what the sensors are reporting. The Developers Guide in the SDK has been a great help, thanks.

Vader
Vader's picture

I'm pretty sure you can use the serial link to the robot board for this (/dev/ttyS1) and relay it over to the port used in the serial hack (/dev/ttyMX0). You might have to kill the main programs first though.

skinnymathew
skinnymathew's picture

Vader said: I'm pretty sure you can use the serial link to the robot board for this

By "this" do you mean the Java approach, or talking directly to the robot board from the microcontroller and using the uC as the new "brain"?

Vader
Vader's picture

I was referring to writing a C/C++ program that runs on the Linux OS.

Helibot
Helibot's picture

Hi all,
From my poking around I think that the Linux board does NOT know what positions the motors are at. The robot board knows which positions the motors are at and this info is not sent to the linux board. The linux board can send message to the robot board to request the robot board to move to positions , but it does not control them directly and does not get feedback as to where they are. (I think this is because Wowee made RSMedia by taking the RSV2 (with existing motor board) and just adding the Linux board to it, then they added commands to allow linux board to 'request' the motor board todo movements. This would have been the easiest and safest way for them to make RSM from RSV2.

I'm pretty sure you can use the serial link to the robot board for this (/dev/ttyS1) and relay it over to the port used in the serial hack (/dev/ttyMX0). You might have to kill the main programs first though.

The mode and sensor info (IR/buttons/remote keys) are the only info sent from the motor board to the linux board, so that the only info you can access in linux :-(.

Cheers Helibot

Helibot
Helibot's picture

Vader said: I'm pretty sure you can use the serial link to the robot board for this (/dev/ttyS1) and relay it over to the port used in the serial hack (/dev/ttyMX0). You might have to kill the main programs first though.

Yes, you are correct. You can send commands to the robot board via /dev/ttyS1. You can do it without killing the main program, but if you want exclusive contol it is better to kill the main program.

I wrote some code that replaces the main program and can control the motor positions and read sensors. It was used and released for the 'Copybot' program.  I was intending to enhance it further and make 'Helios' - a replacment OS for RSMeida, but have run out of time for RSMedia work at the moment :-(.
But anyone intersted could certainly use the Copybot program as a base and extend it to control more limbs and process more sensor data.

Cheers
  Helibot

Vader
Vader's picture

How does the Java SDK read the positions then? I'm thinking that there might be a command you can use to request them.

BTW, I'm working on a easy-to-use GUI kit for RSM as an alternative to EmTK.

Helibot
Helibot's picture

Hello Vader,
I haven't used the JDK, but I am guessing that it doesnt actually read them but just keeps a record of where the motors were last asked to move to. Then it just returns these when asked where the motors are. This may work in most cases , but its likely that the java and robot board to get out of sync.
Its possible that there is a special command. Do you have an example java program that does this? I may be able to 'spy' on the /dev/ttyS1 when the program is run to find out what the command is.

Cheers
Helibot

Vader
Vader's picture

No, but the Java SDK is public now (in the downloads area).

EDIT: See this thread: http://www.robocommunity.com/forum/thread/11371/Test-MIDlet-for-Sun-SDK-...

Helibot
Helibot's picture

Vader said: No, but the Java SDK is public now (in the downloads area). EDIT: See this thread: http://www.robocommunity.com/forum/thread/11371/Test-MIDlet-for-Sun-SDK-on-RS...

  I notice that Nocturnal came to the same conclusion as me in this post.

http://www.robocommunity.com/forum/thread/11371/Test-MIDlet-for-Sun-SDK-on-RS-Media-/#4619

And I don’t think that the other posts proved one way of the other about whether ‘get servos ‘ was returning real data.

If I find time I will check it out. The best way to test it is to run the Java program and get it to move an arm to MAX. read the servos. Manually move the arm to lower . then read the servos again. If the two reads are the same then they are faking the reads. If they differ then we are in business…they are actually reading real data from the positional encoders/pots.

I also noticed an interesting statement in the pdf with the Java SDK at page 16 (in Robot Control Developers Guide.pdf).

“Once in media mode you also need to press the “D” button on the remote control. Pressing “D” toggles “where the robot firmware sends events including remote control events.

Because the midlet programs will not receive events until the robot has been switched into “Media mode” and the “D” button pressed most midlets should use a menu to delay beginning the core operation of the midlet until manually started (see section 8.1, “Java ME Functionality”).”

I wonder if pressing D in normal media mode changes how events are handled. Will try this as well when I have time.

 

Cheers

  Helibot

Vader
Vader's picture

Ahh, I was having trouble with key input with the midlet. I'll have to try that.

EDIT: Still no success with accessing the menu, although D does affect key input...