Submap::ToProto now returns the proto.
This PR makes the interfaces for serialization more consistent: In `mapping_state_serialization.cc` all `ToProto` methods return the proto except Submap::ToProto.
* [GenericPoseGraph] Added relative pose cost 3d.
* Added another case to the test.
* Removed ceres function from cost function.
* Ran clang-format.
* Minor renaming.
When serializing `TrajectoryNode`, the declared proto is currently re-used. This can lead to unexpected behavior, in particular when the serialization of the proto is performed in an external function.
This PR also relates PR #1277 where exactly that problem occurred in the SerializeSubmaps.
Introduce separate mutex for PoseGraph3D work queue access.
This reduces lock contention, see issue #1250.
In particular higher frequency call to AddWorkItem
don't need to take the main mutex from the froground
thread anymore.
This PR introduces two metrics to measure performance of local slam: real time ratio, and cpu real time ratio. The latter is introduced to measure the headroom.
Real time ratio tells us how fast local slam processes the incoming sensor data. When SLAM is falling behind, this is below 100%. In the steady state it is 100% (The real time ratio is above 100% only when slam is 'catching up'.). So this does not tell us how much faster than real time slam processes the data. For this purpose the cpu real time ratio is introduced. It measures how much cpu time slam used, compared to the real time passed to collect the sensor data. Thus it can be more than 100% if slam is faster than real time. For example, a cpu real time ratio of 200% means that slam could process the data twice as fast as it comes in.
Three durations are measured:
- sensor_duration: the physical time it took to collect the sensor data.
- wall_time_duration: the time it took to process that data
- thread_cpu_duration: CPU time it took to process that data.
And the metrics then are:
real time ratio = sensor_duration / wall_time_duration
cpu real time ratio = sensor_duration / thread_cpu_duration
When preparing constraints make holding of the PoseGraph3D
mutex fine-grained to address lock contention from issue #1250.
That includes not holding the mutex when acquring the constraint
builder mutex.
Take PoseGraph3D mutex inside instead of outside work item
This refactors the code but does not alter behavior except
that the shared mutex is separately taken for work_queue_ access,
released, and then re-acquired inside each work item.
As a consequence AddWorkItem() also needs to EXCLUDE() the lock and
acquire it internally, because for the case where we run the task
in the foreground we cannot hold the lock and recursively acquire it again
inside the task being run.
This prepares for making locking more fine-grained, see issue #1250.
Adds value conversion tables to perform lazy computations of lookup tables for mapping from a uint16 value to a float in [`lower_bound`, `upper_bound`].
Owners of the value conversion tables are `SubmapController`, `PoseGraph2D`, `ActiveSubmaps` and `ProbabilityGridPointsProcessor`. For concurrency reasons, having only a single owner is not possible.
Follow up PR in `cartographer_ros` is prepared.
The first submap is now created with first call to `ActiveSubmaps:InsertRangeData`.
Originally the first submap was created at the origin. Creating the first submap with the first range data insertion allows to align the first submap with the gravity estimate of the first scan. This change makes the interface of ActiveSubmaps most consistent, as `ActiveSubmaps::submaps()` will return the correct active submaps after insertion.
The change affects the result of cartographer. The results were verified and provide the same quality as current master.
Unwrap the logic to dispatch optimization and the deferred
logic to create the work queue (when kicked off in foreground)
to happen in AddWorkItem() and HandleWorkQueue().
The work items will instead return whether they need optimization
to be dispatched or not.
This adds a .clang-format file, so that git clang-format uses
Google style without the need to remember the commandline flag.
Moreover, this ensures correct formatting if the Cartographer
code is in a subtree of a repo.
[PR 946](https://github.com/googlecartographer/cartographer/pull/946) introduced metrics in local trajectory builder. The accumulation duration was measured from accumulation_start to accumulation_stop.
This PR changes this to measure the entire time elapsed between two accumulations (i.e. from accumulation_stop to the next accumulation_stop).
Mostly the two measurements result in roughly the same, with the new way measuring slightly larger durations, as expected. But occasionally the measurements differ significantly. This is probably due to a lock contention somewhere outside of what was measured previously. Since we are interested in real time metrics, we need to track the entire time passed.
Extracted the ScanMatch method in the LocalTrajectoryBuilder3D.
This is a short refactoring. With that change, the code of LocalTrajectoryBuilder3D resembles LocalTrajectoryBuilder2D more. (see LocalTrajectoryBuilder2D::ScanMatch)
Removed redundant adaptive voxel fitering in trajectory builder 2d.
Adaptive voxel filtering of the lidar point cloud was performed in InsertIntoSubmap and ScanMatch. Both methods are called from AddAccumulatedRangeData. Now, adaptive voxel filtering is done only once in AddAccumulatedRangeData and the filtered point cloud is then forwarded to InsertIntoSubmap and ScanMatch.
Fixed unintentional casting of high_resolution_max_range from double to int, to float
In SubmapsOptions3D the parameter "high_resolution_max_range" is defined as double. In the code it gets casted to int when calling Submap3D::InsertRangeData and to float when calling FilterRangeDataByMaxRange.
Adds a parameter for the currently hard coded `kSubmapsToKeep` in `pure_localization` mode.
The new parameter `max_submaps_with_pure_localization` allows to specify the history size of submaps in `pure_localization` mode.
Closes#1116
Previously, NodeId and SubmapId could be (partially) uninitialized,
for instance like this:
```
NodeId node_id;
SubmapId submap{0}; // uninitialized submap_index
```
This introduces constructors to prevent this.
Add the parameter `OptimizationProblemOptions.use_online_imu_extrinsincs_in_3d`. Set it to true by default to not change existing behavior.
Using online IMU extrinsics is not always desirable, and particularly during localization, we have determined that it is preferable to turn this feature off.
Extract ground truth generation from `autogenerate_ground_truth_main.cc` into a library function in `ground_truth.h/cc`, so it can be reused outside that binary.
Tested with Cartographer ROS.
`cartographer_autogenerate_ground_truth -pose_graph_filename=/home/afleck/Downloads/b3-2016-04-05-15-51-36.bag.pbstream -output_filename=/home/afleck/Downloads/ground_truth.pb`
still runs as before.
* update TrajectoryState of trajectories that got 'trimmed' away to be
deleted in the PureLocalizationTrimmer
* update serialization to only serialize 'undeleted' trajectories and
corresponding options.
#1111
- Adds TSDF2D Grid
- Adds tests for TSDF2D Grid
- Introduces Grid2D::GrowLimits(...) for multiple grids to reduce code duplication between TSDF2D and Grid2D
The probability grid points processor can now be configured to write the probability grid as pbstream. Before it was only possible to write the probability grid as png.
Fixing "Optimizing: -nan%... #846" https://github.com/googlecartographer/cartographer/issues/846.
The issue was triggered in a multithreaded execution, when all nodes were processed, but the working queue was still non empty (having other kind of jobs).
Unfortunately I failed to reproduce the bug in tests, so no new tests were added.
* New serialization protos
* Moved old definition to legacy_serialized_data.proto
* defining new serialization format as oneof.
* Changing to legacy datatype
* adding serialization migration
* moving to io
* adding serialization migration
* moving to io
* adding file for test
* adding test
* test for order or migrated serialized data
* test for order or migrated serialized data
* renaming tool
* addressing comments
* addressing more comments
* minor polishing
to allow setting the GlobalSlamOptimizationCallback after MapBuilder and PoseGraph
creation. Also removes the GlobalSlamOptimizationCallback from the Constructor
since it is not used.
Prerequisite for implementing ReceiveGlobalSlamOptimizations() in gRPC MapBuilderInterface.
- adds `covered_distance` to the ground truth relations
- the flags `write_relation_metrics` and `relation_metrics_filename` control whether and where to write the relations metrics as comma-separated values
Making getters and non-modifying methods in PoseGraph* const.
Before most getters where marked non-const because of the need to acquire the mutex for thread safety. This forces all code using the PoseGraph to pass it around as a non-const object even if the consumer is not altering the object.
By making the mutexes mutable we can make getters and methods that do not change the PoseGraph const and thus enable consumer APIs to express how they are going to use the PoseGraph as well.
fixes#1021
Added fake filer writer which writes the output to a string instead of a file.
This will help writing tests for classes that use the file writer interface to write data.
- Introduce `RangeDataInserterInterface` as common interface for all range data inserters
- Introduce a minimal `GridInterface` as a base for a common interface for 2D and 3D grids
- Rename `RangeDataInserter2D` to `ProbabilityGridRangeDataInserter2D`
- Move grid generation logic from `Submap2D` to `ActiveSubmaps2D`
- Update proto and configuration structure to mirror the code structure - backwards compatibility is maintained
- Step towards [RFC 0019](https://github.com/googlecartographer/rfcs/blob/master/text/0019-probability-grid-and-submap2d-restructuring.md)
This introduces scheduling of tasks with dependencies to ThreadPool.
Contrary to work items, tasks are only queued for execution after all
their dependencies have completed.
This introduces the new class common::Task. A Task can have dependencies to other tasks, notify ThreadPoolInterface when all its dependencies are fulfilled, and can be executed in the background.
Since it is only the tests in cartographer/cloud that cannot run
concurrently with each other, use `tags = ["exclusive"]` to say that
they should not be run at the same time as other tests.
This works locally, not just in CI, and should speed up the CI job by
2-3 minutes.
- Base `ConstraintBuilder2D` and `FastCorrelativeScanMatcher2D` on correspondence cost function instead of probabilities
- No changes in the options of `ConstraintBuilder2D` and `FastCorrelativeScanMatcher2D`
- Add properties `min/max_correspondence_cost` to `Grid2D` and `proto::Grid2D`
- Provide backwards compatibility for `proto::Grid2D`
- Step towards [RFC 0019](https://github.com/googlecartographer/rfcs/blob/master/text/0019-probability-grid-and-submap2d-restructuring.md)