Controlling Multi Axis in Real time

Moderators: TomKerekes, dynomotion

Post Reply
SIXMA
Posts: 6
Joined: Wed Nov 22, 2023 5:27 am

Controlling Multi Axis in Real time

Post by SIXMA » Tue Feb 25, 2025 3:50 am

Hello , Sir

I have built a robot similar to a 5-axis CNC machine, where the kinematics calculations are already done by other software.
I want to use a Konna controller as a device to receive coordinates and move motors along different axes according to those coordinates.

Could you suggest how I should do this? Which classes and methods in Kmotion.net should I use to create software in C# that only receives values and moves according to the received coordinates? Or should I consider other aspects for this part? When receiving values from other software and sending commands to Konna to control motor movement according to those values, are there any important considerations I should be aware of?

Best regards

User avatar
TomKerekes
Posts: 2742
Joined: Mon Dec 04, 2017 1:49 am

Re: Controlling Multi Axis in Real time

Post by TomKerekes » Tue Feb 25, 2025 6:05 pm

Hi SIXMA,

Its not clear what your application is, but assuming you would like to perform coordinated motion paths similar to a CNC machine, you might use our Coordinated Motion Class. See KM_CoordMotion.

Because PC Applications are nor real-time the motion trajectory must be buffered in the controller. Our libraries handle that for you. Basically your App adds trajectory path as Straight Traverse, Straight Feeds, Arc Feeds, or Dwells). After the defined amount of motion is received (ie 1 second of motion), the motion automatically begins execution. Your Application should continue to provide additional trajectory. To prevent too much buffering our libraries will block your calls to add more trajectory to maintain the specified amount of buffering. After all your desired trajectory has been sent you should flush the coordinated motion buffer.

So after the Axes are configured and enabled, Coordinate System Axes defined, Motion Parameters set you would:

Sync Coordinate Motion to the current position
Add Straight Traverses, Straight Feeds, Arc Feeds, or Dwells
Flush

You might see our KMotion_Net Console C# example. See the CoordMotion Example region. Also Pasted below:

Code: Select all

        #region CoordMotion Example
        /// <summary>
        /// Test Arcs, Lines and Traverse
        /// </summary>
        static void RunCoordinatedMotionExample()
        {
            _Controller.CoordMotion.Abort();
            _Controller.CoordMotion.ClearAbort();
            _Controller.WriteLine(String.Format("DefineCS = {0} {1} {2} {3} {4} {5}", 0, 1, 2, -1, -1, -1));
            _Controller.WriteLine(String.Format("EnableAxis{0}", 0));
            _Controller.WriteLine(String.Format("EnableAxis{0}", 1));
            _Controller.WriteLine(String.Format("EnableAxis{0}", 2));
            _Controller.CoordMotion.MotionParams.BreakAngle = 30;
            _Controller.CoordMotion.MotionParams.RadiusA = 5;
            _Controller.CoordMotion.MotionParams.RadiusB = 5;
            _Controller.CoordMotion.MotionParams.RadiusC = 5;
            _Controller.CoordMotion.MotionParams.MaxAccelX = 30000;
            _Controller.CoordMotion.MotionParams.MaxAccelY = 3000;
            _Controller.CoordMotion.MotionParams.MaxAccelZ = 3000;
            _Controller.CoordMotion.MotionParams.MaxAccelA = 30;
            _Controller.CoordMotion.MotionParams.MaxAccelB = 30;
            _Controller.CoordMotion.MotionParams.MaxAccelC = 30;
            _Controller.CoordMotion.MotionParams.MaxVelX = 3000;
            _Controller.CoordMotion.MotionParams.MaxVelY = 30;
            _Controller.CoordMotion.MotionParams.MaxVelA = 30;
            _Controller.CoordMotion.MotionParams.MaxVelB = 30;
            _Controller.CoordMotion.MotionParams.MaxVelC = 30;
            _Controller.CoordMotion.MotionParams.CountsPerInchX = 300;
            _Controller.CoordMotion.MotionParams.CountsPerInchY = 300;
            _Controller.CoordMotion.MotionParams.CountsPerInchZ = 300;
            _Controller.CoordMotion.MotionParams.CountsPerInchA = 30;
            _Controller.CoordMotion.MotionParams.CountsPerInchB = 30;
            _Controller.CoordMotion.MotionParams.CountsPerInchC = 30;
            _Controller.CoordMotion.MotionParams.DegreesA = false;
            _Controller.CoordMotion.MotionParams.DegreesB = false;
            _Controller.CoordMotion.MotionParams.DegreesC = false;
            double speed = 15;

            // Sync Coordinated Motion Library with Current Position of Machine
            double x=0, y=0, z=0, a=0, b=0, c=0;
            _Controller.CoordMotion.ReadAndSyncCurPositions(ref x, ref y, ref z, ref a, ref b, ref c);


            _Controller.CoordMotion.StraightTraverse(6.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, false);
            int isCCW = 1;
            _Controller.CoordMotion.StraightFeed(speed, 5.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0, 0);

            _Controller.CoordMotion.ArcFeed(speed, 1, 0.0000, 5.000, 5.0000, 0.2500, isCCW, 0.0000, 0.0000, 0.0000, 0.0000, 0, 0);
            _Controller.CoordMotion.ArcFeed(speed, 1, 0.0000, 0.0000, 0.0000, 0.2500, isCCW, 0.0000, 0.0000, 0.0000, 0.0000, 0, 0);

            _Controller.CoordMotion.Dwell(2,0);
            _Controller.CoordMotion.FlushSegments();

//            _Controller.Feedhold();  //test feedhold
//            Thread.Sleep(2000);
//            _Controller.ResumeFeedhold();
//            _Controller.ClearFeedhold();
        }


You might also see the Dynomotion VB.net Example which allows you to perform these steps through a GUI

Dynomotion VB.png

HTH
Regards,

Tom Kerekes
Dynomotion, Inc.

Post Reply