Open liuzf1988 opened 1 year ago
Hi, Thanks for contributing to Dora by raising issues!
Making a service like ROS2 could be very interesting indeed!
From what I understand:
pose_initializer
sends an align_request_pose
to ndt_scan_matcher
that sends back a aligned_response_pose
to pose_initializer
. map_points
and downsampled_pointcloud
have first been received by ndt_scan_matcher
.you mention that:
theoretically, it cannot be guaranteed that ndt_scan_matcher operator will receive the map_points and downsampled_pointcloud messages before receiving the align_request_pose request
Would it be possible to just have an if-statement that responds False
or a default zeroed aligned_response_pose
if map_points
and downsampled_pointcloud
are not initialized?
And if we do actually implement a service, wouldn't we face the same initialization process issue?
Thanks a lot for the detailed explanation! Let me try to summarize the features that you would like to see in dora:
service_is_ready
Am I missing anything?
I wonder if there is a better alternative to SRV, Looking forward to your reply.
I don't think that think there is a better way right now. You could try to split the "client" to implement a more linear data flow instead of using a request/reply pattern. I imagine something like this:
nodes:
- id: runtime-node
operators:
- id: pose_initializer
...
inputs:
manual_pose: manual_pose/initial_pose
outputs:
- align_request_pose
- id: ndt_scan_matcher
shared-library: ../../../target/debug/ndt_scan_matcher
inputs:
align_request_pose: runtime-node/pose_initializer/align_request_pose
outputs:
- aligned_response_pose
- id: aligned_pose_handler
...
inputs:
aligned_response_pose: runtime-node/ndt_scan_matcher/aligned_response_pose
I'm not sure if this is possible in your case though.
This is a problem encountered in porting NDT algorithm from ROS2 ecosystem to DORA framework.
The SRV mechanism provided in ROS2 accepts the service request sent by the client and send back the response.
It is known the NDT algorithm requires GNSS signal or manual initial position assignment before it works, and the NDT algorithm is sensitive to the error of the given initial position, while the GNSS (without RTK) signal or manual initial position generally has an error of 2-10 meters, so the Particle filter + NDT algorithm is used to find an accurate position near the given initial position.
In the implementation of the autoware.universe's location module, the process of obtaining the exact initial pose is provided by a SRV mechanism, i.e. the
serviceNDTAlign
service inndt_scan_matcher_core.cpp
. The call to theserviceNDTAlign
service is made in thepose_initializer
package. Extract the relevant codes as follows:From the implementation of
align_pose()
function inndt_module.cpp
, it can be seen that, The SRV mechanism of ROS2 has two characteristics: first, whether the service is ready can be checked throughif (! cli_align_ ->service_is_ready())
before calling the service; Second, service calls are executed asynchronously.At present, there is no SRV mechanism in the DORA framework, so the Pub/Sub method is temporarily used to replace SRV: from dataflow.yml, it can be seen that first the
pose_initializer
operator sends aalign_request_pose
request message, and then thendt_scan_matcher
operator return the response message.Such an approximate alternative cannot realize the two characteristics of SRV mechanism mentioned above: first, it is impossible to determine whether the service is ready before calling the service, because the
ndt_align
service provided byndt_scan_matcher
is actutally ready only when the operator has received amap_ points
anddownsampled_pointcloud
input message. Since both ROS2 and Dora uses a Pub/Sub distributed communication mode, it is impossible to specify the node/operator startup sequence. So theoretically, it cannot be guaranteed thatndt_scan_matcher
operator will receive themap_points
anddownsampled_pointcloud
messages before receiving thealign_request_pose
request. Secondly, there is no asynchronous call mode, or I do not know how to use asynchronous mechanism in the implementation of DORA operator.So there will be performance bottlenecks in the current alternatives. I wonder if there is a better alternative to SRV, Looking forward to your reply.