Skip to content

Commit

Permalink
fix pandar_msg dependency (#117)
Browse files Browse the repository at this point in the history
* fix `pandar_msg` dependency

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
miursh and pre-commit-ci[bot] authored Jun 19, 2024
1 parent 1f8ad6d commit 95dc22a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ source /opt/ros/${ROS_DISTRO}/setup.sh
sudo apt install -y ros-${ROS_DISTRO}-sensor-msgs-py ros-${ROS_DISTRO}-rosbag2-storage-mcap ros-${ROS_DISTRO}-radar-msgs

mkdir src -p && vcs import src < build_depends.repos
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-up-to tier4_perception_msgs
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-up-to tier4_perception_msgs pandar_msgs
source ./install/setup.bash
```

Expand Down
4 changes: 4 additions & 0 deletions build_depends.repos
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ repositories:
type: git
url: https://github.com/autowarefoundation/autoware_msgs.git
version: main
nebula:
type: git
url: https://github.com/tier4/nebula.git
version: main

# This repository should eventually be removed. See https://github.com/orgs/autowarefoundation/discussions/3862
autoware_auto_msgs:
Expand Down
24 changes: 13 additions & 11 deletions perception_dataset/rosbag2/rosbag2_converter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import os.path as osp
import re
import shutil
Expand Down Expand Up @@ -100,20 +101,21 @@ def convert(self):
topic_type = self._topic_name_to_topic_type[topic_name]
try:
msg_type = get_message(topic_type)
msg = deserialize_message(data, msg_type)
if hasattr(msg, "header"):
message_time: float = msg.header.stamp.sec + msg.header.stamp.nanosec * 1e-9
elif hasattr(msg, "transforms"):
message_time: float = (
msg.transforms[0].header.stamp.sec
+ msg.transforms[0].header.stamp.nanosec * 1e-9
)
except ModuleNotFoundError:
continue
logging.warning(f"ModuleNotFoundError: {topic_type}")
except AttributeError:
print("Sourced message type is differ from the one in rosbag")
continue

msg = deserialize_message(data, msg_type)
if hasattr(msg, "header"):
message_time: float = msg.header.stamp.sec + msg.header.stamp.nanosec * 1e-9
elif hasattr(msg, "transforms"):
message_time: float = (
msg.transforms[0].header.stamp.sec
+ msg.transforms[0].header.stamp.nanosec * 1e-9
logging.error(
f"AttributeError: {topic_type}. Sourced message type is differ from the one in rosbag. {topic_name} is ignored."
)
continue

if topic_name == "/tf_static":
writer.write(topic_name, data, timestamp)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "perception-dataset"
version = "1.0.9"
version = "1.0.10"
description = "TIER IV Perception dataset has modules to convert dataset from rosbag to t4_dataset"
authors = ["Yusuke Muramatsu <[email protected]>", "Shunsuke Miura <[email protected]>"]

Expand Down

0 comments on commit 95dc22a

Please sign in to comment.