.NET & ACE : the best way to get the encoder value

Tips and tricks for Adept ACE

.NET & ACE : the best way to get the encoder value

Postby JOSSENT » Tue Jan 26, 2016 8:58 am

Hello everyone,

I'm writing a .NET application which is connected to ACE. Currently, I've got an issue with my encoder value.
I need to ask the quickest way to Ace, so I'm looking for the best way to get the encoder value.
Below is my actual code in my .NET program.

Code: Select all

public class ACE
   {

        private IAceClient _AceClient;
        private IAceServer _AceServer;
        private const int _CallbackPort = 43431;
        private const int _RemotingPort = 43434;
        private IAdeptController _Controleur;
        private IAdeptRobot _Robot;

        private void AceInit()
        {
            RemotingUtil.InitializeRemotingSubsystem(true, _CallbackPort);
            _AceServer = (IAceServer)RemotingUtil.GetRemoteServerObject(typeof(IAceServer), "ace", "localhost", _RemotingPort);

            // Parcours la liste des controleurs et ne garde que le dernier
            foreach (IAdeptController c in _AceServer.Root.Filter(new ObjectTypeFilter(typeof(IAdeptController)), true))
            {
                _Controleur = c;
            }

            // Parcours la liste des robots et ne garde que le dernier
            foreach (IAdeptRobot r in _AceServer.Root.Filter(new ObjectTypeFilter(typeof(IAdeptRobot)), true))
            {
                _Robot = r;
            }
            _AceClient = new AceClient(_AceServer);
        }

        private int __Codeur_Valeur()
        {
            return _Controleur.GetEncoderPosition(0);
        }
}

When I use this code __Codeur_Valeur return me a value with a random delay between x and x+96 ms.
The average of the delay is x+46ms (these values are from a test with 1000 values).

I hope someone can tell me if ther is a better way or not !

Thank you

Jérôme J.
JOSSENT
 
Posts: 1
Joined: Mon Mar 23, 2015 8:51 am

Return to Adept ACE

Who is online

Users browsing this forum: No registered users and 2 guests