Skip to content

Commit 10d8fa8

Browse files
committed
kinematics.h: keep the interface, move the module side to kins_module.h
kinematics.h carried three things: the entry points motion, task and the interpreter call on a module, the helpers a module is written with, and the prototypes of particular modules that share their maths between two loadable modules. A consumer that wanted the flag values or the switch entry point read all of it. kinematics.h now declares what a module presents to its callers: the kinematics type, the flags, forward, inverse, home, the tool and work frames, the tool frame inverse, the Jacobian, the switch, the type flags and the tool offset. kins_module.h, exported alongside it, takes the module side: the joint map and identity helpers, the tool frame library, the generic Jacobian, the parameter block and the shared code that runs an ops table. What trtfuncs.c and userkfuncs.c share with the modules that load them is in trtfuncs.h and userkfuncs.h next to them, in tree only. SWITCHKINS_MAX_TYPES is defined in kinematics.h itself, where motion and NML read it, and kins_module.h aliases KINS_MAX_TYPES to it. Nothing declared moves or changes; only which header declares it.
1 parent ad3d6d0 commit 10d8fa8

44 files changed

Lines changed: 562 additions & 505 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs/src/motion/switchkins.adoc‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ int switchkinsRegister(int ktype, KS kset, KF kfwd, KI kinv);
560560
----
561561

562562
'ktype' runs from 0 to SWITCHKINS_MAX_TYPES-1 (defined in
563-
kinematics.h as KINS_MAX_TYPES). Registering a kinstype twice, by
563+
kinematics.h). Registering a kinstype twice, by
564564
either route, is an error, and so is leaving a gap below the highest
565565
kinstype provided. Either mistake fails the module load and says
566566
which kinstype is at fault.
@@ -728,7 +728,7 @@ static int my_inverse(const kins_params *p, kins_scratch *s,
728728
static const kins_ops my_ops = {
729729
.forward = my_forward,
730730
.inverse = my_inverse,
731-
// .work, .tool, .native and .jacobian are optional, see kinematics.h
731+
// .work, .tool, .native and .jacobian are optional, see kins_module.h
732732
};
733733
734734
int switchkinsSetup(kparms* kp,

‎include/kinematics.h‎

Lines changed: 3 additions & 452 deletions
Large diffs are not rendered by default.

‎include/kinematics_user.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* positions from world coordinates without requiring RT kernel calls.
88
*
99
* The kinematics module is loaded into this process and evaluated through
10-
* its parameter block form (see kinematics.h). The block is filled from
10+
* its parameter block form (see kins_module.h). The block is filled from
1111
* input pins belonging to the caller's HAL component, connected to the
1212
* same signals the running RT instance reads, so the maths runs on live
1313
* values; the tool is the caller's where it gives one, and motion's
@@ -23,7 +23,7 @@
2323
#define KINEMATICS_USER_H
2424

2525
#include "emcpos.h" /* EmcPose */
26-
#include "kinematics.h" /* KINEMATICS_TYPE, flags */
26+
#include "kins_module.h" /* KINEMATICS_TYPE, flags */
2727
#include "hal.h" /* hal_type_t, HAL_NAME_LEN */
2828

2929
#ifdef __cplusplus

‎include/kins_module.h‎

Lines changed: 447 additions & 0 deletions
Large diffs are not rendered by default.

‎include/kins_rt.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define __LINUXCNC_KINS_RT_H
1515

1616
#include "hal.h"
17-
#include "kinematics.h"
17+
#include "kins_module.h"
1818

1919
/* one HAL pin handle per table entry, of whichever type the entry has */
2020
typedef union {

‎include/switchkins.h‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44
#ifndef __LINUXCNC_SWITCHKINS_H
55
#define __LINUXCNC_SWITCHKINS_H
66

7-
#include "kinematics.h"
7+
#include "kins_module.h"
88

9-
//SWITCHKINS_MAX_TYPES (max number of types a module may provide)
10-
//is in kinematics.h as KINS_MAX_TYPES: motion and the NML
11-
//status channel need it too
12-
//max number of switchkins types a module may provide:
13-
#define SWITCHKINS_MAX_TYPES KINS_MAX_TYPES
9+
// SWITCHKINS_MAX_TYPES, the most types a module may provide, is in
10+
// kinematics.h: motion and the NML status channel need it too
1411

1512
// KinematicsFORWARD functions
1613
typedef int (*KF)(const double *joint,
@@ -92,7 +89,7 @@ typedef int (*KJ)(const double *joint,
9289
// otherwise the generic differences of its own inverse.
9390
extern int switchkinsRegisterJacobian(int ktype, KJ kjac);
9491

95-
// provide one switchkins-type written as pure functions (see kinematics.h),
92+
// provide one switchkins-type written as pure functions (see kins_module.h),
9693
// before switchkinsInit(). Its pins come from the table in kparms, shared
9794
// by every type of the module, so it has no setup function. A type may be
9895
// provided this way or through switchkinsRegister(), not both.

‎src/emc/kinematics/5axiskins.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#include <emcmotcfg.h>
6060

6161
#include <switchkins.h>
62+
#include "userkfuncs.h"
6263

6364
// the geometry, one pin each; the maths reads it from the block
6465
static const kins_param_desc fiveaxis_params[] = {

‎src/emc/kinematics/corexykins.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <rtapi_app.h>
99
#include <rtapi_string.h>
1010
#include <hal.h>
11-
#include <kinematics.h>
11+
#include <kins_module.h>
1212
#include <kins_rt.h>
1313

1414
static int corexy_forward(const kins_params *p, kins_scratch *s,

‎src/emc/kinematics/genhexkins.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
a converged solution during current session.
105105
106106
The maths is written as pure functions of the parameter block (see
107-
kinematics.h): the pins above are the table below, read into the block
107+
kins_module.h): the pins above are the table below, read into the block
108108
before every call and written from the scratch after it.
109109
110110
----------------------------------------------------------------------------*/
@@ -117,6 +117,7 @@
117117

118118
#include "genhexkins.h"
119119
#include <switchkins.h>
120+
#include "userkfuncs.h"
120121

121122
// the table: thirteen entries per strut, then the iteration controls,
122123
// the offsets and the reports. The macros index it.

‎src/emc/kinematics/genhexkins.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#ifndef GENHEXKINS_H
2121
#define GENHEXKINS_H
2222

23-
#include <kinematics.h>
23+
#include <kins_module.h>
2424
#include <hal.h>
2525

2626
#define GENHEX_MAX_JOINTS 6

0 commit comments

Comments
 (0)