Skip to content

A .net core implementation for using Lyra boards via a CAN interface. For more information regarding Lyra electronic components see http://www.lyraelectronics.com

License

Notifications You must be signed in to change notification settings

Kbiosystems/lyra-core

Repository files navigation

Lyra Core Library

A .NET Core implementation for using Lyra boards via a CAN interface. To contact Lyra regarding electronic components go to their website here.

To use the source code you will need at least Visual Studio 2015 and the latest .Net Core toolsets. You can find a link to the nuget feed for the compiled libraries below.

Build status NuGet

Getting Started

Implement ICanController

The ICanController is critically responsible for listening to the CAN messages being polled across the CAN line and parsing those messages into CanMmessage objects. Those objects are then fired across on the CanMessageRecievedEvent. The CanBoards listen on this event to parse their status. As such it is critically important that this event is fired by the ICanController implementation.

The ICanController interface should be implemented based on the type of CAN controller being used and will look something like the code below.

    public sealed class CanController : ICanController
    {
        // fire in listener methods
        public event CanMessageRecievedEventHandler CanMessageRecieved;

        public void CloseChannel()
        {
            // close the CAN channel
        }

        public void OpenChannel(int baudRate = 250)
        {
            // open the CAN channel
        }

        public void SendMessage(CanMessage message)
        {
            // Send CAN message
        }

    }

Using the CanBoard Classes

When creating the CanBoard class, the object should be passed the ICanController where it will subscribe to the CanMessageRecieved event internally.

SaciaBoard board = new SaciaBoard(2, _controller);

board.SetMovementProperties(1000, 80, 80);
board.SetCurrent(1200, 100);
board.Zero();
board.Enable();

board.Run(4000);

Acknowledgements

  • Thank you to Lyra for providing the boards/documentation and valuable feedback/support
  • A big thank you to Biosero for their field work and feedback.

About

A .net core implementation for using Lyra boards via a CAN interface. For more information regarding Lyra electronic components see http://www.lyraelectronics.com

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published