Skip to content
Snippets Groups Projects
Commit 12a93911 authored by Alcolado Nuthall's avatar Alcolado Nuthall
Browse files

feat: support rosbag play

parent e1d4d3d0
No related branches found
No related tags found
No related merge requests found
...@@ -8,22 +8,22 @@ ...@@ -8,22 +8,22 @@
"aspect": 1.33333333333, "aspect": 1.33333333333,
"camera_to_world": [ "camera_to_world": [
[ [
-0.7712574369763269, -0.7794105921481128,
0.1513242754712088, 0.2580277804141302,
-0.6182741540464238, -0.5709122466560741,
0.37396875264637797 -0.15150902339942507
], ],
[ [
-0.6360692717618674, -0.6246540202209707,
-0.21990707861025355, -0.2498903335022854,
0.7396328537169178, 0.7398392908219299,
0.009873900166690274 0.170480890757302
], ],
[ [
-0.024038457293159843, 0.04823363835652139,
0.9637125299746899, 0.9332612098210632,
0.26585769152075983, 0.3559452631714859,
-0.07500160249766082 -0.10236216822295188
], ],
[ [
0.0, 0.0,
......
...@@ -8,22 +8,22 @@ ...@@ -8,22 +8,22 @@
"aspect": 1.33333333333, "aspect": 1.33333333333,
"camera_to_world": [ "camera_to_world": [
[ [
-0.7712574369763269, -0.7794105921481128,
0.1513242754712088, 0.2580277804141302,
-0.6182741540464238, -0.5709122466560741,
0.37396875264637797 -0.15150902339942507
], ],
[ [
-0.6360692717618674, -0.6246540202209707,
-0.21990707861025355, -0.2498903335022854,
0.7396328537169178, 0.7398392908219299,
0.009873900166690274 0.170480890757302
], ],
[ [
-0.024038457293159843, 0.04823363835652139,
0.9637125299746899, 0.9332612098210632,
0.26585769152075983, 0.3559452631714859,
-0.07500160249766082 -0.10236216822295188
], ],
[ [
0.0, 0.0,
......
rosbag2_bagfile_information:
version: 7
storage_identifier: mcap
duration:
nanoseconds: 259999981220
starting_time:
nanoseconds_since_epoch: 1690361657153599669
message_count: 261
topics_with_message_count:
- topic_metadata:
name: /pose
type: geometry_msgs/msg/Pose
serialization_format: cdr
offered_qos_profiles: "- history: 3\n depth: 0\n reliability: 1\n durability: 2\n deadline:\n sec: 9223372036\n nsec: 854775807\n lifespan:\n sec: 9223372036\n nsec: 854775807\n liveliness: 1\n liveliness_lease_duration:\n sec: 9223372036\n nsec: 854775807\n avoid_ros_namespace_conventions: false"
type_description_hash: RIHS01_d501954e9476cea2996984e812054b68026ae0bfae789d9a10b23daf35cc90fa
message_count: 261
compression_format: ""
compression_mode: ""
relative_file_paths:
- poses_0.mcap
files:
- path: poses_0.mcap
starting_time:
nanoseconds_since_epoch: 1690361657153599669
duration:
nanoseconds: 259999981220
message_count: 261
custom_data: ~
\ No newline at end of file
File added
No preview for this file type
...@@ -22,11 +22,6 @@ def generate_launch_description(): ...@@ -22,11 +22,6 @@ def generate_launch_description():
executable='sim_rgb_generator', executable='sim_rgb_generator',
name='sim_rgb_generator' name='sim_rgb_generator'
), ),
Node(
package='nerf_sim',
executable='pose_generator',
name='pose_generator'
),
Node( Node(
package='nerf_sim', package='nerf_sim',
executable='pcd_generator', executable='pcd_generator',
......
No preview for this file type
No preview for this file type
...@@ -19,7 +19,7 @@ class PCDPublisher(Node): ...@@ -19,7 +19,7 @@ class PCDPublisher(Node):
self.pcd_publisher = self.create_publisher(sensor_msgs.PointCloud2, 'pcd', 10) self.pcd_publisher = self.create_publisher(sensor_msgs.PointCloud2, 'pcd', 10)
# subscribe to pose coming in from topic # subscribe to pose coming in from topic
self.subscription = self.create_subscription(Pose, 'pose', self.listener_callback, 10) self.subscription = self.create_subscription(Pose, 'pose', self.listener_callback, 1)
self.subscription self.subscription
self.render = RenderLiDAR() self.render = RenderLiDAR()
......
...@@ -13,19 +13,21 @@ class MinimalPublisher(Node): ...@@ -13,19 +13,21 @@ class MinimalPublisher(Node):
def __init__(self): def __init__(self):
super().__init__('minimal_publisher') super().__init__('minimal_publisher')
self.publisher_ = self.create_publisher(Pose, 'pose', 1) self.publisher_ = self.create_publisher(Pose, 'pose', 1)
timer_period = 10 # seconds timer_period = 1 # seconds
self.timer = self.create_timer(timer_period, self.timer_callback) self.timer = self.create_timer(timer_period, self.timer_callback)
self.i = 0 self.i = 0
orig = open('/workspace/ros2_iron/src/nerf_sim/test_materials/left_fisheye.json', 'r') orig = open('/workspace/ros2_iron/src/nerf_sim/test_materials/left_fisheye.json', 'r')
orig_json = json.load(orig) self.orig_json = json.load(orig)
# testing using a single pose only # testing using a single pose only
self.pose = np.matrix(orig_json['camera_path'][0]['camera_to_world']) # self.pose = np.matrix(orig_json['camera_path'][0]['camera_to_world'])
def timer_callback(self): def timer_callback(self):
self.pose = np.matrix(self.orig_json['camera_path'][self.i]['camera_to_world'])
msg = Pose() msg = Pose()
msg.position.x = self.pose[0,3] + 0.5 msg.position.x = self.pose[0,3]
msg.position.y = self.pose[1,3] msg.position.y = self.pose[1,3]
msg.position.z = self.pose[2,3] msg.position.z = self.pose[2,3]
...@@ -39,6 +41,9 @@ class MinimalPublisher(Node): ...@@ -39,6 +41,9 @@ class MinimalPublisher(Node):
msg.orientation.w = quat[3] msg.orientation.w = quat[3]
self.publisher_.publish(msg) self.publisher_.publish(msg)
self.get_logger().info('Publishing: "%s"' % msg) self.get_logger().info('Publishing: "%s"' % msg)
if self.i < len(self.orig_json['camera_path']):
self.i+=1
def main(args=None): def main(args=None):
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment