Clear Filters
Clear Filters

bug:factorGraph object function addFactor returns less one than normal return value

1 view (last 30 days)
this is minor bug, addFactor should return 1-based positive integer node index value,but in matlab R2022b return 0-base index value.
f = factorTwoPoseSE3([1 2])
f =
factorTwoPoseSE3 with properties: NodeID: [1 2] Measurement: [0 0 0 1 0 0 0] Information: [6×6 double]
g = factorGraph;
nodeId = addFactor(g,f)
nodeId = 0

Accepted Answer

cui,xingxing on 7 Jan 2023
Edited: cui,xingxing on 7 Jan 2023
The factorGraph series of functions was introduced in the recent R2022a release. Many of the descriptions of this series of functions are not stable and reliable, and addFactor returns factorID, which is based on a 0-base index, making it counter-intuitive.
Personally, to avoid unexpected results, I recommend using the poseGraph family of functions to solve your problem until Mathworks has officially updated the factorGraph description. As of now the affected versions are R2022a,R2022b.
references Issues:
  1. bug: factorGraph does not work for relative measurement angles
  2. factorGraph:Unclear document function factorTwoPoseSE3/SE2 with input parameter 'Measurement'

More Answers (1)

Zheng Dong
Zheng Dong on 5 Jan 2023
Edited: Zheng Dong on 6 Jan 2023
Hi Cui,
Referring to the doc page for addFactor, the return value of addFactor is factorID not nodeID, and factorID will start from 0. I am sorry for the confusion here.
cui,xingxing on 7 Jan 2023
Edited: cui,xingxing on 7 Jan 2023
Thanks for the update to clarify, but I personally still think it's weird that factorID is 0-based. I see a lot of official examples where factorID and nodeID are mixed together and don't overlap and affect each other, which confuses me!
I'm tempted to abandon it in favour of the original poseGraph until the official factorGraph update is available, as it's much more understandable and accessible. I hope TMW will take care of the new functions introduced!@Zheng Dong

Sign in to comment.




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!