Skip to main content

from_toml

Function from_toml 

Source
pub fn from_toml(path: impl AsRef<Path>) -> Result<CodeGen, Box<dyn Error>>
Expand description

Load a robot configuration from a TOML file and generate code.

Returns a CodeGen builder pre-populated with the functions requested in the TOML config. Call .write_to_out_dir() or .generate() on the result to produce the final source file.

§Example TOML

[robot]
name = "two_link"

[[joints]]
theta = "theta1"
a = 0.3

[[joints]]
theta = "theta2"
a = 0.25

[generate]
functions = ["fk", "jacobian"]   # also: "fk_matrix" (full 4×4 transform)
output = "robot_math.rs"

Numeric DH parameters are converted to exact rationals with Context::from_f64_approx (0.33/10).