Tesseract 0.28.4
Loading...
Searching...
No Matches
factory_utils.h File Reference

Shared YAML-parsing helpers for kinematics plugin factories. More...

#include <tesseract/common/macros.h>
#include <map>
#include <string>
#include <vector>
#include <Eigen/Core>
#include <yaml-cpp/yaml.h>
#include <tesseract/common/types.h>
#include <tesseract/scene_graph/fwd.h>

Classes

struct  tesseract::kinematics::JointSampleSpec
 One joint's sampling discretisation, as parsed from a "*_sample_resolution" entry. More...
 
struct  tesseract::kinematics::SampleGridConfig
 A sampled chain's per-joint discretisation, ordered to match that chain's joint order. More...
 

Functions

std::map< tesseract::common::JointId, JointSampleSpec > tesseract::kinematics::parseSampleResolutionMap (const YAML::Node &sample_res_node, const tesseract::scene_graph::SceneGraph &scene_graph, const std::string &block_label)
 Parse a "*_sample_resolution" sequence into a joint id -> discretisation map.
 
SampleGridConfig tesseract::kinematics::toSampleGridConfig (const std::map< tesseract::common::JointId, JointSampleSpec > &sample_res_map, const std::vector< tesseract::common::JointId > &joint_ids, const std::string &block_label)
 Reorder a parseSampleResolutionMap() result onto a chain's joint order, producing the range/resolution pair that buildSampleGrid() consumes.
 

Detailed Description

Shared YAML-parsing helpers for kinematics plugin factories.

Author
Roelof Oomen
Date
May 1, 2026
License
Software License Agreement (Apache License)
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ parseSampleResolutionMap()

std::map< tesseract::common::JointId, JointSampleSpec > tesseract::kinematics::parseSampleResolutionMap ( const YAML::Node &  sample_res_node,
const tesseract::scene_graph::SceneGraph &  scene_graph,
const std::string &  block_label 
)

Parse a "*_sample_resolution" sequence into a joint id -> discretisation map.

Each entry decodes as a PositionerSampleResolution, which supplies name and value and leaves min/max optional. This function applies the parts that need the scene graph: joint limits as the [min, max] defaults, and validation that [min, max] lies within the joint's full limits and is non-empty. A CONTINUOUS joint is unbounded: it defaults to [-pi, pi], accepts any ordered explicit range, and needs no limits.

Feed the result to toSampleGridConfig() once the sampled chain's joint order is known.

Parameters
sample_res_nodeThe YAML sequence node, e.g. config.at("tool_sample_resolution").getValue().
scene_graphUsed to look up each joint's limits.
block_labelName of the config block, quoted into error messages (e.g. "tool_sample_resolution"). The reporting factory's identity is supplied by whoever catches, so it is not repeated here.
Exceptions
std::runtime_erroron any of the malformed-input or out-of-range conditions above.

◆ toSampleGridConfig()

SampleGridConfig tesseract::kinematics::toSampleGridConfig ( const std::map< tesseract::common::JointId, JointSampleSpec > &  sample_res_map,
const std::vector< tesseract::common::JointId > &  joint_ids,
const std::string &  block_label 
)

Reorder a parseSampleResolutionMap() result onto a chain's joint order, producing the range/resolution pair that buildSampleGrid() consumes.

Parameters
sample_res_mapOutput of parseSampleResolutionMap().
joint_idsJoint order of the sampled chain, from its forward kinematics.
block_labelName of the config block, quoted into error messages.
Exceptions
std::runtime_errorif the map does not describe exactly joint_ids.