Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

18 perc data file node #20

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
80330fb
Created ros2_numpy_dv package from ros2_numpy
GeoffTheJetson Oct 31, 2023
0693041
Create FileNode, refactor DataNode and resulting nodes
GeoffTheJetson Oct 31, 2023
ae42c38
Create files for track testings
GeoffTheJetson Oct 31, 2023
dd8c704
Seting up predict node and fixing imports
GeoffTheJetson Nov 6, 2023
40a4ba3
Incorporated PredictNode
GeoffTheJetson Nov 6, 2023
5d201ff
Merge branch 'main' into 18-perc-data-file-node
GeoffTheJetson Nov 6, 2023
56818bd
Refactored perceptions code -- got namespace packages included in ROS
GeoffTheJetson Nov 7, 2023
954781e
Made package.xml require ros2_numpy_dv
GeoffTheJetson Nov 7, 2023
3c3102b
Added flags for debugging and timing to PredictorNod
GeoffTheJetson Nov 7, 2023
1d362fa
Removed velodyne submodule
GeoffTheJetson Nov 7, 2023
d1fd739
Added ZEDNode publisher and ZEDSDK class, moved raw data topics to file
dinodeep Nov 30, 2023
904cd9b
Added ZEDNode to setup file to make it runnable
dinodeep Nov 30, 2023
382bea9
Adding header to ZEDnode
GeoffTheJetson Nov 30, 2023
3c48504
Integrated data type selection into ROS perceptions
dinodeep Nov 30, 2023
52e6f97
Bug fix removing both right and depth publishing to avoid overhead
dinodeep Nov 30, 2023
afe7c21
Added visualizations of datanode as argument
dinodeep Nov 30, 2023
4b29158
Moved visualization functionality inside of required data condition
dinodeep Nov 30, 2023
592533b
Added comment on ZED data publishing rate
dinodeep Nov 30, 2023
5d44bd3
Added Datatype to datanode bug fix
dinodeep Nov 30, 2023
cbcb4c5
path fix
GeoffTheJetson Nov 30, 2023
1095bf0
Merge branch '18-perc-data-file-node' of github.com:carnegiemellonrac…
GeoffTheJetson Nov 30, 2023
325ff03
Bug fix for check all data
GeoffTheJetson Nov 30, 2023
76c0cd3
Added additional info to ZEDNode message (frame id and timestamp)
GeoffTheJetson Nov 30, 2023
5cefd12
Fixed file node with data node changes
GeoffTheJetson Dec 1, 2023
4feadea
some changes
GeoffTheJetson Dec 6, 2023
8b68c11
some more changes
GeoffTheJetson Dec 6, 2023
76d6710
ommitting before changing
GeoffTheJetson Jan 8, 2024
dd0a348
changing branches
GeoffTheJetson Jan 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion driverless_ws/src/eufs_msgs
Submodule eufs_msgs updated from 4f3b22 to 8f33f5
4 changes: 2 additions & 2 deletions driverless_ws/src/perceptions/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

<build_depend>eufs_msgs</build_depend>
<exec_depend>eufs_msgs</exec_depend>
<build_depend>ros2_numpy</build_depend>
<exec_depend>ros2_numpy</exec_depend>
<build_depend>ros2_numpy_dv</build_depend>
<exec_depend>ros2_numpy_dv</exec_depend>

<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
Expand Down
63 changes: 0 additions & 63 deletions driverless_ws/src/perceptions/perceptions/LidarNode.py

This file was deleted.

5 changes: 5 additions & 0 deletions driverless_ws/src/perceptions/perceptions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
`tar` and `gzip` file by running

```
tar -cvf <dirname>.tar.gz <dirname>
```
68 changes: 0 additions & 68 deletions driverless_ws/src/perceptions/perceptions/StereoNode.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# ROS2 imports
import rclpy

# for subscribing to sensor data
from perceptions.ros.utils.PredictNode import PredictNode

# for doing prediction on sensor data
from perc22a.predictors.lidar.LidarPredictor import LidarPredictor

NODE_NAME = "lidar_node"

class LidarNode(PredictNode):

def __init__(self):
super().__init__(name=NODE_NAME, debug_flag=False, time_flag=True)

return

def init_predictor(self):
return LidarPredictor()


def main(args=None):
rclpy.init(args=args)

stereo_node = LidarNode()

rclpy.spin(stereo_node)

stereo_node.destroy_node()
rclpy.shutdown()


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# ROS2 imports
import rclpy

# for subscribing to sensor data
from perceptions.ros.utils.PredictNode import PredictNode

# for doing prediction on sensor data
from perc22a.predictors.stereo.StereoPredictor import StereoPredictor

NODE_NAME = "stereo_node"

class StereoNode(PredictNode):

def __init__(self):
super().__init__(name=NODE_NAME, debug_flag=False, time_flag=True)
return

def init_predictor(self):
# create predictor
self.model_name = 'ultralytics/yolov5'
self.param_path = '/home/dale/driverless-packages/PerceptionsLibrary22a/perc22a/predictors/stereo/model_params.pt'
predictor = StereoPredictor(self.model_name, self.param_path)
return predictor

def main(args=None):
rclpy.init(args=args)

stereo_node = StereoNode()

rclpy.spin(stereo_node)

stereo_node.destroy_node()
rclpy.shutdown()


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from sensor_msgs.msg import Image, PointCloud2

# ROS2 msg to python datatype conversions
import perceptions.conversions as conv
import perceptions.ros.utils.conversions as conv

# perceptions Library visualization functions (for 3D data)
import perc22a.predictors.utils.lidar.visualization as vis
Expand Down Expand Up @@ -45,46 +45,49 @@ def __init__(self, name="data_node"):
# subscribe to each piece of data that we want to collect on
self.left_color_subscriber = self.create_subscription(Image, LEFT_IMAGE_TOPIC, self.left_color_callback, qos_profile=BEST_EFFORT_QOS_PROFILE)
self.right_color_subscriber = self.create_subscription(Image, RIGHT_IMAGE_TOPIC, self.right_color_callback, qos_profile=BEST_EFFORT_QOS_PROFILE)
self.xyz_image_subscriber = self.create_subscription(Image, XYZ_IMAGE_TOPIC, self.xyz_callback, qos_profile=BEST_EFFORT_QOS_PROFILE)
self.xyz_image_subscriber = self.create_subscription(Image, XYZ_IMAGE_TOPIC, self.xyz_image_callback, qos_profile=BEST_EFFORT_QOS_PROFILE)
self.depth_subscriber = self.create_subscription(Image, DEPTH_IMAGE_TOPIC, self.depth_image_callback, qos_profile=BEST_EFFORT_QOS_PROFILE)
self.point_subscriber = self.create_subscription(PointCloud2, POINT_TOPIC, self.point_callback, qos_profile=BEST_EFFORT_QOS_PROFILE)

# define varaibles to store the data
self.left_color = None
self.right_color = None
self.xyz_image = None
self.depth_image = None
self.points = None
self.point_subscriber = self.create_subscription(PointCloud2, POINT_TOPIC, self.points_callback, qos_profile=BEST_EFFORT_QOS_PROFILE)

# define dictionary to store the data
self.data = {}

# create key strings associated with data (eventually make same as topic names)
self.left_color_str = "left_color"
self.right_color_str = "right_color"
self.xyz_image_str = "xyz_image"
self.depth_image_str = "depth_image"
self.points_str = "points"


def got_all_data(self):
# returns whether data node has all pieces of data
return self.left_color is not None and \
self.right_color is not None and \
self.xyz_image is not None and \
self.depth_image is not None and \
self.points is not None
return self.left_color_str in self.data and \
self.right_color_str in self.data and \
self.xyz_image_str in self.data and \
self.depth_image_str in self.data and \
self.points_str in self.data

def left_color_callback(self, msg):
self.left_color = conv.img_to_npy(msg)
self.data[self.left_color_str] = conv.img_to_npy(msg)

if DEBUG:
cv2.imshow("left", self.left_color)
cv2.imshow("left", self.data[self.left_color_str])
cv2.waitKey(1)

def right_color_callback(self, msg):
self.right_color = conv.img_to_npy(msg)
self.data[self.right_color_str] = conv.img_to_npy(msg)

if DEBUG:
cv2.imshow("right", self.right_color)
cv2.imshow("right", self.data[self.right_color_str])
cv2.waitKey(1)

def xyz_callback(self, msg):
self.xyz_image =conv.img_to_npy(msg)
def xyz_image_callback(self, msg):
self.data[self.xyz_image_str] =conv.img_to_npy(msg)

if DEBUG:
# display xyz_image as unstructured point cloud
points = self.xyz_image[:, :, :3]
points = self.data[self.xyz_image_str][:, :, :3]
points = points.reshape((-1, 3))
points = points[:,[1,0,2]]
points = points[~np.isnan(points)].reshape((-1, 3))
Expand All @@ -93,16 +96,16 @@ def xyz_callback(self, msg):
vis.update_visualizer_window(self.xyz_image_window, points)

def depth_image_callback(self, msg):
self.depth_image = conv.img_to_npy(msg)
self.data[self.depth_image_str] = conv.img_to_npy(msg)

if DEBUG:
cv2.imshow("depth", self.depth_image)
cv2.imshow("depth", self.data[self.depth_image_str])

def point_callback(self, msg):
self.points = conv.pointcloud2_to_npy(msg)
def points_callback(self, msg):
self.data[self.points_str] = conv.pointcloud2_to_npy(msg)

if DEBUG:
points = self.points[:, :3]
points = self.data[self.points_str][:, :3]
points = points[:, [1, 0, 2]]
points[:, 0] *= -1
vis.update_visualizer_window(self.window, points[:,:3])
Expand All @@ -111,7 +114,7 @@ def point_callback(self, msg):
def main(args=None):
rclpy.init(args=args)

# enable the debug flag for visualizations
# enable the debug flag for sexy visualizations
global DEBUG
DEBUG = True

Expand All @@ -122,7 +125,7 @@ def main(args=None):
data_node.destroy_node()
rclpy.shutdown()

pass
return

if __name__ == "__main__":
main()
Loading
Loading