### Install Ruckig Python Module Source: https://github.com/pantor/ruckig/blob/main/README.md Installs the Ruckig Python module from PyPI using pip. ```bash pip install ruckig ``` -------------------------------- ### Ruckig Tracking Interface State and Constraints Setup Source: https://github.com/pantor/ruckig/blob/main/README.md Sets the current state (position, velocity, acceleration) and kinematic constraints (max velocity, acceleration, jerk) for the Ruckig tracking interface. ```cpp input.current_position = {0.0}; input.current_velocity = {0.0}; input.current_acceleration = {0.0}; input.max_velocity = {0.8}; input.max_acceleration = {2.0}; input.max_jerk = {5.0}; ``` -------------------------------- ### Install Ruckig using cpack Source: https://github.com/pantor/ruckig/blob/main/README.md Installs Ruckig system-wide using cpack to generate a debian package. ```bash cpack sudo dpkg -i ruckig*.deb ``` -------------------------------- ### Find and Link Ruckig Package in CMake Source: https://github.com/pantor/ruckig/blob/main/examples/CMakeLists-installed.txt This snippet configures CMake to find an installed Ruckig package and links it to a C++17 executable. Ensure Ruckig is installed via 'make install' before running CMake. ```cmake cmake_minimum_required(VERSION 3.10) project(ruckig_examples) find_package(ruckig REQUIRED) # Build the position example add_executable(example-position 01_position.cpp) target_compile_features(example-position PUBLIC cxx_std_17) target_link_libraries(example-position PRIVATE ruckig::ruckig) ``` -------------------------------- ### Define Input and Output Parameters Source: https://github.com/pantor/ruckig/blob/main/README.md Sets up the input and output parameter structures for Ruckig, including current and target states, and kinematic limits. ```cpp InputParameter<6> input; // Number DoFs input.current_position = {0.2, ...}; input.current_velocity = {0.1, ...}; input.current_acceleration = {0.1, ...}; input.target_position = {0.5, ...}; input.target_velocity = {-0.1, ...}; input.target_acceleration = {0.2, ...}; input.max_velocity = {0.4, ...}; input.max_acceleration = {1.0, ...}; input.max_jerk = {4.0, ...}; OutputParameter<6> output; // Number DoFs ``` -------------------------------- ### Ruckig Tracking Interface Initialization Source: https://github.com/pantor/ruckig/blob/main/README.md Initializes the Ruckig Tracking interface with a specified control cycle time. ```cpp Trackig<1> trackig {0.01}; // control cycle ``` -------------------------------- ### CMakeLists.txt for Ruckig Integration Source: https://github.com/pantor/ruckig/blob/main/examples/CMakeLists-directory.txt Use this CMakeLists.txt to build an executable that links against the Ruckig library. Ensure Ruckig's include and lib directories are correctly specified. ```cmake cmake_minimum_required(VERSION 3.10) project(ruckig_examples) include_directories(include) link_directories(lib) # Build the position example add_executable(example-position 01_position.cpp) target_compile_features(example-position PUBLIC cxx_std_17) target_link_libraries(example-position ruckig) ``` -------------------------------- ### Build Ruckig with CMake Source: https://github.com/pantor/ruckig/blob/main/README.md Builds the Ruckig library using CMake. Assumes you are in a build directory. ```bash mkdir -p build cd build cmake -DCMAKE_BUILD_TYPE=Release .. make ``` -------------------------------- ### Ruckig Offline Calculation Source: https://github.com/pantor/ruckig/blob/main/README.md Demonstrates how to perform an offline trajectory calculation using the Ruckig library. ```cpp result = ruckig.calculate(input, trajectory); ``` -------------------------------- ### Ruckig Online Tracking Loop Source: https://github.com/pantor/ruckig/blob/main/README.md Demonstrates the online tracking process within a control loop, updating the target state and processing the output. ```cpp for (double t = 0; t < 10.0; t += trackig.delta_time) { auto target_state = signal(t); // signal returns position, velocity, and acceleration auto res = trackig.update(target_state, input, output); // Make use of the smooth target motion here (e.g. output.new_position) output.pass_to_input(input); } ``` -------------------------------- ### Instantiate Ruckig Controller Source: https://github.com/pantor/ruckig/blob/main/README.md Creates a Ruckig instance with a specified number of degrees of freedom and control cycle time. ```cpp Ruckig<6> ruckig {0.001}; // Number DoFs; control cycle in [s] ``` -------------------------------- ### Ruckig Trajectory Class Parameters Source: https://github.com/pantor/ruckig/blob/main/README.md Illustrates key parameters and methods of the Ruckig Trajectory class for accessing trajectory properties. ```cpp double duration; // Duration of the trajectory std::array independent_min_durations; // Time-optimal profile for each independent DoF <...> at_time(double time); // Get the kinematic state of the trajectory at a given time void get_position_extrema(Vector& position_extrema); // Passes information about the position extrema and their times ``` -------------------------------- ### Include Eigen for Ruckig Integration Source: https://github.com/pantor/ruckig/blob/main/README.md Include Eigen (version 3.4 or later) before Ruckig to enable integration with Eigen types. ```cpp #include // Version 3.4 or later #include ``` -------------------------------- ### Ruckig Stepping Through Trajectory Source: https://github.com/pantor/ruckig/blob/main/README.md Shows how to step through a trajectory using the update function in a control loop. This is available in Ruckig Pro. ```cpp while (ruckig.update(trajectory, output) == Result::Working) { // Make use of the new state here! // e.g. robot->setJointPositions(output.new_position); } ``` -------------------------------- ### Ruckig with Eigen Vector Types Source: https://github.com/pantor/ruckig/blob/main/README.md Instantiate Ruckig with `ruckig::EigenVector` to use Eigen types for all Ruckig API inputs and outputs. ```cpp Ruckig<6, EigenVector> ruckig {0.001}; InputParameter<6, EigenVector> input; OutputParameter<6, EigenVector> output; ``` -------------------------------- ### Ruckig Output Parameters Source: https://github.com/pantor/ruckig/blob/main/README.md Defines the output parameters for the Ruckig update function, including kinematic state, trajectory information, and calculation status. ```cpp Vector new_position; Vector new_velocity; Vector new_acceleration; Trajectory trajectory; // The current trajectory double time; // The current, auto-incremented time. Reset to 0 at a new calculation. size_t new_section; // Index of the section between two (possibly filtered) intermediate positions. bool did_section_change; // Was a new section reached in the last cycle? bool new_calculation; // Whether a new calculation was performed in the last cycle bool was_calculation_interrupted; // Was the trajectory calculation interrupted? (only in Pro Version) double calculation_duration; // Duration of the calculation in the last cycle [µs] ``` -------------------------------- ### Allocate Memory for Intermediate Waypoints Source: https://github.com/pantor/ruckig/blob/main/README.md Allocate memory for a variable number of intermediate waypoints by passing the maximum number to Ruckig. This sets up the necessary structures for waypoint handling. ```cpp Ruckig<6> ruckig {0.001, 8}; InputParameter<6> input {8}; OutputParameter<6> output {8}; ``` -------------------------------- ### Configure Ruckig for Extended Numerical Range Source: https://github.com/pantor/ruckig/blob/main/README.md Use `position_scale` and `time_scale` parameters in Ruckig Pro's Calculator to adjust internal representation for higher jerk limits or longer trajectories. These scales affect internal calculations only and do not alter the final trajectory. ```cpp Ruckig<1> ruckig; // Works also for Trackig ruckig.calculator.position_scale = 1e2; // Scales all positions in the input parameters ruckig.calculator.time_scale = 1e3; // Scale all times in the input parameters ``` -------------------------------- ### Ruckig InputParameter Members Source: https://github.com/pantor/ruckig/blob/main/README.md Defines the structure for input parameters in Ruckig, including current and target states, kinematic limits, and advanced control options. ```cpp using Vector = std::array; // By default Vector current_position; Vector current_velocity; // Initialized to zero Vector current_acceleration; // Initialized to zero std::vector intermediate_positions; // (only in Pro Version) Vector target_position; Vector target_velocity; // Initialized to zero Vector target_acceleration; // Initialized to zero Vector max_velocity; Vector max_acceleration; Vector max_jerk; // Initialized to infinity Vector max_position; // Initialized to infinity (only in Pro Version) Vector min_position; // Initialized to -infinity (only in Pro Version) std::optional min_velocity; // If not given, the negative maximum velocity will be used. std::optional min_acceleration; // If not given, the negative maximum acceleration will be used. std::array enabled; // Initialized to true std::optional minimum_duration; std::optional interrupt_calculation_duration; // [µs], (only in Pro Version) ControlInterface control_interface; // The default position interface controls the full kinematic state. Synchronization synchronization; // Synchronization behavior of multiple DoFs DurationDiscretization duration_discretization; // Whether the duration should be a discrete multiple of the control cycle (off by default) std::optional> per_dof_control_interface; // Sets the control interface for each DoF individually, overwrites global control_interface std::optional> per_dof_synchronization; // Sets the synchronization for each DoF individually, overwrites global synchronization ``` -------------------------------- ### Minimal Custom Vector Type Definition Source: https://github.com/pantor/ruckig/blob/main/README.md Define a custom vector type by implementing the required template arguments and methods. `DynamicDOFs` corresponds to `DOFs = 0`. ```cpp template struct MinimalVector { Type operator[](size_t i) const; // Array [] getter Type& operator[](size_t i); // Array [] setter size_t size() const; // Current size bool operator==(const MinimalVector& rhs) const; // Equal comparison operator // Only required in combination with DynamicDOFs, e.g. to allocate memory void resize(size_t size); }; ``` -------------------------------- ### Ruckig with Dynamic Degrees of Freedom Source: https://github.com/pantor/ruckig/blob/main/README.md Use `ruckig::DynamicDOFs` when the number of degrees of freedom is not known at compile-time. This switches the internal vector type to `std::vector`. Ensure memory is allocated beforehand for dynamic DoFs. ```cpp Ruckig ruckig {6, 0.001}; InputParameter input {6}; OutputParameter output {6}; ``` -------------------------------- ### Ruckig Control Loop Source: https://github.com/pantor/ruckig/blob/main/README.md The main control loop that updates the Ruckig trajectory and processes the output. Ensure to pass the output state back to the input for the next iteration. ```cpp while (ruckig.update(input, output) == Result::Working) { // Make use of the new state here! // e.g. robot->setJointPositions(output.new_position); output.pass_to_input(input); // Don't forget this! } ``` -------------------------------- ### Ruckig Input Validation Source: https://github.com/pantor/ruckig/blob/main/README.md Validates the input parameters before trajectory calculation to ensure a valid trajectory can be generated. Can optionally check if current/target states are within limits. ```cpp ruckig.validate_input(input, check_current_state_within_limits=false, check_target_state_within_limits=true); // returns true or throws ``` ```cpp ruckig.validate_input(...) ``` -------------------------------- ### Set Intermediate Waypoint Positions Source: https://github.com/pantor/ruckig/blob/main/README.md Set intermediate waypoint positions for trajectory generation. The Ruckig Community Version uses a cloud API for calculation when intermediate positions are provided. ```cpp input.intermediate_positions = { {0.2, ...}, {0.8, ...}, }; ``` -------------------------------- ### Ruckig Tracking Interface Offline Calculation Source: https://github.com/pantor/ruckig/blob/main/README.md Calculates a smooth trajectory offline using the Ruckig tracking interface when the entire signal is known beforehand. This is available in Ruckig Pro. ```cpp smooth_trajectory = trackig.calculate_trajectory(target_states, input); ``` -------------------------------- ### Filter Intermediate Waypoint Positions Source: https://github.com/pantor/ruckig/blob/main/README.md Filter intermediate waypoint positions to ensure a minimum distance between them. This helps in optimizing the trajectory generation process. ```cpp input.intermediate_positions = ruckig.filter_intermediate_positions(input.intermediate_positions, {0.1, ...}); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.