Squeak, gumstix, robots, and SmartRefStreams

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Squeak, gumstix, robots, and SmartRefStreams

Jon Hylands

Hi everyone,

I'm working on getting my new autonomous controller code working on the
gumstix (see http://www.huv.com/roboMagellan)

Currently, I save my mission object from my mission editor using a
SmartRefStream, like this:

file := SmartRefStream newFileNamed: 'missions\', mission name, '.obj'.
file nextPut: mission.
file close.

The mission editor runs on Windows XP, on my laptop, in a Squeak 3.7 full
image.

I copy the mission file over to the gumstix, and I read the mission from a
headless image (Squeak 3.7 basic image, not stripped in any way) on the
gumstix, which runs Linux.

I wrote a simple routine that loads my sample mission, and dumps
information about it to a text file. On my laptop, when I run this, I get
the following:

Name: Straight Line Test 01
Goal: (Start navigator: (Startup Navigator (AvLocation (Start - {50.00 @
30.00})) ) subGoals: ())
Goal: (Follow Path navigator: (Waypoint Navigator (2 waypoints) ) subGoals:
())
Goal: (Stop navigator: (Shutdown Navigator) subGoals: ())

On the gumstix, I get the following:

Name: Straight Line Test 01
Goal: (Start navigator: (Startup Navigator (AvLocation (Start - {0.00 @
0.00})) ) subGoals: ())
Goal: (Follow Path navigator: (Waypoint Navigator (2 waypoints) ) subGoals:
())
Goal: (Stop navigator: (Shutdown Navigator) subGoals: ())

Note, the only difference is the Start location is 0.0 @ 0.0, instead of
50.0 @ 30.0.

Any ideas?

Thanks,
Jon

--------------------------------------------------------------
   Jon Hylands      [hidden email]      http://www.huv.com/jon

  Project: Micro Seeker (Micro Autonomous Underwater Vehicle)
           http://www.huv.com

Reply | Threaded
Open this post in threaded view
|

Re: Squeak, gumstix, robots, and SmartRefStreams

Jon Hylands
On Wed, 25 Jan 2006 21:53:06 -0500, Jon Hylands <[hidden email]> wrote:

> Any ideas?

Well, to answer my own question, it appears that floats don't work reading
from a SmartRefStream on linux on a gumstix.

I did a much simpler test, that dumped an array with an Integer, a Float,
and a ScaledDecimal to a file. Reading it on my laptop works perfectly, but
on the gumstix I get the following:

#(1 1.0 4.20s2)

The Array I wrote out looks like this:

#(1 3.5 4.20s2)

Very interesting, especially since I use Floats for all my coordinates. The
gumstix may have some weird float processing issues - it doesn't support
floating point directly, so I think it uses either soft-float or kernelFP.

I sent off a message to my brother to ask him, but in the meantime I guess
I'd better see if floating point even works right on the gumstix...

Later,
Jon

--------------------------------------------------------------
   Jon Hylands      [hidden email]      http://www.huv.com/jon

  Project: Micro Seeker (Micro Autonomous Underwater Vehicle)
           http://www.huv.com

Reply | Threaded
Open this post in threaded view
|

Re: Squeak, gumstix, robots, and SmartRefStreams

Jon Hylands
On Wed, 25 Jan 2006 22:37:26 -0500, Jon Hylands <[hidden email]> wrote:

> I sent off a message to my brother to ask him, but in the meantime I guess
> I'd better see if floating point even works right on the gumstix...

Wow, seriously messed up...

According to my gumstix (the answers in brackets are what I get on my
laptop):

Float Test

1.325 = 1.0e-61
Float pi (3.141592653589793) = 3.0
1.0 / 3.0 (0.3333333333333333) = 0.0e102
Float pi + 2.0 * 1.3 / 30 degreesToRadians cos (7.71809974679502) = 1.0

Later,
Jon

--------------------------------------------------------------
   Jon Hylands      [hidden email]      http://www.huv.com/jon

  Project: Micro Seeker (Micro Autonomous Underwater Vehicle)
           http://www.huv.com

Reply | Threaded
Open this post in threaded view
|

Re: Squeak, gumstix, robots, and SmartRefStreams

Dave Hylands
In reply to this post by Jon Hylands
Hi Jon,

> Note, the only difference is the Start location is 0.0 @ 0.0, instead of
> 50.0 @ 30.0.
>
> Any ideas?

Hmmm. I'll have to take a look at the floating point support.

The ARM processor uses a weird layout for doubles (8 byte floats). The
4 byte words are in little endian format, but the pair of 4 byte words
is in big endian order (at least I think I got it right).

Does Squeak do interpretation of the floating point itself? I guess
the VM might be doing some kind of compensation.

The new gumstix builds also use a soft-float library (so no context
switches into the kernel) whereas I think that the VM you're using
does kernel emulated floating point.

--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/

Reply | Threaded
Open this post in threaded view
|

Re: Squeak, gumstix, robots, and SmartRefStreams

Yanni Chiu
Dave Hylands wrote:
> The ARM processor uses a weird layout for doubles (8 byte floats). The
> 4 byte words are in little endian format, but the pair of 4 byte words
> is in big endian order (at least I think I got it right).
>
> Does Squeak do interpretation of the floating point itself? I guess
> the VM might be doing some kind of compensation.

Dunno if this helps any, but in the PostgreSQL Client
there's a test (#testFunctioanCall2) which invokes
a postgres function call and checks the result.
IIRC, the function call takes arguments and returns
results in the native binary format of the postgres
server - could be wrong here. I made the test pass
by trial and error, and it may not really be portable
across different client/rdb platforms. There's a few
routines there that convert the arg/return values
to/from "some" 8-byte format. HTH.

--
Yanni Chiu


Reply | Threaded
Open this post in threaded view
|

Re: Squeak, gumstix, robots, and SmartRefStreams

timrowledge
In reply to this post by Dave Hylands

On 25-Jan-06, at 7:45 PM, Dave Hylands wrote:
>
> Does Squeak do interpretation of the floating point itself? I guess
> the VM might be doing some kind of compensation.

yup, it does. There's macros for fetching the Float and making a  
double and vice versa of course. If they have set the floating point  
library up the same as for RISC OS you could steal the versions from  
the RISCOS platform tree.
>
> The new gumstix builds also use a soft-float library (so no context
> switches into the kernel) whereas I think that the VM you're using
> does kernel emulated floating point.
Reminds me of the fun of getting things going on the NetWinder; gcc  
2.95 (etc) combined with the NW floating point emulator and/or  
library was terrible. It wasn't any  better a while later when we got  
VW running (well, trotting) on it.


tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Useful Latin Phrases:- Nihil est--in vita priore ego imperator  
Romanus fui = That's nothing--in a previous life I was a Roman Emperor.



Reply | Threaded
Open this post in threaded view
|

Re: Squeak, gumstix, robots, and SmartRefStreams

Dave Hylands
In reply to this post by Jon Hylands
Hi all,

> According to my gumstix (the answers in brackets are what I get on my
> laptop):
>
> Float Test
>
> 1.325 = 1.0e-61
> Float pi (3.141592653589793) = 3.0
> 1.0 / 3.0 (0.3333333333333333) = 0.0e102
> Float pi + 2.0 * 1.3 / 30 degreesToRadians cos (7.71809974679502) = 1.0

So, I had a configuration option set incorrectly DOUBLE_WORD_ORDER
needed to be defined to 1. All is well now - Phew!

I'll be updating the build instructions on my website in the next day or so.

--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/

Reply | Threaded
Open this post in threaded view
|

Re: Squeak, gumstix, robots, and SmartRefStreams

Jon Hylands
On Thu, 26 Jan 2006 16:46:21 -0800, Dave Hylands <[hidden email]>
wrote:

> So, I had a configuration option set incorrectly DOUBLE_WORD_ORDER
> needed to be defined to 1. All is well now - Phew!

Indeed - Later on tonight (after I charge the battery), I should have some
video of my robot, MicroRover, moving across the floor under its own power.
Just a simple, straight line mission to start with, using the compass,
wheel encoders, and the gumstix running Squeak.

I'll post a link here when it happens...

Later,
Jon

--------------------------------------------------------------
   Jon Hylands      [hidden email]      http://www.huv.com/jon

  Project: Micro Seeker (Micro Autonomous Underwater Vehicle)
           http://www.huv.com

Reply | Threaded
Open this post in threaded view
|

Re: Squeak, gumstix, robots, and SmartRefStreams

Jon Hylands
On Thu, 26 Jan 2006 19:55:34 -0500, Jon Hylands <[hidden email]> wrote:

> I'll post a link here when it happens...

Well, no luck on the movie -- its too dark at night to get a movie
captured, and I don't have enough lights around.

However, I took a still photo showing the gumstix mounted on the robot, and
I also included a new screenshot of the Mission Editor, with my very simple
straight line mission loaded.

http://www.huv.com/roboMagellan/

Later,
Jon

--------------------------------------------------------------
   Jon Hylands      [hidden email]      http://www.huv.com/jon

  Project: Micro Seeker (Micro Autonomous Underwater Vehicle)
           http://www.huv.com