Skip to content

Commit

Permalink
feat: add support of NavSatFix
Browse files Browse the repository at this point in the history
Signed-off-by: ktro2828 <[email protected]>
  • Loading branch information
ktro2828 committed Nov 30, 2024
1 parent da864ac commit 2510066
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
40 changes: 40 additions & 0 deletions awviz_plugin/include/awviz_plugin/navsatfix/navsatfix_display.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright 2024 Kotaro Uetake.
//
// 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 AWVIZ_PLUGIN__NAVSATFIX__NAVSATFIX_DISPLAY_HPP_
#define AWVIZ_PLUGIN__NAVSATFIX__NAVSATFIX_DISPLAY_HPP_

#include <awviz_common/display.hpp>

#include <sensor_msgs/msg/nav_sat_fix.hpp>

namespace awviz_plugin
{
/**
* @brief Display plugin of `sensor_msgs::msg::NavSatFix`.
*/
class NavSatFixDisplay : public awviz_common::RosTopicDisplay<sensor_msgs::msg::NavSatFix>
{
public:
/**
* @brief Construct a new object.
*/
NavSatFixDisplay();

protected:
void log_message(sensor_msgs::msg::NavSatFix::ConstSharedPtr msg) override;
};
} // namespace awviz_plugin

#endif
7 changes: 7 additions & 0 deletions awviz_plugin/plugin_description.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
<message_type>sensor_msgs/msg/PointCloud2</message_type>
</class>

<!-- NavSatFix -->
<class name="awviz_plugin/NavSatFixDisplay" type="awviz_plugin::NavSatFixDisplay"
base_class_type="awviz_common::Display">
<description>Display from sensor_msgs/msg/NavSatFix message.</description>
<message_type>sensor_msgs/msg/NavSatFix</message_type>
</class>

<!-- Autoware -->
<!-- Perception -->
<class name="awviz_plugin/DetectedObjectsDisplay" type="awviz_plugin::DetectedObjectsDisplay"
Expand Down
36 changes: 36 additions & 0 deletions awviz_plugin/src/navsatfix/navsatfix_display.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2024 Kotaro Uetake.
//
// 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 "awviz_plugin/navsatfix/navsatfix_display.hpp"

#include <rerun.hpp>

namespace awviz_plugin
{
NavSatFixDisplay::NavSatFixDisplay() : awviz_common::RosTopicDisplay<sensor_msgs::msg::NavSatFix>()
{
}

void NavSatFixDisplay::log_message(sensor_msgs::msg::NavSatFix::ConstSharedPtr msg)
{
stream_->set_time_seconds(
TIMELINE_NAME, rclcpp::Time(msg->header.stamp.sec, msg->header.stamp.nanosec).seconds());

const auto entity_path = property_.entity();
stream_->log(entity_path, rerun::GeoPoints(rerun::LatLon(msg->latitude, msg->longitude)));
}
} // namespace awviz_plugin

#include <pluginlib/class_list_macros.hpp>
PLUGINLIB_EXPORT_CLASS(awviz_plugin::NavSatFixDisplay, awviz_common::Display);

0 comments on commit 2510066

Please sign in to comment.