Thursday, November 29, 2007

Building the 'web of things' means breaking some eggs

I've been writing a lot about the 3D web lately, and I'm still pretty jazzed about what I've seen. Part of the appeal is the way that environments like Second Life serve as a metaphor for the merging of the physical and virtual worlds that is taking place all around us.

Anyhow, way back in the day, I was writing here about the next web, or Web3.0, or whatever you want to call it. Back in those old days, about 12 months ago, I was really thinking more about the new web, and the mobile web, like in this dusty old post. Someone had already fronted Mobile2.0 as a variant of Web3.0, in the confusing cloud of infotech talking heads.

Anyhow, one barrier to 'Mobile2.0' is the fact that networks and devices can't be ubiquitous if you can't get your cell phone to run an app or use the network you want, witness the entire iPhone hacking phenomenon. The subtext of the whole Google Android platform seems to be an attempt to smash through the walled gardens that are your typical telecom, witness the mission of the Open Handset Alliance. Anyhow, the actions of Google, and the recent announcement by Verizon that they are going to open their platform to any app and any service hint at the cracks that are appearing in the walled gardens. Does this hint at a new wave of innovation driven by the availability of an open platform? I'd think so, but at any rate, changes in the mobile space are coming, and they'll contribute to the next 'version' of the web!

Monday, November 19, 2007

Virtual SunSPOT controlled by a real SunSPOT

Pardon the zapruder-like quality to this film, but this shows the hack I mentioned in my last post. I'm in SecondLife, controlling a virtual SunSPOT from a real one. In this case, tapping into the 3D accellerometer to pick up the xyz rotation, sending it through my framework to rotate the virtual one. It's a bit laggy, and not 100 percent there, but enough to get the idea.

If I ever find the time, the next cool example would be to implement the ectoplasmic bouncing ball demo using one real and one virtual SPOT. Anyhow, it works. The point really is to learn about the SPOT, and why not do something interesting while testing them...?



Thursday, November 15, 2007

SunSPOTS talk and demo today at Sitterson

Paul Jones sent out this note, and I'll be attending for sure:

About SunSPOTS http://www.sunspotworld.com/

Where: Sitterson 014 When: Thursday November 15th at 3:30
Who: A member from the Sun Labs, David Simmons
http://blogs.sun.com/davidgs
More:

David has hands-on experience in building applications for SunSPOTs and was instrumental in its design and development, will be on hand to offer his insight into this amazing product. http://www.sunspotworld.com/

The SunSPOT (Small Programmable Object Technology) was developed in the Sun Labs and represents the future of embedded systems. Already used throughout academia, students and professors alike are finding new and interesting uses for SunSPOTs. Each SunSPOT comes equipped with a
processor, memory, eight external tri-color LEDs, light sensors, temperature sensors, an accelerometer, and several digital/analog inputs and outputs; offering up seemingly countless practical uses.

At its core, a SunSPOT is an embedded system. But, unlike other embedded systems that must be programmed using a low-level language such as assembly or C, SunSPOT applications are developed in Java. By allowing Java applications to be uploaded and run on an internal Java Virtual Machine, Sun is not only opening up SunSPOTs to more users than many other embedded systems, it is also leaving the final function of each SunSPOT up to the end user. By following a simple API with which to interface the SunSPOT, developers nationwide have created unique uses for SunSPOTs - everything from animal research to rocket testing and much more!


I'm currently working with the SunSPOT developers kit, and have been going through (and hacking on) the demo apps. One of the first things I am trying is to tap into the 3D accellerometer. I took the telemetry example and added tilt to the packets coming off the SunSPOT, and have that available on the host. At the same time I've created a virtual SunSPOT in Second Life, and have scripted that to mirror the pitch, yaw, and roll coming into the LSL script. Just a few more tweaks, and the virtual SunSPOT will be controllable from a real one. This has been done before, but not to Second Life. The lag will probably be pretty bad, but I want to explore how multiple SunSPOTS, used by different people in an immersive environment, can create cool experiences.

Anyway, here's a shot of the virtual SunSPOT, when I get it hooked up, I'll shoot a video. I might have it by this afternoon, if the creek don't rise. Anyhow, see you all at the talk this afternoon!

Tuesday, November 13, 2007

My good deed for today - UdpClient in C# joining a multicast group

Why are simple things so difficult! I spent a couple hours banging my head against the wall on this one. All I wanted to do was push out multicast UDP packets and pick them up from a C# program. The UdpClient is not very well documented, and the examples I found didn't work. So simply, this is what I had to do, marked in red. Now this works!

I hope I saved someone a minor headache.

using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.Threading;

namespace UbiSenseUdpClientTest
{
class UbiSenseUdpListener
{
private static readonly IPAddress GroupAddress =
IPAddress.Parse("224.237.248.237");
private const int GroupPort = 64555;

private static void StartListener()
{
bool done = false;

UdpClient listener = new UdpClient(GroupPort); <- even though the samples show the noargs constructor for UdpClient, you must specify the port you are going to use if you want to receive multicast packets
IPEndPoint groupEP = new IPEndPoint(GroupAddress, GroupPort);

try
{
listener.JoinMulticastGroup(GroupAddress);
//listener.Connect(groupEP); <--- even thought the MSDN examples say to connect, don't connect before you receive, or you will sit and block at the receive below 'waiting for broadcast' below

while (!done)
{
Console.WriteLine("Waiting for broadcast");
byte[] bytes = listener.Receive(ref groupEP);

Console.WriteLine("Received broadcast from {0} :\n {1}\n",
groupEP.ToString(),
Encoding.ASCII.GetString(bytes, 0, bytes.Length));
}

listener.Close();

}
catch (Exception e)
{
Console.WriteLine(e.ToString());
Console.ReadLine();
}

}

static void Main(string[] args)
{
StartListener();
}
}
}