plcopen 0.22.0
载入中...
搜索中...
未找到
kinematics.h
浏览该文件的文档.
1#pragma once
2
3// B2 kinematics plugin contract v1 (approved matrix:
4// doc/compliance/kinematics-plugin-semantics.md). Header-file ABI: users
5// link their mechanism at compile time; a cross-DSO stable ABI is Phase C
6// scope. Implementations must honor the RT-safe contract — no heap
7// allocation, no exceptions, no blocking, numeric iteration bounded (<= 3
8// Newton steps with a warm seed), out-of-budget reports `infeasible`
9// instead of waiting for convergence. The verification harness
10// (core/kin/verify.h) asserts the contract; conformance is not on trust.
11//
12// v1 constraints (decision #9, tightened for the first slice): the joint
13// count equals the Cartesian coordinate count (2 or 3) and equals the group
14// axis count; the 6R batch lifts this together with orientation support.
15
16#include <cstddef>
17
18#include "geom/geometry.h"
19#include "rt/error.h"
20
21namespace plcopen::core::kin
22{
23
25{
26public:
27 virtual ~Kinematics() = default;
28
29 virtual std::size_t joint_count() const = 0;
30 // 2 or 3 translational Cartesian coordinates (orientation is v2 scope).
31 virtual std::size_t cartesian_count() const = 0;
32
33 virtual rt::ErrorCode forward(const double *joints,
34 std::size_t joint_count,
35 geom::Vec3 &cartesian) const = 0;
36
37 // Seed-branch semantics (decision #4): the returned solution stays on
38 // the seed's configuration branch; when no same-branch solution exists
39 // the call reports `infeasible` — an implicit branch flip is a machine
40 // hazard, never a convenience.
41 virtual rt::ErrorCode inverse(geom::Vec3 cartesian,
42 const double *seed_joints,
43 std::size_t joint_count,
44 double *joints_out) const = 0;
45
46 // Distance measure to the nearest singular configuration (decision #3):
47 // strictly positive away from singularities, approaching zero at them.
48 // Mechanisms without singularities return a large constant.
49 virtual double singularity_margin(const double *joints,
50 std::size_t joint_count) const = 0;
51};
52
53} // namespace plcopen::core::kin
virtual rt::ErrorCode inverse(geom::Vec3 cartesian, const double *seed_joints, std::size_t joint_count, double *joints_out) const =0
virtual std::size_t cartesian_count() const =0
virtual double singularity_margin(const double *joints, std::size_t joint_count) const =0
virtual ~Kinematics()=default
virtual std::size_t joint_count() const =0
virtual rt::ErrorCode forward(const double *joints, std::size_t joint_count, geom::Vec3 &cartesian) const =0