Minor virtual radar improvements#1
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors odometry plotting into a reusable function, enhances the sample teach‐submaps script with save options for point clouds, and adds a helper for radar‐based point cloud filtering.
- Extracts and centralizes 3D odometry path plotting into
plot_odometry_path. - Introduces
--save_pc/--save_dirarguments and point‐cloud saving (individual & accumulated) inplot_teach_submaps.py. - Adds
pix4d2radar.pyto filter point clouds based on a radar’s conic field of view.
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vtr_odom_extractor/relative_export_odometry_path.py | Extract plot_odometry_path and replace duplicated inline odometry plotting |
| samples/plot_teach_submaps.py | Add CLI flags for saving point clouds and implement per‐cloud and accumulated writes |
| helpers/pix4d2radar.py | New script to load, filter, and save radar‐cropped point clouds based on angle & range |
Comments suppressed due to low confidence (2)
src/vtr_odom_extractor/relative_export_odometry_path.py:12
- [nitpick] The newly introduced 'plot_odometry_path' function lacks unit or integration tests. Consider adding tests to validate the plotted boundary calculations and ensure it handles edge cases.
def plot_odometry_path(positions):
src/vtr_odom_extractor/relative_export_odometry_path.py:20
- The function uses 'np' without importing numpy in this module, which will cause a NameError. Please add 'import numpy as np' at the top of the file.
max_range = np.array([positions[:,0].max()-positions[:,0].min(),
|
|
||
| # Accumulate all points for this major_id | ||
| if args.save_pc: | ||
| accumulated_points.append(new_points.T) |
There was a problem hiding this comment.
Appending 'new_points.T' transposes each point set to shape (3, N), which will misalign when vstacking later. Use 'new_points' (shape N×3) instead of its transpose.
| accumulated_points.append(new_points.T) | |
| accumulated_points.append(new_points) |
|
|
||
| # Input and output file paths | ||
| input_ply = "point_clouds/pin_4_crop_sub.ply" | ||
| output_ply = "point_clouds/pin_4_filtered.ply" |
There was a problem hiding this comment.
[nitpick] The script uses hardcoded file paths and parameters (e.g., input_ply, output_ply, base heights). Consider adding argparse support to make these values configurable and remove magic numbers for better flexibility.
| # Input and output file paths | |
| input_ply = "point_clouds/pin_4_crop_sub.ply" | |
| output_ply = "point_clouds/pin_4_filtered.ply" | |
| import argparse | |
| # Parse command-line arguments | |
| parser = argparse.ArgumentParser(description="Filter point cloud based on radar parameters.") | |
| parser.add_argument("--input_ply", type=str, default="point_clouds/pin_4_crop_sub.ply", help="Path to input PLY file.") | |
| parser.add_argument("--output_ply", type=str, default="point_clouds/pin_4_filtered.ply", help="Path to output PLY file.") | |
| parser.add_argument("--pix4d_pc_base_height", type=float, default=-12, help="Base height of the Pix4D point cloud.") | |
| parser.add_argument("--radar_height", type=float, default=1.5, help="Height of the radar above the base.") | |
| parser.add_argument("--radar_angle", type=float, default=2, help="Radar angle in degrees.") | |
| parser.add_argument("--radar_range", type=float, default=20, help="Radar range in meters.") | |
| args = parser.parse_args() | |
| # Input and output file paths | |
| input_ply = args.input_ply | |
| output_ply = args.output_ply |
Added specific functions for radar cropping and fixed issues odom plotting behavior.