Split Cricket into multiple files#9
Open
ShrutheeshIR wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the fkcc_gen generator by extracting previously inlined helper types/utilities into separate headers to improve organization and reuse.
Changes:
- Moved robot/geometry parsing and collision-sphere extraction logic into
src/robot_info.hh. - Centralized AD/CppADCG type aliases and language helpers into
src/housekeeping.hh. - Extracted tracing result utilities into
src/tracer_utils.hhand updatedfkcc_gen.ccto include the new headers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| src/tracer_utils.hh | New header for Traced and trace-to-JSON helpers. |
| src/robot_info.hh | New header containing RobotInfo and sphere/collision extraction logic. |
| src/housekeeping.hh | New header for AD/CppADCG-related aliases and language support includes. |
| src/fkcc_gen.cc | Removes inlined definitions and switches to the new headers. |
Comments suppressed due to low confidence (1)
src/fkcc_gen.cc:4
- This translation unit now uses std::ifstream/std::ofstream, std::cout, std::ostringstream, exit(), and std::string but doesn’t include the corresponding standard headers. Relying on transitive includes from third-party headers is brittle and can break builds when those dependencies change.
#include <fmt/core.h>
#include <nlohmann/json.hpp>
#include <inja/inja.hpp>
#include <cxxopts.hpp>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+17
| #include "pinocchio_cppadcg.hh" | ||
| #include "lang_cpp.hh" | ||
| #include "lang_rust.hh" | ||
|
|
||
|
|
||
| using namespace pinocchio; | ||
| using namespace CppAD; | ||
| using namespace CppAD::cg; | ||
|
|
||
| // Typedef for AD types | ||
| using CGD = CG<double>; | ||
| using ADCG = AD<CGD>; | ||
|
|
||
| using ADModel = ModelTpl<ADCG>; | ||
| using ADData = DataTpl<ADCG>; | ||
| using ADVectorXs = Eigen::Matrix<ADCG, Eigen::Dynamic, 1>; | ||
| using ADMatrixXs = Eigen::Matrix<ADCG, Eigen::Dynamic, Eigen::Dynamic>; No newline at end of file |
Comment on lines
+1
to
+18
| #pragma once | ||
|
|
||
| #include <fmt/core.h> | ||
| #include <nlohmann/json.hpp> | ||
|
|
||
| struct Traced | ||
| { | ||
| std::string code; | ||
| std::size_t temp_variables; | ||
| std::size_t outputs; | ||
| }; | ||
|
|
||
| void add_to_trace(Traced tcode, std::string name, nlohmann::json &data) | ||
| { | ||
| data[name] = tcode.code; | ||
| data[fmt::format("{}_vars", name)] = tcode.temp_variables; | ||
| data[fmt::format("{}_output", name)] = tcode.outputs; | ||
| } |
Comment on lines
+1
to
+29
| #pragma once | ||
|
|
||
| #include <pinocchio/parsers/urdf.hpp> | ||
| #include <pinocchio/parsers/srdf.hpp> | ||
| #include <pinocchio/algorithm/joint-configuration.hpp> | ||
| #include <pinocchio/algorithm/frames.hpp> | ||
| #include <pinocchio/algorithm/kinematics.hpp> | ||
| #include <pinocchio/algorithm/geometry.hpp> | ||
| #include <pinocchio/multibody/geometry.hpp> | ||
| #include <pinocchio/collision/collision.hpp> | ||
|
|
||
|
|
||
| // #include "pinocchio/multibody/model.hpp" | ||
| // #include "pinocchio/multibody/data.hpp" | ||
| // #include "pinocchio/algorithm/compute-all-terms.hpp" | ||
| #include "pinocchio/algorithm/center-of-mass.hpp" | ||
|
|
||
|
|
||
| #include <coal/shape/geometric_shapes.h> | ||
|
|
||
| #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> | ||
| #include <CGAL/Min_sphere_of_spheres_d.h> | ||
| #include <CGAL/Min_sphere_of_spheres_d_traits_3.h> | ||
|
|
||
| #include <filesystem> | ||
| #include <stdexcept> | ||
| #include <vector> | ||
| #include <optional> | ||
|
|
|
|
||
| if (srdf_file and not std::filesystem::exists(*srdf_file)) | ||
| { | ||
| throw std::runtime_error(fmt::format("SRDF file () does not exist!", srdf_file->string())); |
| SE3 relative; | ||
| }; | ||
|
|
||
| auto min_sphere_of_spheres(const std::vector<SphereInfo> &info) -> std::array<float, 4> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some helpful splitting of cricket.