From 1aecd2b11237ada3c61f673767fab4c746683714 Mon Sep 17 00:00:00 2001 From: Clayton Ramsey Date: Wed, 4 Feb 2026 15:37:53 -0600 Subject: [PATCH 01/11] refactor: separate cmake and build steps in Dockerfile --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index b97a470..0e7f116 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,5 +7,6 @@ RUN micromamba install -y -n base -f /tmp/env.yaml && \ ARG MAMBA_DOCKERFILE_ACTIVATE=1 COPY . cricket/ -RUN cmake -GNinja -Bbuild -DCPM_SOURCE_CACHE=.cpm_cache cricket && cmake --build build +RUN cmake -GNinja -Bbuild -DCPM_SOURCE_CACHE=.cpm_cache cricket +RUN cmake --build build ENTRYPOINT ["/usr/local/bin/_entrypoint.sh", "/tmp/build/fkcc_gen"] From db58eb0f2a4d17e9fb859e7038e070c8e7cf3bfb Mon Sep 17 00:00:00 2001 From: Clayton Ramsey Date: Wed, 4 Feb 2026 16:03:37 -0600 Subject: [PATCH 02/11] feat: support Rust code generation in cricket --- resources/templates/fk_template.rs | 25 +++++++++++++++++++++++++ src/fkcc_gen.cc | 10 ++++++++++ 2 files changed, 35 insertions(+) diff --git a/resources/templates/fk_template.rs b/resources/templates/fk_template.rs index 1b277f4..06891cb 100644 --- a/resources/templates/fk_template.rs +++ b/resources/templates/fk_template.rs @@ -1,3 +1,4 @@ +<<<<<<< HEAD #![expect( clippy::too_many_lines, clippy::cognitive_complexity, @@ -36,6 +37,30 @@ pub const MAX_RADIUS: f32 = {{max_radius}}; clippy::suspicious_operation_groupings )] pub fn fkcc(x: &super::ConfigurationBlock, environment: &World3d) -> bool { +======= +use core::simd::Simd; + +use elain::{Align, Alignment}; + +use crate::{ + env::World3d, + robot::{sphere_environment_in_collision, sphere_sphere_self_collision}, + cos, sin, +}; + +#[expect( + non_snake_case, + clippy::too_many_lines, + clippy::cognitive_complexity, + clippy::unreadable_literal, + clippy::approx_constant, + clippy::collapsible_if +)] +pub fn fkcc(x: &super::ConfigurationBlock, environment: &World3d) -> bool +where + Align: Alignment, +{ +>>>>>>> 3576dba (feat: support Rust code generation in cricket) let mut v = [Simd::splat(0.0); {{ccfk_code_vars}}]; let mut y = [Simd::splat(0.0); {{ccfk_code_output}}]; diff --git a/src/fkcc_gen.cc b/src/fkcc_gen.cc index c17055e..dcfade9 100644 --- a/src/fkcc_gen.cc +++ b/src/fkcc_gen.cc @@ -538,10 +538,13 @@ auto trace_sphere_cc_fk( LanguageRust langRust("double"); handler.generateCode(function_code, langRust, result, nameGen); } +<<<<<<< HEAD else { throw std::runtime_error(fmt::format("unsupported language {}", language)); } +======= +>>>>>>> 3576dba (feat: support Rust code generation in cricket) return Traced{function_code.str(), handler.getTemporaryVariableCount(), n_out}; } @@ -617,6 +620,13 @@ int main(int argc, char **argv) { language = data["language"]; } +<<<<<<< HEAD +======= + if (not(language == "rust" or language == "c++")) + { + throw std::runtime_error(fmt::format("unsupported language {}", language)); + } +>>>>>>> 3576dba (feat: support Rust code generation in cricket) RobotInfo robot(parent_path / data["urdf"], srdf_path, end_effector_name); From 2980fc27c4b2ebcd6d11c001b50882d2138915ba Mon Sep 17 00:00:00 2001 From: Clayton Ramsey Date: Tue, 10 Feb 2026 11:02:53 -0600 Subject: [PATCH 03/11] feat: running Rust FK/CC code for existing carom robots --- resources/panda_rust.json | 13 + resources/pr2_rust.json | 13 + resources/templates/fk_template.rs | 173 +++-- resources/ur5/ur5_spherized_no_offset.urdf | 758 +++++++++++++++++++++ resources/ur5_rust.json | 13 + 5 files changed, 931 insertions(+), 39 deletions(-) create mode 100644 resources/panda_rust.json create mode 100644 resources/pr2_rust.json create mode 100644 resources/ur5/ur5_spherized_no_offset.urdf create mode 100644 resources/ur5_rust.json diff --git a/resources/panda_rust.json b/resources/panda_rust.json new file mode 100644 index 0000000..4ffc44c --- /dev/null +++ b/resources/panda_rust.json @@ -0,0 +1,13 @@ +{ + "name": "Panda", + "urdf": "panda/panda_spherized.urdf", + "srdf": "panda/panda.srdf", + "end_effector": "panda_grasptarget", + "resolution": 32, + "template": "templates/fk_template.rs", + "subtemplates": [ + { "name": "ccfk", "template": "templates/ccfk_template.rs" } + ], + "output": "panda_fk.rs", + "language": "rust" +} diff --git a/resources/pr2_rust.json b/resources/pr2_rust.json new file mode 100644 index 0000000..c8551a4 --- /dev/null +++ b/resources/pr2_rust.json @@ -0,0 +1,13 @@ +{ + "name": "Pr2", + "urdf": "pr2/pr2_spherized.urdf", + "srdf": "pr2/pr2_simple.srdf", + "end_effector": "r_gripper_palm_link", + "resolution": 32, + "template": "templates/fk_template.rs", + "subtemplates": [ + { "name": "ccfk", "template": "templates/ccfk_template.rs" } + ], + "output": "pr2_fk.rs", + "language": "rust" +} diff --git a/resources/templates/fk_template.rs b/resources/templates/fk_template.rs index 06891cb..ee9376f 100644 --- a/resources/templates/fk_template.rs +++ b/resources/templates/fk_template.rs @@ -1,66 +1,102 @@ -<<<<<<< HEAD #![expect( clippy::too_many_lines, clippy::cognitive_complexity, clippy::unreadable_literal, clippy::collapsible_if, clippy::excessive_precision, - clippy::suspicious_operation_groupings )] +#![feature(portable_simd)] use core::simd::Simd; use carom_core::{ - cos, env::World3d, sin, sphere_environment_in_collision, sphere_sphere_self_collision, + Attach, Block, Collide3, PosedAttachment, Robot, SimdArithmetic, cos, sin, + sphere_environment_in_collision, sphere_sphere_self_collision, }; -pub const DIM: usize = {{n_q}}; +#[derive(Clone, Copy, Debug)] +pub struct {{name}}; -pub const JOINT_NAMES: [&str; DIM] = ["{{join(joint_names, "\", \"")}}"]; -pub const END_EFFECTOR_NAME: &str = "{{end_effector}}"; +const DIM: usize = {{n_q}}; -pub const BOUND_LOWER: [f32; DIM] = [{{join(bound_lower, ", ")}}]; +impl {{name}} { + /// The configuration-space dimension of this robot. + pub const DIM: usize = DIM; -pub const BOUND_SCALE: [f32; DIM] = [{{join(bound_range, ", ")}}]; + pub const BOUNDS: [[f32; DIM]; 2] = [ + Self::BOUND_LOWER, + make_upper(Self::BOUND_LOWER, Self::BOUND_SCALE), + ]; -pub const RESOLUTION: usize = {{resolution}}; + pub const STEP_SIZE: f32 = 1.0 / {{resolution}}f32; -pub const MIN_RADIUS: f32 = {{min_radius}}; -pub const MAX_RADIUS: f32 = {{max_radius}}; + pub const JOINT_NAMES: [&str; DIM] = ["{{join(joint_names, "\", \"")}}"]; + pub const END_EFFECTOR_NAME: &str = "{{end_effector}}"; -#[expect( - clippy::too_many_lines, - clippy::cognitive_complexity, - clippy::unreadable_literal, - clippy::collapsible_if, - clippy::excessive_precision, - clippy::suspicious_operation_groupings -)] -pub fn fkcc(x: &super::ConfigurationBlock, environment: &World3d) -> bool { -======= -use core::simd::Simd; + pub const BOUND_LOWER: [f32; DIM] = [{{join(bound_lower, ", ")}}]; -use elain::{Align, Alignment}; + pub const BOUND_SCALE: [f32; DIM] = [{{join(bound_range, ", ")}}]; -use crate::{ - env::World3d, - robot::{sphere_environment_in_collision, sphere_sphere_self_collision}, - cos, sin, -}; + pub const RESOLUTION: usize = {{resolution}}; -#[expect( - non_snake_case, - clippy::too_many_lines, - clippy::cognitive_complexity, - clippy::unreadable_literal, - clippy::approx_constant, - clippy::collapsible_if -)] -pub fn fkcc(x: &super::ConfigurationBlock, environment: &World3d) -> bool + pub const MIN_RADIUS: f32 = {{min_radius}}; + pub const MAX_RADIUS: f32 = {{max_radius}}; +} + +const fn make_upper(lower: [f32; DIM], scale: [f32; DIM]) -> [f32; DIM] { + let mut ret = [0.0; DIM]; + let mut i = 0; + while i < DIM { + ret[i] = lower[i] + scale[i]; + i += 1; + } + ret +} + +type ConfigurationBlock = [Simd; {{name}}::DIM]; + +impl Robot for {{name}} where - Align: Alignment, + W: Collide3, { ->>>>>>> 3576dba (feat: support Rust code generation in cricket) + fn is_valid(&self, cfgs: &Block<{ Self::DIM }, L, f32>, world: &W) -> bool + where + Simd: SimdArithmetic, + { + fkcc(&cfgs.0, world) + } + + fn bounds(&self) -> [[f32; DIM]; 2] { + Self::BOUNDS + } + + fn name(&self) -> &'static str { + "{{lower(name)}}" + } +} + + +impl Attach for {{name}} +where + W: Collide3, +{ + fn is_valid_attach( + &self, + cfgs: &Block, + world: &W, + attachment: &mut PosedAttachment, + ) -> bool + where + Simd: crate::SimdArithmetic, + { + attach_fkcc(&cfgs.0, world, attachment) + } +} + + +fn fkcc(x: &ConfigurationBlock, environment: &impl Collide3) -> bool { +>>>>>>> Stashed changes +>>>>>>> 996ae5d (feat: running Rust FK/CC code for existing carom robots) let mut v = [Simd::splat(0.0); {{ccfk_code_vars}}]; let mut y = [Simd::splat(0.0); {{ccfk_code_output}}]; @@ -68,3 +104,62 @@ where {% include "ccfk" %} true } + + +fn attach_fkcc( + x: &ConfigurationBlock, + environment: &impl Collide3, + attachment: &mut PosedAttachment, +) -> bool { + let mut v = [Simd::splat(0.0); {{ccfkee_code_vars}}]; + let mut y = [Simd::splat(0.0); {{ccfkee_code_output}}]; + + {{ccfkee_code}} + {% include "ccfk" %} + + // attaching at {{ end_effector }} + attachment.set_pose_pr( + y[{{ccfkee_code_output - 12}}..{{ccfkee_code_output - 9}}].as_array().unwrap(), + y[{{ccfkee_code_output - 9}}..{{ccfkee_code_output}}].as_array().unwrap() + ); + + // + // attachment vs. environment collisions + // + if attachment.environment_collision(environment) + { + return false; + } + + // + // attachment vs. robot collisions + // + + {% for i in range(length(end_effector_collisions)) %} + {% set link_index = at(end_effector_collisions, i) %} + {% set link_bs = at(bounding_sphere_index, link_index) %} + {% set link_spheres = at(per_link_spheres, link_index) %} + + // Attachment vs. {{ at(link_names, link_index )}} + if attachment.sphere_collision( + y[{{(n_spheres + link_bs) * 4 + 0}}], + y[{{(n_spheres + link_bs) * 4 + 1}}], + y[{{(n_spheres + link_bs) * 4 + 2}}], + y[{{(n_spheres + link_bs) * 4 + 3}}] + ) { + {% for j in range(length(link_spheres)) %} + {% set sphere_index = at(link_spheres, j) %} + if attachment.sphere_collision( + y[{{sphere_index * 4 + 0}}], + y[{{sphere_index * 4 + 1}}], + y[{{sphere_index * 4 + 2}}], + y[{{sphere_index * 4 + 3}}] + ) { + return false; + } + {% endfor %} + } + {% endfor %} + + true +} diff --git a/resources/ur5/ur5_spherized_no_offset.urdf b/resources/ur5/ur5_spherized_no_offset.urdf new file mode 100644 index 0000000..d0cdb21 --- /dev/null +++ b/resources/ur5/ur5_spherized_no_offset.urdf @@ -0,0 +1,758 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/ur5_rust.json b/resources/ur5_rust.json new file mode 100644 index 0000000..d16cbc2 --- /dev/null +++ b/resources/ur5_rust.json @@ -0,0 +1,13 @@ +{ + "name": "Ur5", + "urdf": "ur5/ur5_spherized_no_offset.urdf", + "srdf": "ur5/ur5.srdf", + "end_effector": "robotiq_85_base_link", + "resolution": 32, + "template": "templates/fk_template.rs", + "subtemplates": [ + { "name": "ccfk", "template": "templates/ccfk_template.rs" } + ], + "output": "ur5_fk.rs", + "language": "rust" +} From 6e1e806d3e5e2a6a05f1cca5c5f2b9cd93ae12bc Mon Sep 17 00:00:00 2001 From: Clayton Ramsey Date: Thu, 12 Feb 2026 12:16:51 -0600 Subject: [PATCH 04/11] Add sphere_fk function for handling spheres --- resources/templates/fk_template.rs | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/resources/templates/fk_template.rs b/resources/templates/fk_template.rs index ee9376f..3dbb8e1 100644 --- a/resources/templates/fk_template.rs +++ b/resources/templates/fk_template.rs @@ -10,7 +10,7 @@ use core::simd::Simd; use carom_core::{ - Attach, Block, Collide3, PosedAttachment, Robot, SimdArithmetic, cos, sin, + Attach, Ball, Block, Collide3, PosedAttachment, Robot, SimdArithmetic, cos, sin, sphere_environment_in_collision, sphere_sphere_self_collision, }; @@ -73,6 +73,14 @@ where fn name(&self) -> &'static str { "{{lower(name)}}" } + + fn sphere_fk( + &self, + cfgs: &Block<{ Self::DIM }, L, f32>, + spheres: &mut Vec>>, + ) { + sphere_fk(&cfgs.0, spheres); + } } @@ -95,8 +103,6 @@ where fn fkcc(x: &ConfigurationBlock, environment: &impl Collide3) -> bool { ->>>>>>> Stashed changes ->>>>>>> 996ae5d (feat: running Rust FK/CC code for existing carom robots) let mut v = [Simd::splat(0.0); {{ccfk_code_vars}}]; let mut y = [Simd::splat(0.0); {{ccfk_code_output}}]; @@ -163,3 +169,18 @@ fn attach_fkcc( true } + +fn sphere_fk(x: &ConfigurationBlock, spheres: &mut Vec>>) +{ + let mut v = [Simd::splat(0.0); {{spherefk_code_vars}}]; + let mut y = [Simd::splat(0.0); {{spherefk_code_output}}]; + + {{spherefk_code}} + + for &[x, y, z, r] in y.as_chunks().0 { + spheres.push(Ball { + pos: [x, y, z], + r, + }); + } +} From 93870ff6e5db3a6ab8a0bd4c8ad30b8353eb327f Mon Sep 17 00:00:00 2001 From: Clayton Ramsey Date: Thu, 12 Feb 2026 13:05:45 -0600 Subject: [PATCH 05/11] fix: make pr2's hands open --- resources/pr2.json | 2 +- resources/pr2/pr2_spherized.urdf | 8 ++++---- resources/pr2_rust.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/pr2.json b/resources/pr2.json index 776581c..bb3d9e5 100644 --- a/resources/pr2.json +++ b/resources/pr2.json @@ -2,7 +2,7 @@ "name": "Pr2", "urdf": "pr2/pr2_spherized.urdf", "srdf": "pr2/pr2.srdf", - "end_effector": "r_gripper_palm_link", + "end_effector": "r_gripper_tool_frame", "resolution": 32, "template": "templates/fk_template.hh", "subtemplates": [ diff --git a/resources/pr2/pr2_spherized.urdf b/resources/pr2/pr2_spherized.urdf index ceed41f..c63d504 100644 --- a/resources/pr2/pr2_spherized.urdf +++ b/resources/pr2/pr2_spherized.urdf @@ -2341,7 +2341,7 @@ - + @@ -2350,7 +2350,7 @@ - + @@ -2565,7 +2565,7 @@ - + @@ -2574,7 +2574,7 @@ - + diff --git a/resources/pr2_rust.json b/resources/pr2_rust.json index c8551a4..5e61a91 100644 --- a/resources/pr2_rust.json +++ b/resources/pr2_rust.json @@ -2,7 +2,7 @@ "name": "Pr2", "urdf": "pr2/pr2_spherized.urdf", "srdf": "pr2/pr2_simple.srdf", - "end_effector": "r_gripper_palm_link", + "end_effector": "r_gripper_tool_frame", "resolution": 32, "template": "templates/fk_template.rs", "subtemplates": [ From 4c0f8b916b7396692f1485a9a9563ae93ccb3aa3 Mon Sep 17 00:00:00 2001 From: Clayton Ramsey Date: Thu, 12 Feb 2026 23:01:50 -0600 Subject: [PATCH 06/11] refactor: do not expose hidden details in public api of rust template --- resources/templates/fk_template.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/resources/templates/fk_template.rs b/resources/templates/fk_template.rs index 3dbb8e1..00b7e28 100644 --- a/resources/templates/fk_template.rs +++ b/resources/templates/fk_template.rs @@ -33,11 +33,10 @@ impl {{name}} { pub const JOINT_NAMES: [&str; DIM] = ["{{join(joint_names, "\", \"")}}"]; pub const END_EFFECTOR_NAME: &str = "{{end_effector}}"; - pub const BOUND_LOWER: [f32; DIM] = [{{join(bound_lower, ", ")}}]; + const BOUND_LOWER: [f32; DIM] = [{{join(bound_lower, ", ")}}]; + const BOUND_SCALE: [f32; DIM] = [{{join(bound_range, ", ")}}]; - pub const BOUND_SCALE: [f32; DIM] = [{{join(bound_range, ", ")}}]; - - pub const RESOLUTION: usize = {{resolution}}; + const RESOLUTION: usize = {{resolution}}; pub const MIN_RADIUS: f32 = {{min_radius}}; pub const MAX_RADIUS: f32 = {{max_radius}}; From 650d598db2ab8c36d3e3b72cca9f7b39a7c06450 Mon Sep 17 00:00:00 2001 From: Clayton Ramsey Date: Mon, 16 Feb 2026 15:14:36 -0600 Subject: [PATCH 07/11] feat: add EEFK and extra rust robots --- resources/baxter_rust.json | 13 ++++++++ resources/fetch_rust.json | 13 ++++++++ resources/templates/fk_template.rs | 52 +++++++++++++++++++++++------- resources/ur10e_rust.json | 12 +++++++ 4 files changed, 78 insertions(+), 12 deletions(-) create mode 100644 resources/baxter_rust.json create mode 100644 resources/fetch_rust.json create mode 100644 resources/ur10e_rust.json diff --git a/resources/baxter_rust.json b/resources/baxter_rust.json new file mode 100644 index 0000000..7dde18a --- /dev/null +++ b/resources/baxter_rust.json @@ -0,0 +1,13 @@ +{ + "name": "Baxter", + "urdf": "baxter/baxter_spherized.urdf", + "srdf": "baxter/baxter.srdf", + "end_effector": "right_gripper", + "resolution": 64, + "template": "templates/fk_template.rs", + "subtemplates": [ + { "name": "ccfk", "template": "templates/ccfk_template.rs" } + ], + "output": "baxter_fk.rs", + "language": "rust" +} diff --git a/resources/fetch_rust.json b/resources/fetch_rust.json new file mode 100644 index 0000000..4db4a79 --- /dev/null +++ b/resources/fetch_rust.json @@ -0,0 +1,13 @@ +{ + "name": "Fetch", + "urdf": "fetch/fetch_spherized.urdf", + "srdf": "fetch/fetch.srdf", + "end_effector": "gripper_link", + "resolution": 32, + "template": "templates/fk_template.rs", + "subtemplates": [ + { "name": "ccfk", "template": "templates/ccfk_template.rs" } + ], + "output": "fetch_fk.rs", + "language": "rust" +} diff --git a/resources/templates/fk_template.rs b/resources/templates/fk_template.rs index 00b7e28..ae31920 100644 --- a/resources/templates/fk_template.rs +++ b/resources/templates/fk_template.rs @@ -10,7 +10,7 @@ use core::simd::Simd; use carom_core::{ - Attach, Ball, Block, Collide3, PosedAttachment, Robot, SimdArithmetic, cos, sin, + Attach, AttachValidate, Ball, Block, BlockValidate, Collide3, PosedAttachment, Robot, SimdArithmetic, cos, sin, sphere_environment_in_collision, sphere_sphere_self_collision, }; @@ -36,7 +36,11 @@ impl {{name}} { const BOUND_LOWER: [f32; DIM] = [{{join(bound_lower, ", ")}}]; const BOUND_SCALE: [f32; DIM] = [{{join(bound_range, ", ")}}]; +<<<<<<< HEAD const RESOLUTION: usize = {{resolution}}; +======= + const BOUND_SCALE: [f32; DIM] = [{{join(bound_range, ", ")}}]; +>>>>>>> 0ae0b0e (feat: add EEFK and extra rust robots) pub const MIN_RADIUS: f32 = {{min_radius}}; pub const MAX_RADIUS: f32 = {{max_radius}}; @@ -54,17 +58,8 @@ const fn make_upper(lower: [f32; DIM], scale: [f32; DIM]) -> [f32; DIM] { type ConfigurationBlock = [Simd; {{name}}::DIM]; -impl Robot for {{name}} -where - W: Collide3, +impl Robot for {{name}} { - fn is_valid(&self, cfgs: &Block<{ Self::DIM }, L, f32>, world: &W) -> bool - where - Simd: SimdArithmetic, - { - fkcc(&cfgs.0, world) - } - fn bounds(&self) -> [[f32; DIM]; 2] { Self::BOUNDS } @@ -73,6 +68,10 @@ where "{{lower(name)}}" } + fn joint_names(&self) -> &[&str; DIM] { + &Self::JOINT_NAMES + } + fn sphere_fk( &self, cfgs: &Block<{ Self::DIM }, L, f32>, @@ -82,8 +81,26 @@ where } } +impl BlockValidate for {{name}} +where + W: Collide3, +{ + fn is_valid(&self, cfgs: &Block<{ Self::DIM }, L, f32>, world: &W) -> bool + where + Simd: SimdArithmetic, + { + fkcc(&cfgs.0, world) + } +} + +impl Attach for {{name}} +{ + fn eefk(&self, cfgs: &Block) -> [Simd; 12] { + eefk(&cfgs.0) + } +} -impl Attach for {{name}} +impl AttachValidate for {{name}} where W: Collide3, { @@ -183,3 +200,14 @@ fn sphere_fk(x: &ConfigurationBlock, spheres: &mut Vec(x: &ConfigurationBlock) -> [Simd; 12] +{ + let mut v = [Simd::splat(0.0); {{eefk_code_vars}}]; + let mut y = [Simd::splat(0.0); {{eefk_code_output}}]; + + {{eefk_code}} + + y +} diff --git a/resources/ur10e_rust.json b/resources/ur10e_rust.json new file mode 100644 index 0000000..b8e3c89 --- /dev/null +++ b/resources/ur10e_rust.json @@ -0,0 +1,12 @@ +{ + "name": "Ur10e", + "urdf": "ur10e/ur_10e_spherized.urdf", + "end_effector": "robotiq_85_base_link", + "resolution": 32, + "template": "templates/fk_template.rs", + "subtemplates": [ + { "name": "ccfk", "template": "templates/ccfk_template.rs" } + ], + "output": "ur10e_fk.rs", + "language": "rust" +} From edee196c0366023f5f4e9b3225024454eb2d4945 Mon Sep 17 00:00:00 2001 From: Clayton Ramsey Date: Mon, 16 Feb 2026 15:15:57 -0600 Subject: [PATCH 08/11] fix: remove broken git merge stuff --- resources/templates/fk_template.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/resources/templates/fk_template.rs b/resources/templates/fk_template.rs index ae31920..e2fd07d 100644 --- a/resources/templates/fk_template.rs +++ b/resources/templates/fk_template.rs @@ -36,11 +36,7 @@ impl {{name}} { const BOUND_LOWER: [f32; DIM] = [{{join(bound_lower, ", ")}}]; const BOUND_SCALE: [f32; DIM] = [{{join(bound_range, ", ")}}]; -<<<<<<< HEAD const RESOLUTION: usize = {{resolution}}; -======= - const BOUND_SCALE: [f32; DIM] = [{{join(bound_range, ", ")}}]; ->>>>>>> 0ae0b0e (feat: add EEFK and extra rust robots) pub const MIN_RADIUS: f32 = {{min_radius}}; pub const MAX_RADIUS: f32 = {{max_radius}}; From a5d20eef2fd483f1605935bc2ae06720ef9c70ab Mon Sep 17 00:00:00 2001 From: Clayton Ramsey Date: Tue, 17 Feb 2026 10:33:33 -0600 Subject: [PATCH 09/11] refactor: use slightly saner api for transforms --- resources/templates/fk_template.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/resources/templates/fk_template.rs b/resources/templates/fk_template.rs index e2fd07d..426d780 100644 --- a/resources/templates/fk_template.rs +++ b/resources/templates/fk_template.rs @@ -5,13 +5,14 @@ clippy::collapsible_if, clippy::excessive_precision, )] +#![allow(clippy::assign_op_pattern)] #![feature(portable_simd)] use core::simd::Simd; use carom_core::{ Attach, AttachValidate, Ball, Block, BlockValidate, Collide3, PosedAttachment, Robot, SimdArithmetic, cos, sin, - sphere_environment_in_collision, sphere_sphere_self_collision, + sphere_environment_in_collision, sphere_sphere_self_collision, Isometry, }; #[derive(Clone, Copy, Debug)] @@ -36,8 +37,6 @@ impl {{name}} { const BOUND_LOWER: [f32; DIM] = [{{join(bound_lower, ", ")}}]; const BOUND_SCALE: [f32; DIM] = [{{join(bound_range, ", ")}}]; - const RESOLUTION: usize = {{resolution}}; - pub const MIN_RADIUS: f32 = {{min_radius}}; pub const MAX_RADIUS: f32 = {{max_radius}}; } @@ -91,7 +90,7 @@ where impl Attach for {{name}} { - fn eefk(&self, cfgs: &Block) -> [Simd; 12] { + fn eefk(&self, cfgs: &Block) -> Isometry, 3> { eefk(&cfgs.0) } } @@ -136,10 +135,9 @@ fn attach_fkcc( {% include "ccfk" %} // attaching at {{ end_effector }} - attachment.set_pose_pr( - y[{{ccfkee_code_output - 12}}..{{ccfkee_code_output - 9}}].as_array().unwrap(), - y[{{ccfkee_code_output - 9}}..{{ccfkee_code_output}}].as_array().unwrap() - ); + attachment.set_pose(&Isometry::from_carom_buf( + *y[{{ccfkee_code_output - 12}}..{{ccfkee_code_output}}].as_array().unwrap() + )); // // attachment vs. environment collisions @@ -198,12 +196,12 @@ fn sphere_fk(x: &ConfigurationBlock, spheres: &mut Vec(x: &ConfigurationBlock) -> [Simd; 12] +fn eefk(x: &ConfigurationBlock) -> Isometry, 3> { let mut v = [Simd::splat(0.0); {{eefk_code_vars}}]; let mut y = [Simd::splat(0.0); {{eefk_code_output}}]; {{eefk_code}} - y + Isometry::from_carom_buf(y) } From a48eadd604f8cf4f6b7dccfd38e0c980d222b07e Mon Sep 17 00:00:00 2001 From: Clayton Ramsey Date: Tue, 17 Feb 2026 11:00:48 -0600 Subject: [PATCH 10/11] fix: remove more busted git histories --- src/fkcc_gen.cc | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/fkcc_gen.cc b/src/fkcc_gen.cc index dcfade9..c17055e 100644 --- a/src/fkcc_gen.cc +++ b/src/fkcc_gen.cc @@ -538,13 +538,10 @@ auto trace_sphere_cc_fk( LanguageRust langRust("double"); handler.generateCode(function_code, langRust, result, nameGen); } -<<<<<<< HEAD else { throw std::runtime_error(fmt::format("unsupported language {}", language)); } -======= ->>>>>>> 3576dba (feat: support Rust code generation in cricket) return Traced{function_code.str(), handler.getTemporaryVariableCount(), n_out}; } @@ -620,13 +617,6 @@ int main(int argc, char **argv) { language = data["language"]; } -<<<<<<< HEAD -======= - if (not(language == "rust" or language == "c++")) - { - throw std::runtime_error(fmt::format("unsupported language {}", language)); - } ->>>>>>> 3576dba (feat: support Rust code generation in cricket) RobotInfo robot(parent_path / data["urdf"], srdf_path, end_effector_name); From 97cd05fe3731872d0c8e0fe7b4e8205c45a4f5c1 Mon Sep 17 00:00:00 2001 From: Clayton Ramsey Date: Fri, 6 Mar 2026 11:44:14 -0600 Subject: [PATCH 11/11] Revert "refactor: separate cmake and build steps in Dockerfile" This reverts commit 1aecd2b11237ada3c61f673767fab4c746683714. --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0e7f116..b97a470 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,5 @@ RUN micromamba install -y -n base -f /tmp/env.yaml && \ ARG MAMBA_DOCKERFILE_ACTIVATE=1 COPY . cricket/ -RUN cmake -GNinja -Bbuild -DCPM_SOURCE_CACHE=.cpm_cache cricket -RUN cmake --build build +RUN cmake -GNinja -Bbuild -DCPM_SOURCE_CACHE=.cpm_cache cricket && cmake --build build ENTRYPOINT ["/usr/local/bin/_entrypoint.sh", "/tmp/build/fkcc_gen"]