C# Class KMotion_dotNet.KM_CoordMotion

Coordinated Motion class representing the CoordMotion.cpp object from the C++ Dynotion Code Use to directly control multiple axis motion Notably:: Straight Traverse Straight Feed Arc Feed
Inheritance: IDisposable
Exibir arquivo Open project: parhansson/KMotionX Class Usage Examples

Public Methods

Method Description
Abort ( ) : void

Abort causes all motion to abruptly stop usually due to something catastrophic like a communication error Use in an E-Stop condition

ArcFeed ( double feedrate, int plane, double planarXend, double planarYend, double planarXcenter, double planarYcenter, int rotation, double planarZ, double a, double b, double c, int sequence_number, int ID ) : void

Perform arc motion at a specified feed rate

ArcFeedAccel ( double feedrate, double accel, int plane, double planarXend, double planarYend, double planarXcenter, double planarYcenter, int rotation, double planarZ, double a, double b, double c, int sequence_number, int ID ) : void

Perform arc motion at a specified feed rate and Acceleration

CheckMotionHalt ( bool coord ) : int

Cehecks for a motion halt

ClearAbort ( ) : void

Clears any existing Abort conditions

ClearHalt ( ) : void

Clear any exisiting halts

Dispose ( ) : void

Releases object resources

DoKMotionBufCmd ( string command ) : void

Inserts a console script command in the buffer

DoKMotionCmd ( string command, bool flushbufferfirst ) : void

Processes a console script command

DoRateAdjustments ( int i0, int i1, double feedrate ) : void

Update the Trajectory Planner's segment feedrates.

DoSpecialCommand ( int segment ) : void

Perform segment execution

DownloadDoneSegments ( ) : void

Download all computed segments from the Trajectory Planner to the device buffer

DownloadInit ( ) : void

Initializes download

Dwell ( double seconds, int sequence_number ) : void

Pause motion fow given amount of time

ExecutionStop ( ) : void

Stop the execution of current motion in a controlled number

FlushSegments ( ) : void

Flushes the segment buffer

GetAxisDefinitions ( int &x, int &y, int &z, int &a, int &b, int &c ) : void

Get the assignment of KFLOP axis Channels to GCode Axes XYZABC, -1 indicates unused/unassigned axis

GetAxisDestination ( int axis ) : double

Gets the axis destination

GetAxisPosition ( int axis ) : double

Gets the axis position

Halt ( ) : void

Halt cause motion to stop in a controlled manner. A feed hold is commanded so that the motion decellerates along the intended path. After the system completely stops, the exact point in the Coordinated Motion Buffer where the stop actually happened is uploaded and the GCode Interpreter is rewound to that point.

KM_CoordMotion ( KM_Controller controller ) : System

Primary constructor for KM_CoordMotion object

MeasurePointAppendToFile ( string command ) : void

Write position data to file

OutputSegment ( int segment ) : void

Output given segment

ReadAndSyncCurPositions ( double &x, double &y, double &z, double &a, double &b, double &c ) : void

First Syncs the Coor Motion Library to the current axis destinations then sets the passed variables to the CoordMotion's Absolute positions

SetAxisDefinitions ( int x, int y, int z, int a, int b, int c ) : void

Set the assignment of KFLOP axis Channels to GCode Axes XYZABC, -1 indicates unused/unassigned axis

SetTPParams ( ) : void

Force the Trajectory Planner to update it's parameters

StartTraverse ( double x, double y, double z, double a, double b, double c, bool suppresscallback, object usercallback ) : void

Fires an async delegate to move axes at traversal speeds non-interpolated

StraightFeed ( double feedrate, double x, double y, double z, double a, double b, double c, int sequence_number, int ID ) : void

Perform linear motion at a specified feed rate

StraightFeedAccel ( double feedrate, double accel, double x, double y, double z, double a, double b, double c, int sequence_number, int ID ) : void

Perform linear motion at a specified feed rate and Acceleration

StraightTraverse ( double x, double y, double z, double a, double b, double c, bool suppresscallback ) : void

Move axes at traversal speeds non-interpolated

UpdateCurrentPositionsABS ( double &x, double &y, double &z, double &a, double &b, double &c, bool snap ) : void

Sets the passed variables to the CoordMotion's Absolute positions

WaitForMoveXYZABCFinished ( ) : void

Blocks calling thread until all commanded motion is complete

WaitForSegmentsFinished ( bool suppressdisablederror ) : void

Waits for all buffered segments to complete Blocks calling thread until the buffer is complete

Protected Methods

Method Description
OnTraverseCompletes ( IAsyncResult result ) : void

Returns after the Async Traverse is called

Private Methods

Method Description
GetFeedRateOverride ( ) : double

Gets the current Feedrate override

GetFeedRateRapidOverride ( ) : double

Gets the current Feedrate Rapidoverride

GetHardwareFRORange ( ) : double

Gets the Hardware FRO Range for all axes Below this value FRO is handled by hardware (no delay) Above this value FRO is handle by the Trajectory Planner (proper accelerations)

GetIsAbort ( ) : bool

Property accessor to query Abort condition

GetIsHalt ( ) : bool

Property accessor to query Halt condition

GetSpindleRateOverride ( ) : double

Gets the current Spindlerate override

Get_PreviouslyStopped ( ) : PREV_STOP_TYPE

Property getter Accessor for PreviouslyStopped

Get_Simulate ( ) : bool

Property getter Accessor for simulation

KM_dotnet_Interop_CoordMotion_ArcFeed ( IntPtr handle, double DesiredFeedRate_in_per_sec, int plane, double first_end, double second_end, double first_axis, double second_axis, int rotation, double axis_end_point, double a, double b, double c, int sequence_number, int ID ) : int
KM_dotnet_Interop_CoordMotion_ArcFeedAccel ( IntPtr handle, double DesiredFeedRate_in_per_sec, double DesiredAccel, int plane, double first_end, double second_end, double first_axis, double second_axis, int rotation, double axis_end_point, double a, double b, double c, int sequence_number, int ID ) : int
KM_dotnet_Interop_CoordMotion_CheckMotionHalt ( IntPtr handle, bool Coord ) : int
KM_dotnet_Interop_CoordMotion_Clear_Abort ( IntPtr handle ) : void
KM_dotnet_Interop_CoordMotion_Clear_Halt ( IntPtr handle ) : void
KM_dotnet_Interop_CoordMotion_DoKMotionBufCmd ( IntPtr handle, string command ) : int
KM_dotnet_Interop_CoordMotion_DoKMotionCmd ( IntPtr handle, string command, bool FlushBeforeUnbufferedOperation ) : int
KM_dotnet_Interop_CoordMotion_DoRateAdjustments ( IntPtr handle, int i0, int i1, double FeedRate ) : int
KM_dotnet_Interop_CoordMotion_DoSpecialCommand ( IntPtr handle, int iseg ) : int
KM_dotnet_Interop_CoordMotion_DownloadDoneSegments ( IntPtr handle ) : int
KM_dotnet_Interop_CoordMotion_DownloadInit ( IntPtr handle ) : void
KM_dotnet_Interop_CoordMotion_DownloadedSegmentCount ( IntPtr handle ) : int
KM_dotnet_Interop_CoordMotion_Dwell ( IntPtr handle, double seconds, int sequence_number ) : void
KM_dotnet_Interop_CoordMotion_ExecutionStop ( IntPtr handle ) : int
KM_dotnet_Interop_CoordMotion_FlushSegments ( IntPtr handle ) : void
KM_dotnet_Interop_CoordMotion_Free ( IntPtr &handle ) : void
KM_dotnet_Interop_CoordMotion_GetAxisDefinitions ( IntPtr handle, int &x, int &y, int &z, int &a, int &b, int &c ) : int
KM_dotnet_Interop_CoordMotion_Get_Abort ( IntPtr handle ) : bool
KM_dotnet_Interop_CoordMotion_Get_AxisDestination ( IntPtr handle, int axis, double &value ) : int
KM_dotnet_Interop_CoordMotion_Get_AxisPosition ( IntPtr handle, int axis, double &value ) : int
KM_dotnet_Interop_CoordMotion_Get_FeedRateOverride ( IntPtr handle ) : double
KM_dotnet_Interop_CoordMotion_Get_FeedRateRapidOverride ( IntPtr handle ) : double
KM_dotnet_Interop_CoordMotion_Get_Halt ( IntPtr handle ) : bool
KM_dotnet_Interop_CoordMotion_Get_HardwareFRORange ( IntPtr handle ) : double
KM_dotnet_Interop_CoordMotion_Get_PreviouslyStopped ( IntPtr handle ) : PREV_STOP_TYPE
KM_dotnet_Interop_CoordMotion_Get_Simulate ( IntPtr handle ) : bool
KM_dotnet_Interop_CoordMotion_Get_SpindleRateOverride ( IntPtr handle ) : double
KM_dotnet_Interop_CoordMotion_MeasurePointAppendToFile ( IntPtr handle, string command ) : int
KM_dotnet_Interop_CoordMotion_New ( IntPtr controller, IntPtr &handle ) : void
KM_dotnet_Interop_CoordMotion_OutputSegment ( IntPtr handle, int iseg ) : int
KM_dotnet_Interop_CoordMotion_ReadAndSyncCurPositions ( IntPtr handle, double &x, double &y, double &z, double &a, double &b, double &c ) : int
KM_dotnet_Interop_CoordMotion_ReadCurAbsPosition ( IntPtr handle, double &x, double &y, double &z, double &a, double &b, double &c, bool snap ) : int
KM_dotnet_Interop_CoordMotion_RemainingTime ( IntPtr handle ) : double
KM_dotnet_Interop_CoordMotion_SetArcFeedCallback ( IntPtr handle, KM_CoordMotionArcFeedSixAxisHandler handler ) : void
KM_dotnet_Interop_CoordMotion_SetAxisDefinitions ( IntPtr handle, int x, int y, int z, int a, int b, int c ) : int
KM_dotnet_Interop_CoordMotion_SetStraightFeedCallback ( IntPtr handle, KM_CoordMotionStraightFeedSixAxisHandler handler ) : void
KM_dotnet_Interop_CoordMotion_SetStraightTraverseCallback ( IntPtr handle, KM_CoordMotionStraightTraverseSixAxisHandler handler ) : void
KM_dotnet_Interop_CoordMotion_SetTPParams ( IntPtr handle ) : void
KM_dotnet_Interop_CoordMotion_Set_Abort ( IntPtr handle ) : void
KM_dotnet_Interop_CoordMotion_Set_FeedRateOverride ( IntPtr handle, double value ) : void
KM_dotnet_Interop_CoordMotion_Set_FeedRateRapidOverride ( IntPtr handle, double value ) : void
KM_dotnet_Interop_CoordMotion_Set_Halt ( IntPtr handle ) : void
KM_dotnet_Interop_CoordMotion_Set_HardwareFRORange ( IntPtr handle, double value ) : void
KM_dotnet_Interop_CoordMotion_Set_PreviouslyStopped ( IntPtr handle, PREV_STOP_TYPE value ) : void
KM_dotnet_Interop_CoordMotion_Set_Simulate ( IntPtr handle, bool value ) : void
KM_dotnet_Interop_CoordMotion_Set_SpindleRateOverride ( IntPtr handle, double value ) : void
KM_dotnet_Interop_CoordMotion_StraightFeed ( IntPtr handle, double DesiredFeedRate_in_per_sec, double x, double y, double z, double a, double b, double c, int sequence_number, int ID ) : int
KM_dotnet_Interop_CoordMotion_StraightFeedAccel ( IntPtr handle, double DesiredFeedRate_in_per_sec, double DesiredAccel, double x, double y, double z, double a, double b, double c, int sequence_number, int ID ) : int
KM_dotnet_Interop_CoordMotion_StraightTraverse ( IntPtr handle, double x, double y, double z, double a, double b, double c, bool NoCallback ) : int
KM_dotnet_Interop_CoordMotion_TimeAlreadyExecuted ( IntPtr handle ) : double
KM_dotnet_Interop_CoordMotion_TotalDownloadedTime ( IntPtr handle ) : double
KM_dotnet_Interop_CoordMotion_WaitForMoveXYZABCFinished ( IntPtr handle ) : int
KM_dotnet_Interop_CoordMotion_WaitForSegmentsFinished ( IntPtr handle, bool NoErrorOnDisable ) : int
OnCoordMotionArcFeed ( bool ZeroLenAsFullCircles, double DesiredFeedRate_in_per_sec, int plane, double first_end, double second_end, double first_axis, double second_axis, int rotation, double axis_end_point, double a, double b, double c, double first_start, double second_start, double axis_start_point, int sequence_number, int ID ) : void

Dispatches Arc Feed callback values to CoordMotionArcFeed event subscribers

OnCoordMotionStraightFeed ( double DesiredFeedRate_in_per_sec, double x, double y, double z, double a, double b, double c, int sequence_number, int ID ) : void

Dispatches Straight Feed callback values to CoordMotionStraightFeed event subscribers

OnCoordMotionStraightTraverse ( double x, double y, double z, double a, double b, double c, int sequence_number ) : void

Dispatches Straight Traverse callback values to CoordMotionStraightTraverse event subscribers

SetArcFeedCallback ( ) : void

Sets the internal Arc Feed callback for the CoordMotion.cpp object Separate delegate for this callback prevents the Garbage Collector from releasing the unmanaged function pointer from being destroyed

SetFeedRateOverride ( double value ) : void

Sets the current Feedrate override

SetFeedRateRapidOverride ( double value ) : void

Sets the current Rapid Feedrate override

SetHardwareFRORange ( double value ) : void

Sets the Hardware FRO Range for all axes Below this value FRO is handled by hardware (no delay) Above this value FRO is handle by the Trajectory Planner (proper accelerations)

SetSpindleRateOverride ( double value ) : void

Sets the current Spindlerate override

SetStraightFeedCallback ( ) : void

Sets the internal Straight Feed callback for the CoordMotion.cpp object Separate delegate for this callback prevents the Garbage Collector from releasing the unmanaged function pointer from being destroyed

SetStraightTraverseCallback ( ) : void

Sets the internal Straight Traverse callback for the CoordMotion.cpp object Separate delegate for this callback prevents the Garbage Collector from releasing the unmanaged function pointer from being destroyed

Set_PreviouslyStopped ( PREV_STOP_TYPE value ) : void

Property setter Accessor for PreviouslyStopped

Set_Simulate ( bool value ) : void

Property setter Accessor for simulation

Method Details

Abort() public method

Abort causes all motion to abruptly stop usually due to something catastrophic like a communication error Use in an E-Stop condition
public Abort ( ) : void
return void

ArcFeed() public method

Perform arc motion at a specified feed rate
public ArcFeed ( double feedrate, int plane, double planarXend, double planarYend, double planarXcenter, double planarYcenter, int rotation, double planarZ, double a, double b, double c, int sequence_number, int ID ) : void
feedrate double Desired feed rate
plane int plane to perform arc (determines axis pair to use)
planarXend double X end point of arc
planarYend double Y end point of arc
planarXcenter double X center of rotation of arc
planarYcenter double Y center of rotation of arc
rotation int CW or ACW
planarZ double End point of perpindicular axis(for helical motion)
a double final end position of a axis
b double final end position of a axis
c double final end position of a axis
sequence_number int internal reference
ID int internal reference
return void

ArcFeedAccel() public method

Perform arc motion at a specified feed rate and Acceleration
public ArcFeedAccel ( double feedrate, double accel, int plane, double planarXend, double planarYend, double planarXcenter, double planarYcenter, int rotation, double planarZ, double a, double b, double c, int sequence_number, int ID ) : void
feedrate double Desired feed rate
accel double Desired acceleration rate
plane int plane to perform arc (determines axis pair to use)
planarXend double X end point of arc
planarYend double Y end point of arc
planarXcenter double X center of rotation of arc
planarYcenter double Y center of rotation of arc
rotation int CW or ACW
planarZ double End point of perpindicular axis(for helical motion)
a double final end position of a axis
b double final end position of a axis
c double final end position of a axis
sequence_number int internal reference
ID int internal reference
return void

CheckMotionHalt() public method

Cehecks for a motion halt
public CheckMotionHalt ( bool coord ) : int
coord bool specify axis mapped axes only
return int

ClearAbort() public method

Clears any existing Abort conditions
public ClearAbort ( ) : void
return void

ClearHalt() public method

Clear any exisiting halts
public ClearHalt ( ) : void
return void

Dispose() public method

Releases object resources
public Dispose ( ) : void
return void

DoKMotionBufCmd() public method

Inserts a console script command in the buffer
public DoKMotionBufCmd ( string command ) : void
command string command
return void

DoKMotionCmd() public method

Processes a console script command
public DoKMotionCmd ( string command, bool flushbufferfirst ) : void
command string console script
flushbufferfirst bool Flush current buffered commands before adding a new one
return void

DoRateAdjustments() public method

Update the Trajectory Planner's segment feedrates.
public DoRateAdjustments ( int i0, int i1, double feedrate ) : void
i0 int
i1 int
feedrate double
return void

DoSpecialCommand() public method

Perform segment execution
public DoSpecialCommand ( int segment ) : void
segment int segment index
return void

DownloadDoneSegments() public method

Download all computed segments from the Trajectory Planner to the device buffer
public DownloadDoneSegments ( ) : void
return void

DownloadInit() public method

Initializes download
public DownloadInit ( ) : void
return void

Dwell() public method

Pause motion fow given amount of time
public Dwell ( double seconds, int sequence_number ) : void
seconds double time in seconds
sequence_number int sequence number to be associated with the dwell
return void

ExecutionStop() public method

Stop the execution of current motion in a controlled number
public ExecutionStop ( ) : void
return void

FlushSegments() public method

Flushes the segment buffer
public FlushSegments ( ) : void
return void

GetAxisDefinitions() public method

Get the assignment of KFLOP axis Channels to GCode Axes XYZABC, -1 indicates unused/unassigned axis
public GetAxisDefinitions ( int &x, int &y, int &z, int &a, int &b, int &c ) : void
x int
y int
z int
a int
b int
c int
return void

GetAxisDestination() public method

Gets the axis destination
public GetAxisDestination ( int axis ) : double
axis int Axis map index
return double

GetAxisPosition() public method

Gets the axis position
public GetAxisPosition ( int axis ) : double
axis int Axis map index
return double

Halt() public method

Halt cause motion to stop in a controlled manner. A feed hold is commanded so that the motion decellerates along the intended path. After the system completely stops, the exact point in the Coordinated Motion Buffer where the stop actually happened is uploaded and the GCode Interpreter is rewound to that point.
public Halt ( ) : void
return void

KM_CoordMotion() public method

Primary constructor for KM_CoordMotion object
public KM_CoordMotion ( KM_Controller controller ) : System
controller KM_Controller
return System

MeasurePointAppendToFile() public method

Write position data to file
public MeasurePointAppendToFile ( string command ) : void
command string file name to append to
return void

OnTraverseCompletes() protected method

Returns after the Async Traverse is called
protected OnTraverseCompletes ( IAsyncResult result ) : void
result IAsyncResult User supplied object that gets returned when traverse is complete
return void

OutputSegment() public method

Output given segment
public OutputSegment ( int segment ) : void
segment int segment index to output
return void

ReadAndSyncCurPositions() public method

First Syncs the Coor Motion Library to the current axis destinations then sets the passed variables to the CoordMotion's Absolute positions
public ReadAndSyncCurPositions ( double &x, double &y, double &z, double &a, double &b, double &c ) : void
x double X axis value
y double Y axis value
z double Z axis value
a double A axis value
b double B axis value
c double C axis value
return void

SetAxisDefinitions() public method

Set the assignment of KFLOP axis Channels to GCode Axes XYZABC, -1 indicates unused/unassigned axis
public SetAxisDefinitions ( int x, int y, int z, int a, int b, int c ) : void
x int
y int
z int
a int
b int
c int
return void

SetTPParams() public method

Force the Trajectory Planner to update it's parameters
public SetTPParams ( ) : void
return void

StartTraverse() public method

Fires an async delegate to move axes at traversal speeds non-interpolated
public StartTraverse ( double x, double y, double z, double a, double b, double c, bool suppresscallback, object usercallback ) : void
x double x position
y double y position
z double z position
a double a position
b double b position
c double c position
suppresscallback bool Prevents callback information from being dispatched
usercallback object User supplied object that gets returned when traverse is complete
return void

StraightFeed() public method

Perform linear motion at a specified feed rate
public StraightFeed ( double feedrate, double x, double y, double z, double a, double b, double c, int sequence_number, int ID ) : void
feedrate double Desired feed rate
x double X end point
y double Y end point
z double Z end point
a double A end point
b double B end point
c double C end point
sequence_number int internal reference
ID int internal reference
return void

StraightFeedAccel() public method

Perform linear motion at a specified feed rate and Acceleration
public StraightFeedAccel ( double feedrate, double accel, double x, double y, double z, double a, double b, double c, int sequence_number, int ID ) : void
feedrate double Desired feed rate
accel double Desired acceleration rate
x double X end point
y double Y end point
z double Z end point
a double A end point
b double B end point
c double C end point
sequence_number int internal reference
ID int internal reference
return void

StraightTraverse() public method

Move axes at traversal speeds non-interpolated
public StraightTraverse ( double x, double y, double z, double a, double b, double c, bool suppresscallback ) : void
x double x position
y double y position
z double z position
a double a position
b double b position
c double c position
suppresscallback bool Prevents callback information from being dispatched
return void

UpdateCurrentPositionsABS() public method

Sets the passed variables to the CoordMotion's Absolute positions
public UpdateCurrentPositionsABS ( double &x, double &y, double &z, double &a, double &b, double &c, bool snap ) : void
x double X axis value
y double Y axis value
z double Z axis value
a double A axis value
b double B axis value
c double C axis value
snap bool snap to exact previously commanded postion (if close) to avoid rounding errors
return void

WaitForMoveXYZABCFinished() public method

Blocks calling thread until all commanded motion is complete
public WaitForMoveXYZABCFinished ( ) : void
return void

WaitForSegmentsFinished() public method

Waits for all buffered segments to complete Blocks calling thread until the buffer is complete
public WaitForSegmentsFinished ( bool suppressdisablederror ) : void
suppressdisablederror bool suppress errors cause by commanding a disabled axis
return void