Skip to content

Commit b97fd36

Browse files
authored
Merge pull request #898 from JuliaRobotics/master
v0.13.4-rc1
2 parents de91786 + d1a7496 commit b97fd36

File tree

6 files changed

+38
-14
lines changed

6 files changed

+38
-14
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = "Caesar"
22
uuid = "62eebf14-49bc-5f46-9df9-f7b7ef379406"
33
keywords = ["SLAM", "state-estimation", "MM-iSAM", "MM-iSAMv2", "inference", "robotics", "ROS"]
44
desc = "Non-Gaussian simultaneous localization and mapping"
5-
version = "0.13.3"
5+
version = "0.13.4"
66

77
[deps]
88
ApproxManifoldProducts = "9bbbb610-88a1-53cd-9763-118ce10c1f89"

docs/src/examples/custom_relative_factors.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ end
2020
```
2121
New relative factors should either inheret from `<:AbstractManifoldMinimize`, `<:AbstractRelativeMinimize`, or `<:AbstractRelativeRoots`. These are all subtypes of `<:AbstractRelative`. There are only two abstract super types, `<:AbstractPrior` and `<:AbstractRelative`.
2222

23+
## Summary of Sampling Data Representation
24+
25+
| Usage | `<:AbstractPrior` | `<:AbstractRelative` |
26+
|-------------|--------------------|-----------------------|
27+
| `getSample` | point `p` on Manifold | tangent `X` at some `p` (e.g. identity) |
28+
29+
| Usage | |
30+
|-------------------|----|
31+
| `sampleTangent` | tangent at point `p` or the identity element for groups |
32+
| `rand` / `sample` | coordinates |
33+
2334
## Specialized Dispatch (`getManifold`, `getSample`)
2435

2536
Relative factors involve computaton, these computations must be performed on some manifold. Custom relative factors require that the [`getManifold`](@ref) function be overridded. Here two examples are given for reference:
@@ -47,7 +58,7 @@ function getSample(cf::CalcFactor{<:Pose2Pose2})
4758
end
4859
```
4960

50-
The return type for `getSample` is unrestricted, and will be passed to the residual function "as-is".
61+
The return type for `getSample` is unrestricted, and will be passed to the residual function "as-is", but must return values representing a tangent vector for `<:AbstractRelative`
5162

5263
!!! note
5364
Default dispatches in `IncrementalInference` will try use `cf.factor.Z` to `samplePoint` on manifold (for `<:AbstractPrior`) or `sampleTangent` (for `<:AbstractRelative`), which simplifies new factor definitions. If, however, you wish to build more complicated sampling processes, then simply define your own `getSample(cf::CalcFactor{<:MyFactor})` function.
@@ -70,11 +81,11 @@ function (cf::CalcFactor{<:Pose2Pose2})(X, p, q)
7081
end
7182
```
7283

84+
It is recommended to leave the incoming types unrestricted. If you must define the types, make sure to allow sufficient dispatch freedom (i.e. dispatch to concrete types) and not force operations to "non-concrete" types. Usage can be very case specific, and hence better to let Julia type-inference automation do the hard work of inferring the concrete types.
85+
7386
!!! note
7487
At present (2021) the residual function should return the residual value as a coordinate (not as tangent vectors or manifold points). Ongoing work is in progress, and likely to return residual values as manifold tangent vectors instead.
7588

76-
It is recommended to leave the incoming types unrestricted. If you must define the types, make sure to allow sufficient dispatch freedom (i.e. dispatch to concrete types) and not force operations to "non-concrete" types. Usage can be very case specific, and hence better to let Julia type-inference automation do the hard work of inferring the concrete types.
77-
7889
### Serialization
7990

8091
Serialization of factors is also discussed in more detail at [Standardized Factor Serialization](@ref factor_serialization).

docs/src/examples/using_pcl.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Pointclouds and PCL Types
1+
# [Pointclouds and PCL Types](@id pointclouds_and_pcl)
22

3-
## Introduction Caesar._PCL
3+
## Introduction `Caesar._PCL`
44

55
A wide ranging and well used [point cloud library exists called PCL](https://pointclouds.org/) which is implemented in C++. To get access to many of those features and bridge the Caesar.jl suite of packages, the base `PCL.PointCloud` types have been implemented in Julia and reside under `Caesar._PCL`. The main types of interest:
66
- [`Caesar._PCL.PointCloud`](@ref),

docs/src/examples/using_ros.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,21 @@ Distributed.@everywhere using PyCall
5353

5454
Caesar.jl has native by optional package tools relating to RobotOS.jl (leveraging [Requires.jl](https://github.com/JuliaPackaging/Requires.jl)):
5555
```julia
56-
using RobotOS, Caesar
57-
Distributed.@everywhere using Caesar
56+
using RobotOS
57+
58+
@rosimport sensor_msgs.msg: PointCloud2
59+
60+
rostypegen()
61+
62+
using Colors, Caesar
63+
Distributed.@everywhere using Colors, Caesar
5864
```
5965

66+
Colors.jl is added as a conditional requirement to get `Caesar._PCL.PointCloud` support ([see PCL page here](@ref pointclouds_and_pcl)).
67+
68+
!!! note
69+
Imports and type generation are necessary for RobotOS and Caesar to work properly.
70+
6071
## Prepare Any Outer Objects
6172

6273
Usually a factor graph or detectors, or some more common objects are required. For the example lets just say a basic SLAMWrapper containing a regular `fg=initfg()`:

src/ros/Utils/RosbagSubscriber.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ mutable struct RosbagSubscriber
4848
syncBuffer::Dict{Symbol,Tuple{DateTime, Int}} # t,ns,msgdata
4949
nextMsgChl::Symbol
5050
nextMsgTimestamp::Tuple{DateTime, Int}
51+
compression::Any
5152
# constructors
5253
end
5354
RosbagSubscriber(bagfile::AbstractString;
55+
compression=nothing,
5456
channels::Vector{Symbol}=Symbol[],
5557
callbacks::Dict{Symbol,Function}=Dict{Symbol,Function}(),
5658
readers::Dict{Symbol,PyObject}=Dict{Symbol,PyObject}(),
57-
syncBuffer::Dict{Symbol,Tuple{DateTime, Int}}=Dict{Symbol,Tuple{DateTime, Int}}() ) = RosbagSubscriber(bagfile,channels,callbacks,readers,syncBuffer, :null, (unix2datetime(0),0))
59+
syncBuffer::Dict{Symbol,Tuple{DateTime, Int}}=Dict{Symbol,Tuple{DateTime, Int}}() ) = RosbagSubscriber(bagfile,channels,callbacks,readers,syncBuffer, :null, (unix2datetime(0),0),compression)
5860
#
5961

6062
# loss of accuracy (Julia only Millisecond)
@@ -97,8 +99,8 @@ function loop!(rbs::RosbagSubscriber, args...)
9799
rbs.callbacks[rbs.nextMsgChl](msg, args...)
98100
true
99101
else
100-
println("false, dont know how to handle message time as typeof(msgT)=$(typeof(msgT))")
101-
@show msg
102+
@warn "Unsure about decoding this topic:msg type pair, make sure the subscribed topic names are spelled exactly right." rbs.nextMsgChl msgT maxlog=10
103+
# @show msg
102104
false
103105
end
104106
end
@@ -114,5 +116,5 @@ function (rbs::RosbagSubscriber)( chl::AbstractString,
114116
# include the type converter, see ref: https://github.com/jdlangs/RobotOS.jl/blob/21a7088461a21bc9b24cd2763254d5043d5b1800/src/callbacks.jl#L23
115117
rbs.callbacks[cn] = (m)->callback(convert(MT,m[2]),args...)
116118
rbs.syncBuffer[cn] = (unix2datetime(0), 0)
117-
rbs.readers[cn] = RosbagParser(rbs.bagfile, chl)
119+
rbs.readers[cn] = RosbagParser(rbs.bagfile, chl) #; rbs.compression)
118120
end

src/ros/Utils/rosbagReader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import sys
77

88
class RosbagParser:
9-
def __init__(self, bag_file_name, topic_name):
9+
def __init__(self, bag_file_name, topic_name): #, compression=None):
1010
#bag_file_name = sys.argv[1]
1111
#topic_name = sys.argv[2]
1212

13-
self.bag = rosbag.Bag(bag_file_name)
13+
self.bag = rosbag.Bag(bag_file_name, 'r') #, compression=compression)
1414
self.bag_contents = self.bag.read_messages(topics=[topic_name])
1515

1616
self.idx = 0

0 commit comments

Comments
 (0)