Skip to content

Feature/add lidar depth #9

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Feature/add lidar depth #9

wants to merge 5 commits into from

Conversation

AndyLi23
Copy link
Member

I did change how the params files are handled to reduce repetition, so changes might be breaking:

  • run_data = {**data, **data[run]} in data_params.py makes it possible to have params shared between runs AND params specific to runs (e.g. same robot topics, different timestamps for different runs).

  • The time params format was redundant, I changed it so all that is needed to set the start & end time is:

time:
    t0: ?
    tf: ?
    relative: ?
  • To toggle lidar globally or for each run: use_pointcloud: True or depth_source: 'pointcloud'

Example showing these changes:

runs: ['a', 'b']
run_env: "ROBOT"
dt: 0.16666666666666667

'a':
    time: 
        ...
    use_pointcloud: False
'b':
    time:
        ...
    use_pointcloud: True

pointcloud_data:
    path: ${BAGS_PATH}/${ROBOT}.bag
    topic: /lidar_points

Still needs official documentation & probably some cleanup, but wanted to start the merging process.

@AndyLi23 AndyLi23 closed this May 15, 2025
@AndyLi23
Copy link
Member Author

New documentation is in feature/better-submap-align.

@AndyLi23 AndyLi23 reopened this May 15, 2025
Comment on lines +58 to +62
img_header = self.img_data.img_header(t)

# get exact times of point cloud and image messages
pointcloud_time = pcl.header.stamp.sec + 1e-9 * pcl.header.stamp.nanosec
img_time = img_header.stamp.sec + 1e-9 * img_header.stamp.nanosec
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using the header attribute constrains us to only using ros data. The robot data should all be essentially a list of times and datapoints at those times, so you should be able to get the time with:

pointcloud_time = self.pointcloud_data.nearest_time(t)
img_time = self.img_data.nearest_time(t)

And that way if we want to use pointclouds from other source we aren't accessing a non-existant header

@@ -111,13 +114,14 @@ def __init__(self,
or self.rotate_img == '180', "Invalid rotate_img option."

@classmethod
def from_params(cls, params: FastSAMParams, depth_cam_params: CameraParams):
def from_params(cls, params: FastSAMParams, depth_cam_params: CameraParams, use_pointcloud: bool):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make use_pointcloud part of the FastSAM params? The params in FastSAM are a mess and we should probably clean them up, but one of the things I wanted to do with the from_params function is try to contain things a little bit so that when using the FastsamWrapper you only have to think about things in one central place.

eroded_mask = cv.erode(mask, self.erosion_element)
depth_obj[eroded_mask==0] = 0
if depth_data is not None:
if self.use_pointcloud:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we clean up these comments a bit for the PR?

self.fastsam = FastSAMWrapper.from_params(params=self.fastsam_params,
depth_cam_params=self.img_data.camera_params if self.data_params.use_pointcloud else
self.depth_data.camera_params,
use_pointcloud=self.data_params.use_pointcloud) # TODO: clean up?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See earlier, but I think we should just add a param to the fastsam params for pointcloud as well. It's a bit redundant but also makes it more general to running online (in ros) and not using this offline runner.

Copy link
Collaborator

@mbpeterson70 mbpeterson70 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AndyLi23 this looks good to me! If you can make the few changes above this should be good to get merged in!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants