Wednesday, 23 March 2011

Our beautiful robot

So today we built our first Buridan's Robot prototype, now it responds to light, next we will give it conflicting desires. Below very simple Urbi code to make it communicate when light is a certain brightness:






















load("/home/student/creativerobotics/urbi-for-bioloid/dynamixel.u");

 var Global.d = Dynamixel.new;

class Thing
{

function init()
{
/* var this.shoulder =
Dynamixel.Device.new(d,1,Dynamixel.DeviceDesc.AX12);
var this.elbow =
Dynamixel.Device.new(d,2,Dynamixel.DeviceDesc.AX12);
var this.wrist =
Dynamixel.Device.new(d,3,Dynamixel.DeviceDesc.AX12);
var this.hand =
Dynamixel.Device.new(d,4,Dynamixel.DeviceDesc.AX12);
*/

var this.sensorH = Dynamixel.Device.new(d,100,
Dynamixel.DeviceDesc.AXS1);
var this.sensorRead = 0;



};

function start_feedback(){
detach
({
every(0.1s)
{
this.sensorRead = this.sensorH.lightLeft;
}
});

};


function startReact(){
whenever(sensorRead10)
{

echo("lighjt");}
};



};
var thing2 = Thing.new;
thing2.start_feedback;

thing2.startReact;


No comments:

Post a Comment