Commit Graph

757 Commits (926b8540f696c73c33e9bee69d22ee835a478b2f)

Author SHA1 Message Date
Kevin Daun 5abd413310 Add value conversion tables (#1255)
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.
2018-07-12 22:11:55 +02:00
Alexander Belyaev c4c5fab5b2 [GenericPoseGraph] Add a base class for all nodes and Pose2D node. (#1265) 2018-07-12 15:21:59 +02:00
Susanne Pielawa 151a78d7be Added TODO for multi-trajectory case. (#1269) 2018-07-12 14:25:00 +02:00
Christoph Schütte 1b88fb8e90 Introduce client_id in SensorMetadata (#1257) 2018-07-12 00:21:31 +02:00
Wolfgang Hess 5ad2088561 Get rid of std::bind. (#1261)
`std::bind` is bug prone and should be avoided.
Lambdas are a more general and safer replacement.
2018-07-11 20:18:09 +02:00
Martin Schwörer a905036a00 Create first submap with first scan (#1253)
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.
2018-07-11 19:44:37 +02:00
Alexander Belyaev 288328ef14 [GenericPoseGraph] Add protos for nodes/constraints. (#1258)
Does not cover all constraints yet.
2018-07-11 18:06:28 +02:00
danielsievers 9f1039221c Refactor PoseGraph work queue optimization dispatching (#1252)
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.
2018-07-11 17:33:41 +02:00
Kevin Daun bb380ae947 Make kSqrtTwoPi const. (#1259) 2018-07-11 13:02:11 +02:00
Wolfgang Hess 88850ec2d7 Add .clang-format file. (#1249)
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.
2018-07-11 12:28:53 +02:00
Christoph Schütte 35abfccc6b Introduce client_id in cartographer grpc (#1241) 2018-07-10 20:41:00 +02:00
Susanne Pielawa 120c216c47 Measure accumulation_duration from last accumulation stop (#1251)
[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.
2018-07-10 16:24:57 +02:00
Susanne Pielawa a04b6cbc48 use common::ToSeconds in local_trajectory_builder and rate_timer.h (#1248)
use the new overload of ToSeconds (introduced in 
[PR1244](https://github.com/googlecartographer/cartographer/pull/1244/files)) in local_trajectory_builder.
2018-07-10 13:14:54 +02:00
Wolfgang Hess afa3ba5336 Fix the name of real_time_correlative metric in 2D. (#1247)
This was called fast_correlative before, but the metric was about
the score of the real-time correlative scan matcher in local SLAM.
2018-07-10 10:53:23 +02:00
Martin Schwörer 1fed98727d extracted ScanMatch method in LocalTrajectoryBuilder3D (#1245)
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)
2018-07-10 10:19:25 +02:00
Susanne Pielawa 3ee7c6710f Adding metrics (#1240)
to measure fraction of sensor time that is taken up by voxel filter, scan matcher, and inserting into submap.
2018-07-09 21:20:58 +02:00
Martin Schwörer aa3ac7e837 Removed redundant 2d voxel filtering (#1243)
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.
2018-07-09 20:45:55 +02:00
Arno Fleck 9e54a981c6 Introduce common::ToSeconds for std::chrono::steady_clock::duration. (#1244)
Introduce a new overload of ToSeconds for std::chrono::steady_clock and use it for the work queue delay metric.
2018-07-09 20:13:17 +02:00
Michael Grupp eff103f663 Ignore initial poses on gRPC server side. (#1234)
Fixes a crash if a client initializes with an initial pose inside a frozen map
that isn't known to the server.
2018-07-09 15:03:40 +02:00
Kevin Daun 7dfe404278 Add TSDF RangeDataInserter (#1236)
Adds TSDF RangeDataInserter, tests and integrates the configuration files.
2018-07-09 13:46:46 +02:00
Arno Fleck 8b2c755a13 Remove "_internal" from the metric family names. (#1237)
As discussed and requested in #1218, this PR removes the substring "_internal" from all the metric family names.
2018-07-07 00:20:20 +02:00
Martin Schwörer 044f53735c removed unused member matching_submap_index (ActiveSubmaps3D,ActiveSubmaps2D) (#1238)
Removed the unused member matching_submap_index of ActiveSubmaps3D and ActiveSubmaps2D.
Adjusted the test accordingly.
2018-07-06 11:48:25 +02:00
Martin Schwörer 902459e95c fixed casting of high_resolution_max_range (SubmapsOptions3D) (#1239)
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.
2018-07-06 11:02:38 +02:00
Arno Fleck 627ebb39b9 Add function to get the work queue delay from PoseGraph. (#1218) 2018-07-06 09:40:44 +02:00
Christoph Schütte bad8c96bc6
Add token_file_path parameter and enable auth (#1235) 2018-07-05 13:14:11 +02:00
Kevin Daun cc9fc75757 Separate raycast and grid update (#1216)
Separate raycast and grid update logic.
Rename raycast to ray_to_pixel_mask.
2018-07-03 19:51:39 +02:00
Wolfgang Hess d2f3c1ea31 Fix the local SLAM latency metric. (#1231)
Before, the metric was in integer seconds and since measurements
are usually quite small, it was mostly outputting 0.
2018-07-03 16:35:58 +02:00
Alexander Belyaev ddce76d9fb Make old pbstreams compatible with the new pure_localization_trimmer options. (#1230) 2018-07-03 14:27:38 +02:00
Alexander Belyaev ffb5034390 Mark TSDF::ToProto with override. (#1227) 2018-07-03 12:46:30 +02:00
Alexander Belyaev 0a253d24f6 Remove unnecessary std::move. (#1228) 2018-07-03 10:56:33 +02:00
Alexander Belyaev 3540996e91
Add options to (not)collate fixed-frame/landmarks data. (#1224) 2018-07-02 21:49:00 +02:00
Alexander Reimann 0981620d8f Add max_submaps_with_pure_localization parameter (#1141)
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
2018-07-02 20:32:23 +02:00
gaschler d5ed8a9ded Add further tests for MapById (#1226)
Adds tests for MapById for the cases: empty MapById, invalid trajectory_id, deleting all entries for a trajectory.
2018-07-02 19:37:44 +02:00
gaschler 7839f3f216 Avoid uninitialized NodeId, SubmapId (#1223)
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.
2018-07-02 14:51:48 +02:00
Arno Fleck 7fcc4576a8 Add use_online_imu_extrinsics_in_3d parameter and set it to true by default. (#1217)
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.
2018-07-02 13:40:21 +02:00
gaschler 22ea782fad
Handle invalid requests. (#1222)
FIXES=#1221
2018-07-02 13:05:28 +02:00
Arno Fleck eed07d2f80 Extract ground truth generation into a library. (#1215)
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.
2018-06-29 12:48:29 +02:00
Kevin Daun b4594bcdbd Add Normal Estimation (#1213)
Adds Normal Estimation needed for TSDF RangeDataInserter.
2018-06-26 14:22:16 +02:00
Sebastian Klose 2bd987ffb4 Fix serialization for deleted trajectories. (#1214)
* 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
2018-06-26 13:36:42 +02:00
Kevin Daun 15ecb88a92 Add TSDF2D Grid (#1209)
- Adds TSDF2D Grid
- Adds tests for TSDF2D Grid
- Introduces Grid2D::GrowLimits(...) for multiple grids to reduce code duplication between TSDF2D and Grid2D
2018-06-25 11:40:12 +02:00
gaschler 41b642d92b check trajectory remapping in test (#1208) 2018-06-20 13:55:09 +02:00
gaschler 5e96bfaeea
Endpoints for GetTrajectoryStates (#1206)
[RFC=0023](https://github.com/googlecartographer/rfcs/blob/master/text/0023-delete-load.md)
2018-06-20 12:30:56 +02:00
gaschler 984553ee15 LoadState(FromFile) endpoints (#1203)
[RFC=0023](https://github.com/googlecartographer/rfcs/blob/master/text/0023-delete-load.md)
2018-06-19 18:01:39 +02:00
gaschler c249a9901d Endpoints for DeleteTrajectory (#1207)
[RFC=0023](https://github.com/googlecartographer/rfcs/blob/master/text/0023-delete-load.md)
2018-06-19 16:59:17 +02:00
Kevin Daun d36cbc39b8 Truncated Signed Distance Value Converter (#1204)
Introduces conversions between float and uint16 representations for truncated signed distance values and weights.
2018-06-19 16:19:46 +02:00
gaschler 4c5e6dc0fb Remove ChannelArguments (#1198)
This was introduced by #1179 but seems unused.
2018-06-19 14:16:30 +02:00
gaschler 54041d76eb DeleteTrajectory (#1205)
[RFC=0023](https://github.com/googlecartographer/rfcs/blob/master/text/0023-delete-load.md)
2018-06-19 13:41:55 +02:00
Kevin Daun ecaa95f3b0 Move occupied space cost function to .cc (#1200) 2018-06-19 12:31:11 +02:00
gaschler a9045fa375
Introduce TrajectoryState (#1201)
[RFC=0023](https://github.com/googlecartographer/rfcs/blob/master/text/0023-delete-load.md)
2018-06-19 11:48:09 +02:00
gaschler 5d26742bfa
LoadStateFromFile (#1202)
[RFC=0023](https://github.com/googlecartographer/rfcs/blob/master/text/0023-delete-load.md)
2018-06-19 11:00:41 +02:00
Christoph Schütte 42c1288e66 Add LoadState() test case to ClientServerTest. (#1189) 2018-06-15 14:31:18 +02:00
gaschler 849f2a66ac clarify comment (#1196) 2018-06-15 13:06:02 +02:00
Wolfgang Hess 0e25fafc47 Fixes display of IMU correction angle. (#1193)
When the 'imu_calibration' quaternion has a negative real part,
correction angles above 180 degrees were displayed. This fixes
the issue.
2018-06-12 17:10:19 +02:00
gaschler de22b9c311 Rename to TrimSubmap (#1192)
Trimmable::MarkSubmapAsTrimmed was incorrectly named and commented.
It really trims the submap.
2018-06-12 16:01:14 +02:00
gaschler f79c6afee7 Rename namespace to testing (#1191)
We commonly use the namespace testing for test helpers,
so rename similar namespaces to "testing" for consistency.
2018-06-12 15:18:20 +02:00
gaschler 29f6ea9ea3 Test LoadState and pure localization (#1190) 2018-06-12 12:49:07 +02:00
Alexander Belyaev 5055703490
Use PoseGraphData in PoseGraph3d. (#1188)
[RFC](https://github.com/googlecartographer/rfcs/blob/master/text/0022-pose-graph-data.md)
2018-06-08 14:40:24 +02:00
Alexander Belyaev 3437b931dd
Introduce PoseGraphModel and use it in 2D. (#1185)
[RFC](https://github.com/googlecartographer/rfcs/blob/master/text/0022-pose-graph-data.md)
2018-06-08 11:52:08 +02:00
Martin Schwörer e8b211f674 Writing probability grid as proto with probability grid points processor (#1069)
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.
2018-06-06 16:11:37 +02:00
sotnik-github 3f0bb0eec5 Fixing 846 without tests. (#1183)
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.
2018-06-06 15:38:10 +02:00
Alexander Belyaev 4ef38497a9
Skip the Collator for the landmark data. (#1184) 2018-06-06 14:14:01 +02:00
Christoph Schütte f83ba3db2f Fix LoadState gRPC (#1179) 2018-06-04 11:11:28 +02:00
Sebastian Klose 000b967c79 adding LOG output to migration tool (#1180)
Adding some log-feedback to the serialization migration tool.
2018-06-04 09:35:37 +02:00
Sebastian Klose 73d18e5fc5 Using new serialization format. (#1174)
Updates everyone to use the new serialization format.

A corresponding PR will be made in cartographer_ros for the various tools.
2018-05-30 13:31:33 +02:00
Alexander Belyaev 87370371ec
Making a test nicer: procrastination and nits. (#1175) 2018-05-30 12:56:59 +02:00
Christoph Schütte 876a41f06f
Provide local poses via GetTrajectoryNodePoses() (#1172) 2018-05-30 07:34:49 +02:00
Sebastian Klose a35092c20f Mapping state deserializer (#1171)
class for de-serializing mapping state stored in the new serialization format [RFC 0021](https://github.com/sebastianklose/rfcs/blob/serialization_format/text/0021-serialization-format.md).

Not used yet. Will be hooked up in a separate PR that switches all logic to the new serialization format at once.
2018-05-29 22:10:11 +02:00
Christoph Schütte fbb2835525
Implement receive_global_slam_optimizations_handler (#1169) 2018-05-29 19:26:33 +02:00
Sebastian Klose a9c90da1a8
Migration tool for serialization format (#1167)
* 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
2018-05-29 16:56:18 +02:00
Sebastian Klose 1d050ede3f Mapping state serialization (#1166)
[Serialization RFC](https://github.com/googlecartographer/rfcs/blob/master/text/0021-serialization-format.md)
2018-05-28 23:49:21 +02:00
Sebastian Klose 405c0e17e8 Defining new serialization proto (#1165)
[Serialization RFC](https://github.com/googlecartographer/rfcs/blob/master/text/0021-serialization-format.md)
2018-05-28 15:11:29 +02:00
Christoph Schütte ce18ec7295 Add SetGlobalSlamOptimizationCallback() (#1164)
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.
2018-05-25 12:29:52 +02:00
Alexander Belyaev 2f9ee597d0
Add analytical 2d cost function for pose graph (not used yet). (#1161) 2018-05-23 12:07:27 +02:00
Kevin Daun f4c4d2ad40 Add CSV export to the evaluation tool (#1159)
- 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
2018-05-17 12:14:03 +02:00
Sebastian Klose d419fe8fd7
More const PoseGraph interface (#1156)
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
2018-05-17 09:30:40 +02:00
Robert Milijaš a0ec8046bd Allow easier access to CeresPose's data_ (#1149)
Introduce a FromPose function which transforms a Ridig3d pose into the
CeresPose's Data format.
2018-05-15 22:32:03 +02:00
Christoph Schütte ee8e2fa4d6 Introduces a lockless queue for multiple producers and a single consumer (#1152) 2018-05-11 21:14:18 +02:00
Christoph Schütte ce67d684ba
Introduce a GlobalSlamResultCallback (#1143) 2018-05-10 11:25:00 +02:00
Sebastian Klose c2f54b8df2
Organize all protos in mapping in a single folder. (#1147) 2018-05-09 11:22:07 +02:00
gaschler 697d6091cd Test ThreadPool more (#1136)
These tests previously helped to reproduce Mutex issue #1124.
2018-05-03 21:50:50 +02:00
gaschler 3ca6506bc7 Remove old ThreadPool::Schedule (#1139) 2018-05-03 20:58:51 +02:00
Christoph Schütte e080df5ea3 Register MapBuilderServer metrics (#1133)
I am not adding these registration calls to `cartographer/metrics/register.cc` because they are specific to cloud based mapping.
2018-05-01 17:18:34 +02:00
Alexander Belyaev ff18bae528 Transform submap cells to global frame correctly. (#1130) 2018-04-30 12:12:48 +02:00
gaschler a3b746ff67 Use Task in ConstraintBuilder3D (#1119) 2018-04-27 22:14:19 +02:00
gaschler a32cfd247b Pessimist ~Locker (#1125)
FIXES=#1124
2018-04-27 20:41:13 +02:00
Martin Schwörer fe7aaf4d94 Added a fake file writer (writes to string instead of file) (#1101)
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.
2018-04-27 13:45:54 +02:00
gaschler c46fe073b4 Use Task in ConstraintBuilder2D (#1118) 2018-04-26 12:33:36 +02:00
Christoph Schütte 666095cb41 Introduce metric to measure the length of the SLAM queue (#1117) 2018-04-25 22:09:56 +02:00
Christoph Schütte 5356bdf9a8 Rename metrics since slashes are not allowed in Prometheus (#1115) 2018-04-25 17:34:30 +02:00
Kevin Daun 41f17e57cd Introduce Grid and RangeDataInserter (#1108)
- 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)
2018-04-25 16:51:30 +02:00
gaschler 91fda93757 Schedule Task in ThreadPool (#1113)
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.
2018-04-25 16:12:30 +02:00
gaschler 89ac5cbabf
Test GlobalSlam3D (#1114) 2018-04-25 15:00:13 +02:00
gaschler 0118531659
correct bazel define (#1112)
This is required by map_builder_server_main.cc
2018-04-25 13:56:34 +02:00
Michael Grupp 3d2ca564b6 Fix some Clang warnings. (#1109)
task.cc: -Wparentheses
task_test.cc: -Winconsistent-missing-override
2018-04-25 12:22:11 +02:00
Martin Schwörer d9ada58710 Removed check for existence of first submap of first trajectory in pose graph optimization (#1099)
Removed check for existence of first submap of first trajectory.

This check is equivalent to the original implementation which got changed in [#584](https://github.com/googlecartographer/cartographer/pull/584/files)
2018-04-24 16:32:31 +02:00
Christoph Schütte f51e4f4f05 Introduce Task (#1066)
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.
2018-04-24 15:57:44 +02:00
Alexander Belyaev 3dd37da51b
Move constraint_builders together. (#1103) 2018-04-23 13:49:25 +02:00
gaschler 3b5830745e Test ConstraintBuilder2D/3D (#1100) 2018-04-23 12:52:20 +02:00
Kevin Daun d29153a744 Replace ProbabilityGrid in Submap2D by Grid2D (#1097) 2018-04-20 22:58:46 +02:00
Alexander Belyaev e2623991da Return only optimized & finished submaps for trimmer. (#1104) 2018-04-20 22:19:16 +02:00