Archive for April, 2009

Homecamp 09

April 29th, 2009

Homecamp 09 was last weekend and I feel it was an amazing success. Like many people I attended with the intention of sitting in the background watching and learning, however I was prepared to present if need be. By  prepared I meen gluegunned some ducks to a load of fairy lights and packed an arduino.

I didn’t take any notes during the days as I was streaming the event into OpenSim from my laptop with my isite camera. I dont recommend this for future events. Nor was this intended before the day. Below are few of the talks that I took away with me.

  • Martin Dix (@martindix) from currentcost spoke and suprised us all with his free gift  (More about this in a future post) and some statistics about how many current costs had been produced.
  • The Aimee API
  • Electricity 2.0 by Tom Raftery link for a previous video of this talk

There were lots of other areas discussed over the course of the day making it very interesting. I attempted to present some of the work I had done in OpenSim as well as my twittering flat.

I drove the two guys from theAttick who agreed to do the filming and sound for the day, great guys, slightly insane but great. I hope to get some of their videos on here soon.

Sorry for the lack of information, in this post next time I will make sure I can take some notes :)

Power Duck to the financial rescue

April 27th, 2009

Like many people know I am bothered about the electricity consumption of my flat.

For a while now people have been talking about ambient orbs to help monitor their power usage. There are one or two very good guides for producing these on the interent. I decided to go from scratch with an Arduino. Yesterday I finally bought an RGB Full Colour LED for £2.99 from Maplin. I am fairly sure it would have been cheaper at RS but they were closed. This was to be paired with my arduino I have had since Xmas.

This evening I prototyped some code on my Arduino(See at the end) and wired up the Red and Green pins. Blue wasnt required for my intended range. Pin 9  is green and pin 10 is red.

I have linked this into my own RSMB and it reads the live feed from my currentcost device. The number is then echoed down the serial connection with the colour of the light being determin with the following formula.

Red:           Current Power Usage /1500 * 255

Green:      255- (Current Power Usage/1500*255)

Though this doesnt change in nice clear cut stages I liked the idea of a constant natural progression.

I still am fine tunning this so watch this space.

Code for the arduino

float value = 400; //initial value
float maxBoundary = 1500; //Value at which PURE red is shown
char incomingByte;
int count = 0;
char genValue[5] = “”;
void setup() {
Serial.begin(9600);           // set up Serial library at 9600 bps
Serial.println(”Starting Orb”);
analogWrite(11, 0); //Blue is always 0
}
void loop() {
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
//  if ((incomingByte >=0)&&(incomingByte <10)) {
genValue[count] = incomingByte;
count++;
if (count == 5){
count =0;
Serial.println(genValue);
value = atof(genValue)-100; //take off a 100 because realistically at the moment it wont go below 350
if (value<0) value=0;
}
}
}
float displayValue = value/maxBoundary;
float displayValue255 = displayValue*255;
if (displayValue255 > 254 ) displayValue255 = 255;
analogWrite(10, displayValue255); //red //This is a Analgoue output from a digital pin on the arduino
analogWrite(9,255-displayValue255); //green
delay(500);
}

Mobile Ducks have migrated for the summer

April 27th, 2009

A few people asked me about my Ducks not being on the server (well 1) .

I have been asked to remove the randomly moving around ducks from the our SIM on ReactionGrid. I was “Cooking the server” and as the server was donated to us I felt obliged not to take advantage.

Thanks once again for the people at ReactionGrid for providing us with a server to use for HomeCamp, lets see if we can improve its use for the next HomeCamp.

HomeCamp blog post to follow and a twitter search library post to follow when I get a few minute

Friendly Ghost Ducks

April 18th, 2009

I was aiming to produce an autonomous  dynamic enviroment developer tool for open sim.  As I had no idea what this would include I decided to start small and took the duck model supplied by Chris H and added a little script.

The first iteration  randomly chooses a direction (North, South, East or West)  and moves one meter. This repeated every second. I had to introduce a 270m boundary otherwise the ducks had a habit of trying to change sims.

float x = 82;
float y = 237.682;
float z = 22.5;
float period = 1;
float noMove = 10;
float touchCount =0;
default
{
timer()
{
list dice = [0,1,2,3,4];
integer rand = llList2Integer(llListRandomize(dice, 1),0);
vector xyz_angles = <0,0,0>;
integer i=0;
for( i=0;i<noMove;i++) {
if (rand == 0)
{
x=x+period/noMove;
if (x < 92)
{
xyz_angles = <0,0,180>;
}
else {
x=x-period/noMove;
x=x-period/noMove;
xyz_angles = <0,0,0>;
}
}
else if (rand ==1) {
x=x-period/noMove;
if (x > 71)
{
xyz_angles = <0,0,0>;
}
else {
x=x+period/noMove;
x=x+period/noMove;
xyz_angles = <0,0,180>;
}
}
else if (rand == 2) {
y=y-period/noMove;
if (y > 226)
{
xyz_angles = <0,0,90>;
}
else {
y=y+period/noMove;
y=y+period/noMove;
xyz_angles = <0,0,270>;
}
}
else if (rand==3) {
xyz_angles = <0,0,270>;
y=y+period/noMove;
if (y < 247)
{
xyz_angles = <0,0,270>;
}
else {
y=y-period/noMove;
y=y-period/noMove;
xyz_angles = <0,0,90>;
}
}
//llSay(0,(string)x+” “+(string)y+” “+(string)z);
vector angles_in_radians = xyz_angles*DEG_TO_RAD;
rotation rot_xyzq = llEuler2Rot(angles_in_radians);
llSetRot(rot_xyzq);
llSleep(period/noMove);
llSetPos(<x,y,z>);
}
}
state_entry()
{
llSetTimerEvent(period+0.5);
llSetText(” “,<1, 0, 0>,1);
}
touch_start(integer total_number)
{

string soughtName = llDetectedName(0);;
touchCount = touchCount + 1;
}
}

The second (and current) iteration of Duck allows them to be more interactive. If you talk while near the duck, it becomes scared of you (-1 modifier) however if you touch it it likes you (+1 modifier). The distance and direction it moves is connected to the accumulated modifier. If the modifier is positive it moves towards  you, if it is negative it moves away from you.

float x = 82;
float y = 237.682;
float z = 22.5;
float period = 4;
float noMove = 10;
float touchCount =0;
vector location;
string name;
list likesName = [];
list likesOpinions = [];
integer listen_handle ;
default
{
sensor( integer vIntFound )
{
if (vIntFound < 1   )
{
name = “”;
}
integer vIntCounter = 0;
location = llDetectedPos( vIntCounter ) ;
name = llDetectedName(vIntCounter);
}
timer()
{
vector oldLocation = location;
list dice = [0,1,2,3,4];
float oldPeriod = period;
llSensor( “”, “”, AGENT, 5, PI );
if (name != “”){
integer indx = llListFindList(likesName,name);
if (indx == -1) {
indx = 1;
}
integer like = llList2Integer(likesOpinions,indx);
if (like > 10 ) {
like = 10;
}
period = 15;
y = y-(y-location.y)/noMove*like;
x = x-(x-location.x)/noMove*like;
llSetPos(<x,y,z>);
//llOwnerSay(”Walking towards “+name+” “+(string)x+” “+(string)y+” “+(string)z);
name = “”;
}
else {
period = oldPeriod;
integer rand = llList2Integer(llListRandomize(dice, 1),0);
vector xyz_angles = <0,0,0>;
integer i=0;
for( i=0;i<noMove;i++) {
if (rand == 0)
{
x=x+period/noMove;
if (x < 92)
{
xyz_angles = <0,0,180>;
}
else {
x=x-period/noMove;
x=x-period/noMove;
xyz_angles = <0,0,0>;
}
}
else if (rand ==1) {
x=x-period/noMove;
if (x > 71)
{
xyz_angles = <0,0,0>;
}
else {
x=x+period/noMove;
x=x+period/noMove;
xyz_angles = <0,0,180>;
}
}
else if (rand == 2) {
y=y-period/noMove;
if (y > 226)
{
xyz_angles = <0,0,90>;
}
else {
y=y+period/noMove;
y=y+period/noMove;
xyz_angles = <0,0,270>;
}
}
else if (rand==3) {
xyz_angles = <0,0,270>;
y=y+period/noMove;
if (y < 247)
{
xyz_angles = <0,0,270>;
}
else {
y=y-period/noMove;
y=y-period/noMove;
xyz_angles = <0,0,90>;
}
}
//llSay(0,(string)x+” “+(string)y+” “+(string)z);
vector angles_in_radians = xyz_angles*DEG_TO_RAD;
rotation rot_xyzq = llEuler2Rot(angles_in_radians);
llSetRot(rot_xyzq);
llSleep(period/noMove);
llSetPos(<x,y,z>);
}
}
}
state_entry()
{
llSetPos(<x,y,z>);
llSetTimerEvent(period+0.5);
llSetText(” “,<1, 0, 0>,1);
listen_handle = llListen(0, “”, llGetOwner(), “”);
}
touch_start(integer total_number)
{
string soughtName = llDetectedName(0);
integer indx = llListFindList(likesName,soughtName);
if (indx == -1 ) {
likesName = llListInsertList(likesName, [soughtName], llGetListLength(likesName));
indx = llListFindList(likesName,soughtName);
}
integer mod = llList2Integer(likesOpinions,indx) + 1;
if (mod ==0) {
mod =1;
}
likesOpinions = llListReplaceList(likesOpinions,[mod],indx,indx);
llOwnerSay(soughtName +” likeness is set to “+mod);
touchCount = touchCount + 1;
}
listen( integer channel, string name, key id, string message )
{
string soughtName = name;
llSay(0,soughtName + ” just spoke and scared me”);
integer indx = llListFindList(likesName,soughtName);
if (indx == -1 ) {
likesName = llListInsertList(likesName, [soughtName], llGetListLength(likesName));
indx = llListFindList(likesName,soughtName);
}
integer mod = llList2Integer(likesOpinions,indx) – 1;
if (mod ==0) {
mod = -1;
}
likesOpinions = llListReplaceList(likesOpinions,[mod],indx,indx);
llOwnerSay(soughtName +” likeness is set to “+mod);
}
}

Not sure what will be done next, feedback is welcome

Energy Turbines

April 9th, 2009

James (@JTOnline) a work colleague mentioned that he had a wind turbine model in second life and he wanted to link it to the actual windspeed .

I sat back and thought that is not augmented reality enough for me.  With permission i took a copy of  his turbines and made a few modifications.

A few months ago back in December I decided to waste a few hours publishing the buying and selling price of electricity from the national grid. This is not the price the UK households pay but the price the companies buy and sell it for wholesale. This data is published to pachube for anyone to see here depending when my home server is working.

Taking this information and turning it to a rotary motion in second life was amazingly simple.

After a few days I decided to add a method that made the windmill go on fire if the price of electricity breaks a certain threshold. This was half an excuse to use particles and half an excuse to allow for a graphic representation of the electricity price spiking.

Images and code to follow

BarCamp Bournemouth 2009

April 5th, 2009

This is my first BarCamp. I didn’t know what to expect and I arrived fairly late because of other commitments.

Attended talks on PowerShell being better then Bash, RedHat, Front end Testing and the new ways socal marketeers are working.

Its still unclear how I ended up in the RedHat sales pitch.

image_002