...
POST No. 20981
Dynamixel Crashes
2007-07-20 00:21:00
Dear Sir,

I am using the pan and tilt robot on Visual Studio. I created a windows application where I have scroll bars for tilt and pan movements. Surprisingly, after some time dynamixel with ID 4 crashes and I cannot access it's motion throught the scrollbar. I have to close my windows application and reset the dynamixel ID to 4 using the "Robot Terminal". Can you give me a solution that will prevent the dynamixel from crashing.

Thanks.

Here is the code for the form:
namespace BioloidChat
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

private void Form2_Load(object sender, EventArgs e)
{
this.comPort.Open();
this.comPort.WriteLine("HEX");
}
private void Form2_FormClosed(object sender, FormClosedEventArgs e)
{
this.comPort.Close();
}

private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)
{
byte id = 4;
short position = System.Math.Abs(Convert.ToInt16(this.vScrollBar1.Value));
short speed = 2047;

MoveServo(id, position, speed);
}
private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)
{
byte id = 3;
short position = System.Math.Abs(Convert.ToInt16(this.hScrollBar1.Value));
short speed = 2047;

MoveServo(id, position, speed);
}

private void MoveServo(byte channel, short position, short speed)
{
//Set current servo
this.comPort.WriteLine("CID " + channel);

//Set servo position
this.comPort.WriteLine(String.Format("Go {0:x3} {1:x3}", position, speed));
}

private void btnReset_Click(object sender, EventArgs e)
{
// Set values
this.hScrollBar1.Value = -512;
this.vScrollBar1.Value = -512;

MoveServo(3, 512, 100);
System.Threading.Thread.Sleep(100);
MoveServo(4, 512, 100);
}

}
}
2007-07-20 00:21:00
Reply
웹에디터 시작 웹 에디터 끝