Problems with SpeedProfile and WaitHandles

HomeForumsMonoBrick EV3 FirmwareProblems with SpeedProfile and WaitHandles

This topic contains 5 replies, has 2 voices, and was last updated by Author Image Anders Søborg 2 years, 2 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #5178
    Author Image
    Dawid Mostert
    Participant

    Hi,

    I’m trying to get a couple of very simple examples to work with my EV3.

    The following routine works, except when I change
    motorWaitHandle = motorA.SpeedProfile(50, 200, 1600, 200,true);

    to
    motorWaitHandle = motorA.SpeedProfile(50, 200, 160, 200,true);

    the WaitOne() call never then never returns.

    public static void Main (string[] args)
    {
      Motor motorA = new Motor (MotorPort.OutA);
      WaitHandle motorWaitHandle;
      motorA.Off();
      LcdConsole.WriteLine("Speed: " + motorA.GetSpeed() );
      motorA.ResetTacho();
      motorWaitHandle =  motorA.SpeedProfile(50, 200, 1600, 200,true);
      motorWaitHandle.WaitOne();
      LcdConsole.WriteLine("Done moving motor");
      LcdConsole.WriteLine("Position A: " + motorA.GetTachoCount());
    
      Thread.Sleep(500);
      motorA.ResetTacho();
      motorWaitHandle =  motorA.SpeedProfile(-50, 200, 160, 200,true);
      motorWaitHandle.WaitOne();
      LcdConsole.WriteLine("Done moving both motors");
      motorA.Off();
    }

    (Taken from MotorSamples)

    Do I need to build delays into my code?

    Thanks,
    Dawid

    #5179
    Author Image
    Anders Søborg
    Key Master

    Hi there

    This problem has already been reported and fixed. However it has not been officially released. But you can download a precompiled DLL of the master branch from my ftp server. An officially will be created once I get the time to do some more testing (which should be some time this coming week).

    /Anders

    #5180
    Author Image
    Dawid Mostert
    Participant

    Thanks Anders!

    Works like a charm.

    Where is the best place to look for reported problems? This forum or GitHub?

    Dawid

    #5181
    Author Image
    Dawid Mostert
    Participant

    Sorry Anders,

    Seems I Spoke too soon :(

    Still not working in all instances…

    This does not work:
    var handle = motor.SpeedProfile(50, 100, 700, 100, true);

    Regards,
    Dawid

    #5182
    Author Image
    Anders Søborg
    Key Master

    Hi there

    I will look into this…. in the meantime simply ignore the waitone on the waithandle like shown below.

    motorWaitHandle =  motorA.SpeedProfile(-50, 100, 700, 100,true);
     //motorWaitHandle.WaitOne();
     System.Threading.Thread.Sleep(1000);
     motorA.Brake();

    /Anders

    #5195
    Author Image
    Anders Søborg
    Key Master

    Hi there

    Just upload a new dll to my ftp server

    Everything should be working now….

    /Anders

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

Posted in

Make a donation