-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into fix/sign-of-relativ…
…e-distance Signed-off-by: yamacir-kit <[email protected]>
- Loading branch information
Showing
7 changed files
with
546 additions
and
7 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
107 changes: 107 additions & 0 deletions
107
simulation/traffic_simulator/include/traffic_simulator/entity/deleted_entity.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,107 @@ | ||
// Copyright 2015 TIER IV, Inc. All rights reserved. | ||
// | ||
// 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 TRAFFIC_SIMULATOR__ENTITY__DELETED_ENTITY_HPP_ | ||
#define TRAFFIC_SIMULATOR__ENTITY__DELETED_ENTITY_HPP_ | ||
|
||
#include <optional> | ||
#include <traffic_simulator/entity/entity_base.hpp> | ||
#include <traffic_simulator_msgs/msg/misc_object_parameters.hpp> | ||
|
||
namespace traffic_simulator | ||
{ | ||
namespace entity | ||
{ | ||
class DeletedEntity : public EntityBase | ||
{ | ||
public: | ||
// Dummy ID for internal use | ||
static constexpr uint8_t ENTITY_TYPE_ID = 0xFF; | ||
|
||
explicit DeletedEntity( | ||
const std::string & name, const CanonicalizedEntityStatus &, | ||
const std::shared_ptr<hdmap_utils::HdMapUtils> &); | ||
|
||
void onUpdate(double, double) override {} | ||
|
||
auto getCurrentAction() const -> std::string override; | ||
|
||
auto getDefaultDynamicConstraints() const | ||
-> const traffic_simulator_msgs::msg::DynamicConstraints & override; | ||
|
||
auto getEntityType() const -> const traffic_simulator_msgs::msg::EntityType & override | ||
{ | ||
static traffic_simulator_msgs::msg::EntityType type; | ||
type.type = ENTITY_TYPE_ID; // Dummy ID for internal use | ||
return type; | ||
} | ||
|
||
auto getEntityTypename() const -> const std::string & override | ||
{ | ||
static const std::string result = "DeletedEntity"; | ||
return result; | ||
} | ||
|
||
~DeletedEntity() override = default; | ||
|
||
auto getGoalPoses() -> std::vector<CanonicalizedLaneletPose> override { return {}; } | ||
|
||
std::optional<traffic_simulator_msgs::msg::Obstacle> getObstacle() override | ||
{ | ||
return std::nullopt; | ||
} | ||
|
||
auto getRouteLanelets(double) -> lanelet::Ids override { return {}; } | ||
|
||
auto fillLaneletPose(CanonicalizedEntityStatus &) -> void override; | ||
|
||
auto getWaypoints() -> const traffic_simulator_msgs::msg::WaypointsArray override | ||
{ | ||
return traffic_simulator_msgs::msg::WaypointsArray(); | ||
} | ||
|
||
void requestSpeedChange(double, bool) override {} | ||
|
||
void requestSpeedChange(const speed_change::RelativeTargetSpeed &, bool) override {} | ||
|
||
void requestAssignRoute(const std::vector<CanonicalizedLaneletPose> &) override {} | ||
|
||
void requestAssignRoute(const std::vector<geometry_msgs::msg::Pose> &) override {} | ||
|
||
void requestAcquirePosition(const CanonicalizedLaneletPose &) override {} | ||
|
||
void requestAcquirePosition(const geometry_msgs::msg::Pose &) override {} | ||
|
||
void requestSpeedChange( | ||
const double, const speed_change::Transition, const speed_change::Constraint, | ||
const bool) override | ||
{ | ||
} | ||
|
||
auto getBehaviorParameter() const -> traffic_simulator_msgs::msg::BehaviorParameter override; | ||
|
||
void setBehaviorParameter(const traffic_simulator_msgs::msg::BehaviorParameter &) override {} | ||
|
||
void setAccelerationLimit(double) override {} | ||
|
||
void setAccelerationRateLimit(double) override {} | ||
|
||
void setDecelerationLimit(double) override {} | ||
|
||
void setDecelerationRateLimit(double) override {} | ||
}; | ||
} // namespace entity | ||
} // namespace traffic_simulator | ||
|
||
#endif // TRAFFIC_SIMULATOR__ENTITY__DELETED_ENTITY_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
69 changes: 69 additions & 0 deletions
69
simulation/traffic_simulator/src/entity/deleted_entity.cpp
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,69 @@ | ||
// Copyright 2015 TIER IV, Inc. All rights reserved. | ||
// | ||
// 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. | ||
|
||
#include <limits> | ||
#include <traffic_simulator/entity/deleted_entity.hpp> | ||
|
||
namespace traffic_simulator | ||
{ | ||
namespace entity | ||
{ | ||
DeletedEntity::DeletedEntity( | ||
const std::string & name, const CanonicalizedEntityStatus & entity_status, | ||
const std::shared_ptr<hdmap_utils::HdMapUtils> & hdmap_utils_ptr) | ||
: EntityBase(name, entity_status, hdmap_utils_ptr) | ||
{ | ||
auto status = static_cast<EntityStatus>(status_); | ||
status.action_status.twist = geometry_msgs::msg::Twist(); | ||
status.action_status.accel = geometry_msgs::msg::Accel(); | ||
status.action_status.linear_jerk = 0; | ||
status.action_status.current_action = "static"; | ||
status.bounding_box.dimensions.x = 0; | ||
status.bounding_box.dimensions.y = 0; | ||
status.bounding_box.dimensions.z = 0; | ||
status.pose.position.x = std::numeric_limits<double>::infinity(); | ||
status.pose.position.y = std::numeric_limits<double>::infinity(); | ||
status.pose.position.z = std::numeric_limits<double>::infinity(); | ||
status.lanelet_pose_valid = false; | ||
status_ = CanonicalizedEntityStatus(status, hdmap_utils_ptr_); | ||
status_before_update_ = CanonicalizedEntityStatus(status, hdmap_utils_ptr_); | ||
} | ||
|
||
auto DeletedEntity::getCurrentAction() const -> std::string { return "static"; } | ||
|
||
auto DeletedEntity::getBehaviorParameter() const -> traffic_simulator_msgs::msg::BehaviorParameter | ||
{ | ||
return traffic_simulator_msgs::msg::BehaviorParameter(); | ||
} | ||
|
||
auto DeletedEntity::getDefaultDynamicConstraints() const | ||
-> const traffic_simulator_msgs::msg::DynamicConstraints & | ||
{ | ||
static const auto default_dynamic_constraints = []() { | ||
auto dynamic_constraints = traffic_simulator_msgs::msg::DynamicConstraints(); | ||
dynamic_constraints.max_speed = 0.0; | ||
dynamic_constraints.max_acceleration = 0.0; | ||
dynamic_constraints.max_acceleration_rate = 0.0; | ||
dynamic_constraints.max_deceleration = 0.0; | ||
dynamic_constraints.max_deceleration_rate = 0.0; | ||
return dynamic_constraints; | ||
}(); | ||
|
||
return default_dynamic_constraints; | ||
} | ||
|
||
auto DeletedEntity::fillLaneletPose(CanonicalizedEntityStatus &) -> void {} | ||
|
||
} // namespace entity | ||
} // namespace traffic_simulator |
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.