Commit Graph

838 Commits (d7b4656741bbf99f922c5ea7dddf15a1a74aec0f)

Author SHA1 Message Date
Juraj Oršulić 73c3d477d7 Introduce [Timed]RangefinderPoint. (#1357) 2018-08-10 22:36:37 +02:00
Alexander Belyaev b6b41e9b17
[GenericPoseGraph] Add a macro to find nodes. (#1382) 2018-08-10 18:55:43 +02:00
gaschler 3877f97b23
Bump async_grpc (#1380)
Specify timeouts where RetryStrategy is used.
2018-08-10 09:30:54 +02:00
Rodrigo Queiro 8d0457d1d8 Move tools/bazel.rc to prepare for bazel 0.17 (#1375)
* Move tools/bazel.rc to prepare for bazel 0.17

Bazel 0.17 will no longer import the legacy "tools/bazel.rc" config
file. This change ensures compatibility with the new versions.

For users on bazel 0.16 and earlier who have a ~/.bazelrc, this change
will cause bazel to ignore their ~/.bazelrc and load this one instead.
Hopefully this won't break anyone. (famous last words)
2018-08-09 17:08:38 +02:00
Michael Grupp 4d6120d2cb Use Huber loss for landmark cost functions. (#1377) 2018-08-09 10:30:41 +02:00
Alexander Belyaev d5840e960a [GenericPoseGraph] Move functions that add param blocks to constraint_utils. (#1374)
Also call `ceres_loss()` instead of passing `nullptr`.
2018-08-07 14:48:39 +02:00
Alexander Belyaev 6274fc1558 [ABSL] Use absl::Substitute in rigid_transform debug messages. (#1373)
it is at least readable.
2018-08-07 12:50:37 +02:00
Alexander Belyaev 8d5bf2a5dd
[ABSL] Purge common/mutex.h. (#1369) 2018-08-07 10:43:38 +02:00
gaschler 54f7f4f969 Skip constraint search against unfinished submaps. (#1362)
The uplink server only receives the grid content of a submap after
that submap is finished for efficiency. Therefore, constraint
searches against that submap need to be skipped.
Also add checks to avoid this in the future.

FIXES=#1360
2018-08-06 17:34:40 +02:00
Christoph Schütte 3f3428e8d4 Remove noisy loggin from AddSensorDataBatchHandler (#1366)
See discussion in https://github.com/googlecartographer/cartographer/pull/1338
2018-08-03 14:10:52 +02:00
Kevin Daun 77886cb53b Integrate TSDF components into SLAM pipeline. (#1361)
[RFC=0019](https://github.com/googlecartographer/rfcs/blob/master/text/0019-probability-grid-and-submap2d-restructuring.md)
2018-08-03 11:56:35 +02:00
Arno Fleck 12e11856af Use absl::Mutex instead of custom implementation (#1356)
Makes `common::Mutex` an alias for `absl::Mutex` and replaces the logic inside `common::MutexLocker` with `absl::MutexLock`.

A future PR can then remove these classes entirely and replace references to it across the Cartographer code base with the Abseil classes directly.
2018-08-03 11:15:50 +02:00
Michael Grupp b841ebf170 Fix typo in last commit (negate condition). (#1365) 2018-08-02 20:59:23 +02:00
Michael Grupp 4cd1528ffb Replace CHECK() by a warning in MapBuilderStub::SerializeState() (#1364)
See discussion in https://github.com/googlecartographer/cartographer_ros/pull/966
2018-08-02 19:35:19 +02:00
Kevin Daun 748deb910a Add TSDF match cost function. (#1359) 2018-08-01 23:46:33 +02:00
Kevin Daun 6c070acff5 Introduce GridType for Grid2D (#1355) 2018-07-31 15:13:37 +02:00
gaschler c1fbb6bb07
Fill submaps slices (#1353)
This implements a frequently used function (two times in cartographer_ros).
Also, it corrects a wrong repeated proto field access,
so we can fix cartographer_ros/issues/944.
2018-07-31 11:48:04 +02:00
Julius Kammerl c041635fb5 Add sensor counter metrics to TrajectoryCollator class (#1342)
Adds metrics to monitor the incoming sensor messages processed by the TrajectoryCollator class.
2018-07-31 10:06:54 +02:00
Julius Kammerl 537b2d6762 Add metric counters to track sensor data in the AddSensorDataBatchHandler class (#1338)
Adds additional metrics to track incoming sensor and local slam result data in Prometheus.
2018-07-30 19:42:08 +02:00
Christoph Schütte a3c9e9f1ca Add argument to SerializeState for excluding unfinished submaps (#1352)
Adds a boolean argument to MapBuilderInterface::SerializeState() to indicate whether the caller wants to include unfinished submaps in the serialized state.

For cartographer_grpc this argument will be set to false since unfinished submaps do not have a Grid which would lead to a crash in the Submap::ToProto() function.
2018-07-30 17:27:54 +02:00
Alexander Belyaev 5c61148f26 [ABSL] Remove common/optional.h. (#1349) 2018-07-30 13:44:55 +02:00
Alexander Belyaev 3c5f2cd154
[GenericPoseGraph] Add PoseGraphController. (#1335) 2018-07-27 20:35:27 +02:00
Alexander Belyaev 5b44305ea3
[ABSL] Purge common::make_unique. (#1340) 2018-07-27 19:43:35 +02:00
Alexander Belyaev 4990d4d5e9
[ABSL] Purge common::optional. (#1339) 2018-07-27 19:05:45 +02:00
Christoph Schütte dafb4149ed Revert: Fix writing state of trajectories with unfinished submaps. #1286 (#1346)
Reason: Break rviz visualization for submaps loaded from pbstreams.
2018-07-27 17:20:42 +02:00
Martin Schwörer 3af5086dc7 removed redundant condition (#1344)
Removes an additional condition that is not required.
2018-07-27 13:45:59 +02:00
Wolfgang Hess 8b329efc8e Don't process PoseGraph2D work items in foreground. (#1341)
This is #1285 for 2D.
Fixes #1250.
2018-07-26 17:05:23 +02:00
Alexander Belyaev c2c341397f [GenericPoseGraph] Add InterpolatedRelativePose2D constraint. (#1337) 2018-07-26 15:00:13 +02:00
Wolfgang Hess e87100a3ad Introduce separate mutex for PoseGraph2D work queue access. (#1333)
This is #1284 for 2D.
2018-07-26 11:15:56 +02:00
Arno Fleck 9a2df068ed Check for collated_fixed_frame_ for AddSensorData(FixedFramePoseData). (#1331)
PR #1224 introduced checks for `collate_landmarks` and `collate_fixed_frame` in the `CollatedTrajectoryBuilder`. However, it falsely checks for `collate_landmarks` in the `AddSensorData(FixedFramePoseData)` function. This PR fixes that.
2018-07-26 10:36:17 +02:00
Alexander Belyaev e3a7f39889
Add absl to CMake and Bazel builds. (#1301) 2018-07-26 06:49:37 +02:00
Wolfgang Hess f61a944938 Fine-grained locking for PoseGraph2D constraints. (#1327)
This is #1279 for 2D.
2018-07-25 15:26:29 +02:00
Michael Grupp 4ba9d9168b Migrate pbstream files with old probability grid format. (#1314) 2018-07-25 13:06:58 +02:00
Arno Fleck 52804df988 Remove warning at the beginning of localization. (#1329)
* Remove warning.

* Remove warning from 2D as well.
2018-07-25 11:02:52 +02:00
Sebastian Klose 2b042311d8
Unified pbstream tool (#1326)
Consolidating pbstream tools into a single tool

* adds two subcommands for now (info and migrate)
* removes commandline flags for filenames in favor of commandline args
* updates documentation for migration tool
2018-07-24 15:48:34 +02:00
Martin Bokeloh 8219117a17
[GenericPoseGraph] Add serialization tests for constraints. (#1318)
* [GenericPoseGraph] Add rotation 3d constraint.

* [GenericPoseGraph] Add serialization tests for constraints.

* Remove files from other branch

* Updated include paths.
2018-07-24 14:32:38 +02:00
Martin Bokeloh f7b3d34ae5
[GenericPoseGraph] Add interpolated constraint/cost 3d. (#1325)
* [GenericPoseGraph] Add interpolated rotation constraint/cost 3d.

* Rename tests

* Update include paths.
2018-07-24 13:24:11 +02:00
Alexander Belyaev d4193d4a2a
[GenericPoseGraph] Add acceleration constraint. (#1319) 2018-07-24 06:36:24 +02:00
Alexander Belyaev 8250264441
Move test_helpers to testing/. (#1321) 2018-07-23 21:18:32 +02:00
Martin Schwörer a42fd47146 Preparation for #1277: refactor rotation scan matcher (#1316)
Added new constructor for `RotationalScanMatcher` and exposed `RotateHistogram`.

This PR prepares for PR #1277 where the constructor 
`RotationalScanMatcher(const std::vector<std::pair<Eigen::VectorXf, float>>& histograms_at_angles)`
will be removed and only the new constructor
`RotationalScanMatcher(const Eigen::VectorXf& histogram)`
will remain. The unit tests will be updated to use the new constructor in #1277.
2018-07-23 19:02:17 +02:00
Susanne Pielawa 25f79cb6eb Added metrics RealTimeRatio and CpuRealTimeRatio to 2d. (#1324)
Added the metrics RealTimeRatio and CpuRealTimeRatio also to local_trajectory_builder_2d.

This is similar to[ PR 1275](https://github.com/googlecartographer/cartographer/pull/1275) and resolves a TODO.
2018-07-23 18:23:41 +02:00
Martin Schwörer fc78288ef8 remove duplicate code for deserialization of Submap3D from proto (#1322)
This PR removes the duplicate code for deserialization/updating Submap3Ds from a proto.
2018-07-23 17:38:48 +02:00
gaschler 33fcc1a3de
Set client_id in LoadState(FromFile) (#1320) 2018-07-23 16:42:44 +02:00
Juraj Oršulić 5b35641881 Small readability improvement (#1304) 2018-07-23 16:21:45 +02:00
Martin Bokeloh 29420b1912
[GenericPoseGraph] Remove unused declarations. (#1323) 2018-07-23 15:10:16 +02:00
Martin Bokeloh bc8a7d7c00
[GenericPoseGraph] Add rotation 3d constraint. (#1317) 2018-07-23 13:43:26 +02:00
gaschler d306eaddda Add pbstream_info executable (#1311)
This is useful to debug and inspect serialized files.
2018-07-23 11:34:37 +02:00
Alexander Belyaev 681cff0435
[GenericPoseGraph] Add proto defs for landmark cost functions. (#1312) 2018-07-22 13:36:25 +02:00
Martin Bokeloh 3a9d1bc465
[GenericPoseGraph] Added rotation cost 3d. (#1313) 2018-07-20 17:45:41 +02:00
Martin Bokeloh bb80d78293
[GenericPoseGraph] Add relative pose constraint 3d. (#1309) 2018-07-20 16:34:27 +02:00
Martin Schwörer f1ac896729 Return the proto from Submap::ToProto instead of passing pointer. (#1294)
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.
2018-07-20 15:16:44 +02:00
danielsievers 2de0e5f04b Don't process PoseGraph3D work items in foreground (#1285)
This helps the foreground thread in keeping up real time.
Also see issue #1250.
2018-07-20 14:41:57 +02:00
Wolfgang Hess 5077224f8e Take PoseGraph2D mutex inside instead of outside work item. (#1310)
This is #1264 for 2D.
2018-07-20 13:31:18 +02:00
Alexander Belyaev 665b95d5c6 [GenericPoseGraph] Add a loss function. (#1308) 2018-07-20 12:50:29 +02:00
Alexander Belyaev 1b455e57e5 [GenericPoseGraph] Use GradientChecker to check gradients (Ba-Dum-Tss). (#1306)
Ba-Dum-Tss!
2018-07-20 10:55:05 +02:00
Alexander Belyaev c473a65a5e Move FindOrNull to common/utils.h. (#1305) 2018-07-20 10:07:45 +02:00
Alexander Belyaev 42d7133a2b
[GenericPoseGraph] Move ParseProto and Near to test_helpers.h (#1307) 2018-07-20 09:30:03 +02:00
Christoph Schütte 7fa11dcde6 Implement recovery behavior for LocalTrajectoryUploader (#1287) 2018-07-20 00:09:44 +02:00
Michael Grupp 5911181849 Fix usage message of map_builder_server_main.cc (#1302) 2018-07-19 22:46:44 +02:00
Martin Bokeloh 5fdb705ea5
[GenericPoseGraph] Added relative pose cost 3d. (#1303)
* [GenericPoseGraph] Added relative pose cost 3d.

* Added another case to the test.

* Removed ceres function from cost function.

* Ran clang-format.

* Minor renaming.
2018-07-19 16:35:27 +02:00
Alexander Belyaev a60b3e2d2d
[GenericPoseGraph] Add CeresOptimizer. (#1300) 2018-07-19 12:41:14 +02:00
Alexander Belyaev df337194e2
[GenericPoseGraph] Add RelativePoseConstraint2D. (#1297) 2018-07-19 09:17:22 +02:00
gaschler ce7f33f97a Fix LoadState trajectory options access (#1298)
FIXES=#1296
2018-07-18 17:08:00 +02:00
Alexander Belyaev 0ab591aa01 [GenericPoseGraph] Add RelativePoseCost2D. (#1295)
This is the implementation of the ceres::CostFunction that uses the new proto definition. It is tested using the Autodiff version.
2018-07-18 15:58:33 +02:00
Martin Schwörer ce9c567e3c No re-use of trajectory node proto in SerializeTrajectoryNodes (#1293)
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.
2018-07-18 12:22:00 +02:00
Christoph Schütte 0668411d6f Deflake destruction and test grpc SerializeState (#1291)
This PR also removes various checks in ThreadPool which ensures that the ThreadPool task queue runs to completion before the destructor returns.
2018-07-18 10:18:08 +02:00
Alexander Belyaev 05a8314a23
Fix Clang warnings. (#1292) 2018-07-18 09:17:39 +02:00
Alexander Belyaev 89f0c45de8
[GenericPoseGraph] Add a NodeId struct. (#1290) 2018-07-17 17:40:49 +02:00
Steve Wolter 6c31420b97 Log status of failed RPCs in PoseGraphStub. (#1288)
Log status of failed RPCs in PoseGraphStub.

This improves the usefulness of error messages in the log.
2018-07-17 13:38:37 +02:00
Christoph Schütte 0ee06ba561
Fix writing state of trajectories with unfinished submaps. (#1286) 2018-07-17 08:39:50 +02:00
danielsievers 482f912d95 Introduce separate mutex for PoseGraph3D work queue access (#1284)
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.
2018-07-16 17:15:28 +02:00
Alexander Belyaev 31d0a6acc7 [GenericPoseGraph] Add IMU Calibration and Pose3D node types. (#1278) 2018-07-16 11:07:37 +02:00
Juraj Oršulić ad572336d4 Include <array> in pose_graph/node.h and pose_2d.h (#1280) 2018-07-16 10:03:54 +02:00
Susanne Pielawa 07a9efee6b Add metrics: real time ratio and cpu time ratio. (#1275)
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
2018-07-14 12:07:14 +02:00
Kevin Daun df12154542 Fix EqualCellProperties matcher. (#1276) 2018-07-14 10:34:46 +02:00
danielsievers 7b48b66a65 Fined-grained locking for PoseGraph3D constraints (#1279)
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.
2018-07-14 09:27:07 +02:00
Alexander Belyaev d4376e765b
[GenericPoseGraph] Move 'EqualsProto' matcher to test_helpers. (#1271) 2018-07-13 15:05:22 +02:00
Kevin Daun a08037dc47 Add TSDF interpolator. (#1274)
Based on [interpolated_grid.h](https://github.com/googlecartographer/cartographer/blob/master/cartographer/mapping/internal/3d/scan_matching/interpolated_grid.h).
2018-07-13 13:47:09 +02:00
danielsievers 8c9104568a Take PoseGraph3D mutex inside instead of outside work item (#1264)
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.
2018-07-13 11:53:25 +02:00
Christoph Schütte 61a89d8ab8 Check client_id in sensor data handlers (#1266) 2018-07-13 09:57:35 +02:00
Susanne Pielawa dce713b442 Added function GetThreadCpuTimeSeconds in common/time.h (#1267)
This will be needed for measuring SLAM performance.
2018-07-13 00:11:31 +02:00
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