Skip to content

Add an example of using point cloud for motion planning in Python#94

Merged
zkingston merged 7 commits intoKavrakiLab:mainfrom
WeihangGuo:capt-demo
Feb 26, 2026
Merged

Add an example of using point cloud for motion planning in Python#94
zkingston merged 7 commits intoKavrakiLab:mainfrom
WeihangGuo:capt-demo

Conversation

@WeihangGuo
Copy link
Contributor

image

Copy link
Collaborator

@zkingston zkingston left a comment

Choose a reason for hiding this comment

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

Some small nits.

Comment on lines +37 to +48
def sample_sphere_surface(center, radius, n_points):
# Random spherical coordinates
phi = np.random.uniform(0, 2 * np.pi, n_points)
cos_theta = np.random.uniform(-1, 1, n_points)
theta = np.arccos(cos_theta)

x = radius * np.sin(theta) * np.cos(phi)
y = radius * np.sin(theta) * np.sin(phi)
z = radius * np.cos(theta)

points = np.vstack((x, y, z)).T
return points + center
Copy link
Collaborator

Choose a reason for hiding this comment

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

We already have this function in

def sphere_sample_surface(center, radius, num_points, noise):

Comment on lines +76 to +80
10, # max_range
[0.0, 0.0, 0.0], # origin
[-2.0, -2.0, -2.0], # workcell_min
[2.0, 2.0, 2.0], # workcell_max
True # cull
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should these perhaps be exposed as command line args if this script is supposed to demonstrate the filtering of the PC?

]


def sample_sphere_surface(center, radius, n_points):
Copy link
Collaborator

Choose a reason for hiding this comment

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

See prior comment.

[sample_sphere_surface(center, obstacle_radius, points_per_sphere) for center in problem]
)
point_cloud_colors = np.random.randint(100, 200, (point_cloud.shape[0], 3))
# point_cloud_colors = np.tile((255, 192, 203), (point_cloud.shape[0], 1))
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove?

Comment on lines +73 to +78
tf = np.identity(4)
tf[:3, 3] = np.array([0, 0, attachment_offset])
attachment = vamp.Attachment(tf)

# Add a single sphere to the attachment - spheres are added in the attachment's local frame
attachment.add_spheres([vamp.Sphere([0, 0, 0], attachment_radius)])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the attachment stuff necessary for this script as well?

@WeihangGuo
Copy link
Contributor Author

@zkingston Thank you for reviewing. I have addressed the comments.

@zkingston zkingston merged commit e3902f1 into KavrakiLab:main Feb 26, 2026
1 check passed
@WeihangGuo WeihangGuo deleted the capt-demo branch February 26, 2026 20:06
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