Regenerated failed files

release/4.3a0
p-zach 2025-04-05 15:21:30 -04:00
parent bea6979b18
commit fab57eec54
4 changed files with 219 additions and 8 deletions

View File

@ -2,10 +2,58 @@
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "736fa438", "id": "31f395c5",
"metadata": {}, "metadata": {},
"source": [ "source": [
"I'm unable to access external URLs directly. However, if you upload the file `CustomFactor.h`, I can help generate the documentation for it." "# CustomFactor Class Documentation\n",
"\n",
"*Disclaimer: This documentation was generated by AI and may require human revision for accuracy and completeness.*\n",
"\n",
"## Overview\n",
"\n",
"The `CustomFactor` class in GTSAM is a specialized type of factor used in factor graphs, which allows users to define custom error functions and Jacobians. This class is particularly useful when the standard factors provided by GTSAM do not meet specific application needs, allowing for greater flexibility and customization in defining the behavior of the factor.\n",
"\n",
"## Key Functionalities\n",
"\n",
"### Custom Error Function\n",
"\n",
"The `CustomFactor` class allows users to define a custom error function. This is a critical feature as it enables the modeling of specific constraints or measurements that are not covered by existing GTSAM factors. The error function typically represents the difference between predicted and observed measurements and is central to the optimization process in factor graphs.\n",
"\n",
"### Jacobian Calculation\n",
"\n",
"In addition to the error function, users can define custom Jacobians. The Jacobian is the matrix of all first-order partial derivatives of a vector-valued function. In the context of `CustomFactor`, it represents the sensitivity of the error function with respect to the variables involved. This is crucial for optimization algorithms, which rely on gradient information to find the minimum of the error function.\n",
"\n",
"### Integration with Factor Graphs\n",
"\n",
"`CustomFactor` seamlessly integrates with GTSAM's factor graph framework. It can be added to a factor graph just like any other factor, participating in the graph optimization process. This integration ensures that custom factors can be used alongside standard factors, providing a flexible and powerful tool for solving complex estimation problems.\n",
"\n",
"## Mathematical Formulation\n",
"\n",
"### Error Function\n",
"\n",
"The error function $e(\\mathbf{x})$ is defined by the user and represents the discrepancy between the observed and predicted measurements. It is a vector-valued function:\n",
"\n",
"$$ e(\\mathbf{x}) = h(\\mathbf{x}) - \\mathbf{z} $$\n",
"\n",
"where $h(\\mathbf{x})$ is the predicted measurement based on the current estimate of the variables $\\mathbf{x}$, and $\\mathbf{z}$ is the observed measurement.\n",
"\n",
"### Jacobian\n",
"\n",
"The Jacobian matrix $J$ of the error function with respect to the variables $\\mathbf{x}$ is given by:\n",
"\n",
"$$ J = \\frac{\\partial e}{\\partial \\mathbf{x}} $$\n",
"\n",
"This matrix is used in the optimization process to update the estimates of the variables in a direction that reduces the error.\n",
"\n",
"## Usage\n",
"\n",
"To use `CustomFactor`, users must:\n",
"\n",
"1. Define the custom error function that models the specific measurement or constraint.\n",
"2. Implement the calculation of the Jacobian matrix for the error function.\n",
"3. Add the `CustomFactor` to a factor graph, specifying the keys of the variables it depends on.\n",
"\n",
"By following these steps, users can leverage the flexibility of `CustomFactor` to incorporate custom measurements and constraints into their factor graph models, enhancing the capability of GTSAM to solve a wide range of estimation problems."
] ]
} }
], ],

View File

@ -2,10 +2,61 @@
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "7f0a9feb", "id": "867a20bc",
"metadata": {}, "metadata": {},
"source": [ "source": [
"I'm unable to directly access or search the content of the uploaded file. However, if you can provide the text or key excerpts from the file, I can help generate the documentation based on that information." "# ISAM2 Class Documentation\n",
"\n",
"*Disclaimer: This documentation was generated by AI and may require human revision for accuracy and completeness.*\n",
"\n",
"## Overview\n",
"\n",
"The `ISAM2` class in GTSAM is an incremental smoothing and mapping algorithm that efficiently updates the solution to a nonlinear optimization problem as new measurements are added. This class is particularly useful in applications such as SLAM (Simultaneous Localization and Mapping) where real-time performance is crucial.\n",
"\n",
"## Key Features\n",
"\n",
"- **Incremental Updates**: `ISAM2` allows for incremental updates to the factor graph, avoiding the need to solve the entire problem from scratch with each new measurement.\n",
"- **Bayesian Inference**: Utilizes Bayes' rule to update beliefs about the state of the system as new information becomes available.\n",
"- **Nonlinear Optimization**: Capable of handling nonlinear systems, leveraging iterative optimization techniques to refine estimates.\n",
"- **Efficient Variable Reordering**: Dynamically reorders variables to maintain sparsity and improve computational efficiency.\n",
"\n",
"## Main Methods\n",
"\n",
"### Initialization and Configuration\n",
"\n",
"- **ISAM2 Constructor**: Initializes the `ISAM2` object with optional parameters for configuring the behavior of the algorithm, such as relinearization thresholds and ordering strategies.\n",
"\n",
"### Updating the Graph\n",
"\n",
"- **update**: Incorporates new factors and variables into the existing factor graph. This method performs the core incremental update, refining the solution based on new measurements.\n",
"\n",
"### Accessing Results\n",
"\n",
"- **calculateEstimate**: Retrieves the current estimate of the variables in the factor graph. This method can be called with specific variable keys to obtain their estimates.\n",
"- **marginalCovariance**: Computes the marginal covariance of a specified variable, providing insight into the uncertainty of the estimate.\n",
"\n",
"### Advanced Features\n",
"\n",
"- **relinearize**: Forces relinearization of the entire factor graph, which can be useful in scenarios where significant nonlinearities are introduced.\n",
"- **getFactorsUnsafe**: Provides access to the internal factor graph, allowing for advanced manipulations and custom analyses.\n",
"\n",
"## Mathematical Formulation\n",
"\n",
"The `ISAM2` algorithm is based on the factor graph representation of the problem, where the joint probability distribution is expressed as a product of factors:\n",
"\n",
"$$ P(X|Z) \\propto \\prod_{i} \\phi_i(X_i, Z_i) $$\n",
"\n",
"Here, $X$ represents the set of variables, $Z$ the measurements, and $\\phi_i$ the individual factors.\n",
"\n",
"The update process involves solving a nonlinear optimization problem, typically using the Gauss-Newton or Levenberg-Marquardt algorithms, to minimize the error:\n",
"\n",
"$$ \\min_{X} \\sum_{i} \\| h_i(X_i) - Z_i \\|^2 $$\n",
"\n",
"where $h_i(X_i)$ are the measurement functions.\n",
"\n",
"## Conclusion\n",
"\n",
"The `ISAM2` class is a powerful tool for real-time estimation in dynamic environments. Its ability to efficiently update solutions with new data makes it ideal for applications requiring continuous adaptation and refinement of estimates. Users can leverage its advanced features to customize the behavior and performance of the algorithm to suit specific needs."
] ]
} }
], ],

View File

@ -2,10 +2,64 @@
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "37ed0b18", "id": "381ccaaa",
"metadata": {}, "metadata": {},
"source": [ "source": [
"It seems there was an issue with accessing the file content directly. Could you please provide the content of the file or any specific details you would like to be documented?" "# NonlinearFactor Class Documentation\n",
"\n",
"*Disclaimer: This documentation was generated by AI and may require human revision for accuracy and completeness.*\n",
"\n",
"## Overview\n",
"\n",
"The `NonlinearFactor` class in GTSAM is a fundamental component used in nonlinear optimization problems. It represents a factor in a factor graph, which is a key concept in probabilistic graphical models. The class is designed to work with nonlinear functions, making it suitable for a wide range of applications in robotics and computer vision, such as SLAM (Simultaneous Localization and Mapping) and structure from motion.\n",
"\n",
"## Key Functionalities\n",
"\n",
"### Error Calculation\n",
"\n",
"- **evaluateError**: This method computes the error vector for the factor given a set of variable values. The error is typically the difference between the predicted measurement and the actual measurement. The function can also return the Jacobian matrices if needed, which are crucial for optimization algorithms like Gauss-Newton or Levenberg-Marquardt.\n",
"\n",
"### Jacobian and Hessian\n",
"\n",
"- **linearize**: This method linearizes the nonlinear factor around a linearization point. It returns a `GaussianFactor`, which is an approximation of the `NonlinearFactor` using a first-order Taylor expansion. This is a critical step in iterative optimization methods, where the problem is repeatedly linearized and solved.\n",
"\n",
"### Active Flag\n",
"\n",
"- **active**: This function checks whether the factor should be included in the optimization process. A factor might be inactive if it does not contribute to the error, which can occur in cases of conditional constraints or gating functions.\n",
"\n",
"### Dimensionality\n",
"\n",
"- **dim**: Returns the dimensionality of the factor, which corresponds to the size of the error vector. This is important for understanding the contribution of the factor to the overall optimization problem.\n",
"\n",
"### Key Management\n",
"\n",
"- **keys**: Provides access to the keys (or variable indices) involved in the factor. This is essential for understanding which variables the factor is connected to in the factor graph.\n",
"\n",
"## Mathematical Formulation\n",
"\n",
"The `NonlinearFactor` is generally represented by a function $f(x)$, where $x$ is a vector of variables. The error is given by:\n",
"\n",
"$$ e(x) = z - f(x) $$\n",
"\n",
"where $z$ is the observed measurement. The optimization process aims to minimize the sum of squared errors:\n",
"\n",
"$$ \\min_x \\sum_i \\| e_i(x) \\|^2 $$\n",
"\n",
"Linearization involves approximating $f(x)$ around a point $x_0$:\n",
"\n",
"$$ f(x) \\approx f(x_0) + J(x - x_0) $$\n",
"\n",
"where $J$ is the Jacobian matrix of $f$ at $x_0$. This leads to a linearized error:\n",
"\n",
"$$ e(x) \\approx z - (f(x_0) + J(x - x_0)) $$\n",
"\n",
"## Usage Notes\n",
"\n",
"- The `NonlinearFactor` class is typically used in conjunction with a `NonlinearFactorGraph`, which is a collection of such factors.\n",
"- Users need to implement the `evaluateError` method in derived classes to define the specific measurement model.\n",
"- The class is designed to be flexible and extensible, allowing for custom factors to be created for specific applications.\n",
"\n",
"In summary, the `NonlinearFactor` class is a versatile and essential component for building and solving nonlinear optimization problems in GTSAM. Its ability to handle nonlinear relationships and provide linear approximations makes it suitable for a wide range of applications in robotics and beyond."
] ]
} }
], ],

View File

@ -2,10 +2,68 @@
"cells": [ "cells": [
{ {
"cell_type": "markdown", "cell_type": "markdown",
"id": "e31da023", "id": "2b6fc012",
"metadata": {}, "metadata": {},
"source": [ "source": [
"It seems there is an issue with accessing the file directly. However, I can guide you on how to document the class if you can provide the class definition and its key methods. You can paste the relevant parts of the file here, and I'll help you create the Markdown documentation." "# NonlinearISAM Class Documentation\n",
"\n",
"*Disclaimer: This documentation was generated by AI and may require human revision for accuracy and completeness.*\n",
"\n",
"## Overview\n",
"\n",
"The `NonlinearISAM` class in GTSAM is a powerful tool for incrementally solving nonlinear factor graphs. It is particularly useful in applications where the problem is continuously evolving, such as in SLAM (Simultaneous Localization and Mapping) or incremental structure-from-motion. The class leverages the iSAM (incremental Smoothing and Mapping) algorithm to efficiently update solutions as new measurements are added.\n",
"\n",
"## Key Features\n",
"\n",
"- **Incremental Updates**: `NonlinearISAM` allows for the efficient update of the solution when new factors are added to the graph. This is crucial for real-time applications where the problem is continuously changing.\n",
" \n",
"- **Batch Initialization**: The class can perform a full batch optimization to initialize the solution, which can then be refined incrementally.\n",
"\n",
"- **Marginalization**: It supports marginalizing out variables that are no longer needed, which helps in maintaining computational efficiency.\n",
"\n",
"## Main Methods\n",
"\n",
"### Initialization and Update\n",
"\n",
"- **`update`**: This method is central to the `NonlinearISAM` class. It allows for the addition of new factors and variables to the existing factor graph. The update is performed incrementally, leveraging previous computations to enhance efficiency.\n",
"\n",
"- **`estimate`**: After performing updates, this method retrieves the current best estimate of the variable values.\n",
"\n",
"### Batch Operations\n",
"\n",
"- **`batchStep`**: This method performs a full batch optimization, which can be useful for reinitializing the solution or when a significant change in the problem structure occurs.\n",
"\n",
"### Marginalization\n",
"\n",
"- **`marginalize`**: This method allows for the removal of variables from the factor graph. Marginalization is useful for reducing the problem size and maintaining efficiency.\n",
"\n",
"## Mathematical Background\n",
"\n",
"The `NonlinearISAM` class operates on factor graphs, which are bipartite graphs consisting of variable nodes and factor nodes. The goal is to find the configuration of variables that maximizes the product of all factors, often expressed as:\n",
"\n",
"$$\n",
"\\max_{\\mathbf{x}} \\prod_{i} \\phi_i(\\mathbf{x}_i)\n",
"$$\n",
"\n",
"where $\\phi_i(\\mathbf{x}_i)$ are the factors depending on subsets of variables $\\mathbf{x}_i$.\n",
"\n",
"The iSAM algorithm updates the solution by incrementally solving the linearized system of equations derived from the factor graph:\n",
"\n",
"$$\n",
"\\mathbf{A} \\Delta \\mathbf{x} = \\mathbf{b}\n",
"$$\n",
"\n",
"where $\\mathbf{A}$ is the Jacobian matrix of the factors, $\\Delta \\mathbf{x}$ is the update to the variable estimates, and $\\mathbf{b}$ is the residual vector.\n",
"\n",
"## Usage Notes\n",
"\n",
"- **Efficiency**: The incremental nature of `NonlinearISAM` makes it highly efficient for large-scale problems where new data is continuously being integrated.\n",
"\n",
"- **Robustness**: The ability to perform batch optimizations and marginalize variables provides robustness against changes in the problem structure.\n",
"\n",
"- **Applications**: This class is particularly suited for robotics and computer vision applications where real-time performance is critical.\n",
"\n",
"In summary, the `NonlinearISAM` class is a sophisticated tool for handling dynamic nonlinear optimization problems, offering both incremental and batch processing capabilities to efficiently manage evolving factor graphs."
] ]
} }
], ],