forked from autowarefoundation/autoware.universe
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dummy_perception_publisher): publish realistic dummy pointcloud …
…using raymarchig (#527) * Create pointcloud by raycasting from vehicle Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * [after-review] Use vector of ObjectInfo Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * [after-review] Implemented by strategy pattern Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * [after-review] split files Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Use pcl raytracing Tmp Tmp Tmp Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Add signed distance function lib Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Use sdf library Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Remove no longer used functions Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Refactor Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Simplify getPoint Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Raytracing considering inter object relation Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Add random noise Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Default is object centric Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Return if no objects are detected Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Change definition of tf_global_to_local (same as other autoware codes) Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Remove create method Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Reaname: VehicleCentric -> EgoCentric Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Refactor a bit Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Tune parameter Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Fix: Even if selected_idices is zero, pointclouds must be published Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Fix launch file Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Fix typo Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Fix: create merged pointcloud when no idx is selected Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp> * Use ray-maching by default Signed-off-by: Hirokazu Ishida <h-ishida@jsk.imi.i.u-tokyo.ac.jp>
- Loading branch information
1 parent
2cd9047
commit e437833
Showing
8 changed files
with
661 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...ummy_perception_publisher/include/dummy_perception_publisher/signed_distance_function.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright 2022 Tier IV, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef DUMMY_PERCEPTION_PUBLISHER__SIGNED_DISTANCE_FUNCTION_HPP_ | ||
#define DUMMY_PERCEPTION_PUBLISHER__SIGNED_DISTANCE_FUNCTION_HPP_ | ||
|
||
#include <tf2/LinearMath/Transform.h> | ||
|
||
#include <memory> | ||
#include <stdexcept> | ||
#include <utility> | ||
#include <vector> | ||
|
||
namespace signed_distance_function | ||
{ | ||
|
||
class AbstractSignedDistanceFunction | ||
{ | ||
public: | ||
virtual double operator()(double x, double y) const = 0; | ||
double getSphereTracingDist( | ||
double x_start, double y_start, double angle, double eps = 1e-2) const; | ||
virtual ~AbstractSignedDistanceFunction() {} | ||
}; | ||
|
||
class BoxSDF : public AbstractSignedDistanceFunction | ||
{ | ||
public: | ||
BoxSDF(double length, double width, tf2::Transform tf_global_to_local) | ||
: length_(length), width_(width), tf_global_to_local_(tf_global_to_local) | ||
{ | ||
} | ||
double operator()(double x, double y) const override; | ||
|
||
private: | ||
double length_; | ||
double width_; | ||
// tf_global_to_local_ is NOT a transfrom of basis, rather just a coordinate of local w.r.t. | ||
// global | ||
tf2::Transform tf_global_to_local_; | ||
}; | ||
|
||
class CompisiteSDF : public AbstractSignedDistanceFunction | ||
{ | ||
public: | ||
explicit CompisiteSDF(std::vector<std::shared_ptr<AbstractSignedDistanceFunction>> sdf_ptrs) | ||
: sdf_ptrs_(std::move(sdf_ptrs)) | ||
{ | ||
if (sdf_ptrs_.empty()) { | ||
throw std::runtime_error("sdf_ptrs must not be empty"); | ||
} | ||
} | ||
double operator()(double x, double y) const override; | ||
|
||
size_t nearest_sdf_index(double x, double y) const; | ||
|
||
private: | ||
std::vector<std::shared_ptr<AbstractSignedDistanceFunction>> sdf_ptrs_; | ||
}; | ||
|
||
} // namespace signed_distance_function | ||
|
||
#endif // DUMMY_PERCEPTION_PUBLISHER__SIGNED_DISTANCE_FUNCTION_HPP_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.