AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

Servo tacho count

The forum is to discuss topics related to robotics, like building robot, controlling it, its software and hardware, etc.

Servo tacho count

Postby josub » Fri Apr 30, 2010 9:59 am

I can't find the way to use correctly de tachocount parameter. I use something like this

int numero5;

numero5 = motorStateB.TachoCount;


I previously reset the counter, and without tacholimit, but the result is always 0, Can you help me?

Thanks.
josub
 
Posts: 3
Joined: Fri Apr 30, 2010 9:47 am

Re: Servo tacho count

Postby andrew.kirillov » Fri Apr 30, 2010 10:34 am

Hello,

Hard to say for sure what is wrong. Did you try calling ResetMotorPosition() before starting using servo?
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3436
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: Servo tacho count

Postby josub » Fri Apr 30, 2010 10:52 am

I did, but the problem persist. this is some code:


if (nxt.Connect(sblue))
{

textBox1.BackColor = Color.LightGreen;


motorStateC.Power = trackBar3.Value - 100;
motorStateC.TurnRatio = 50;
motorStateC.Mode = NXTBrick.MotorMode.On;
motorStateC.Regulation = NXTBrick.MotorRegulationMode.Idle;
motorStateC.RunState = NXTBrick.MotorRunState.Running;
motorStateC.TachoLimit = 0;



motorStateB.Power = trackBar5.Value - 100;
motorStateB.TurnRatio = 50;
motorStateB.Mode = NXTBrick.MotorMode.On;
motorStateB.Regulation = NXTBrick.MotorRegulationMode.Idle;
motorStateB.RunState = NXTBrick.MotorRunState.Running;
motorStateB.TachoLimit =0;


motorStateA.Power = trackBar9.Value - 100;
motorStateA.TurnRatio = 50;
motorStateA.Mode = NXTBrick.MotorMode.Regulated;
motorStateA.Regulation = NXTBrick.MotorRegulationMode.Idle;
motorStateA.RunState = NXTBrick.MotorRunState.Running;
motorStateA.TachoLimit = 0;


nxt.ResetMotorPosition(NXTBrick.Motor.B);

{
if (trackBar5.Value == trackBar3.Value)
{
nxt.SetMotorState(NXTBrick.Motor.All, motorStateB);

}

else
{
nxt.SetMotorState(NXTBrick.Motor.C, motorStateC);
nxt.SetMotorState(NXTBrick.Motor.B, motorStateB);
}
josub
 
Posts: 3
Joined: Fri Apr 30, 2010 9:47 am

Re: Servo tacho count

Postby andrew.kirillov » Fri Apr 30, 2010 1:09 pm

But where is the call to GetMotorState(), which read the value you need?
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3436
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: Servo tacho count

Postby josub » Mon May 03, 2010 8:35 am

Upss!! I forget it.


Thanks for help. Now it works nice.
josub
 
Posts: 3
Joined: Fri Apr 30, 2010 9:47 am




Return to Robotics