Skip to content

Target rel position#4

Open
VZhou07 wants to merge 13 commits intomainfrom
target_rel_position
Open

Target rel position#4
VZhou07 wants to merge 13 commits intomainfrom
target_rel_position

Conversation

@VZhou07
Copy link
Contributor

@VZhou07 VZhou07 commented Feb 9, 2026

Target Localizer

Copy link
Contributor

@honzikschenk honzikschenk left a comment

Choose a reason for hiding this comment

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

Initial review. Looks good so far!

ANGLE_THRESHOLD = 0.087 # ~= 5 degrees
PARALLEL_THRESHOLD = 0.5
bottom_corners = []
parallel_to_x = {
Copy link
Contributor

Choose a reason for hiding this comment

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

The perpendicular walls would not be parallel to x, thus this dict should have a different naming scheme

PARALLEL_THRESHOLD = 0.5
bottom_corners = []
parallel_to_x = {
"parallel1": None, # wall with cardinal direction, as first index in ordered dict
Copy link
Contributor

Choose a reason for hiding this comment

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

Please make the wall naming more obvious (parallel to what, 1/2 mean what for each side, etc)

Copy link
Contributor

Choose a reason for hiding this comment

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

Additionally, you don't need the initial dict. You can just build your named vectors immediately


MARGIN = 0.5
ANGLE_THRESHOLD = 0.087 # ~= 5 degrees
PARALLEL_THRESHOLD = 0.5
Copy link
Contributor

Choose a reason for hiding this comment

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

Please specify units, or what these measure

"perp1": None,
"perp2": None,
"parallel2": None,
"ground": None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Make the ground plane a different variable seperate from a wall dict (you can just set ground vector here)

parallel_to_x["ground"] = i
continue
dp = np.dot(wall_normal, np.array([1, 0, 0]))
angle = math.acos(np.clip(dp / (np.linalg.norm(wall_normal) * 1), -1, 1))
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't need to * 1 but I like what you did here

bottom_corners.append(corner2) # back corner

target_locations = []
for i in targets:
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you do something like for target in targets just for readability (and in any other relevant places in the code)

target_on_wall = False
target = np.array([i.location.x, i.location.y, i.location.z])
for j, k in zip(bottom_corners, list(parallel_to_x.values())[0:4]):
vector = np.subtract(target, j)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please make these variable names clearer

)
if (
angle > math.pi / 2 - ANGLE_THRESHOLD
and angle < math.pi / 2 + ANGLE_THRESHOLD
Copy link
Contributor

Choose a reason for hiding this comment

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

You can do abs(math.pi/2 - angle) < ANGLE_THRESHOLD instead

vector[1]
):
right, up = abs(vector[1]), abs(vector[2])
relative_position = Coordinate(0, right, up)
Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking that for the coordinate class, we always ignore z and treat x and y as right and up (relative to the specific wall in this case). This would be easier for the groundside data parser to understand

"parallel2": None,
"ground": None,
}
direction = ["NORTH", "EAST", "SOUTH", "WEST", "NORTH", "EAST", "SOUTH", "WEST"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Mayhaps there's a better way to do this than just hard-coding directions twice (referencing line 126 as well). I'll think about this while you look at the rest of the changes, and maybe we can brainstorm more. For now though, you could just mod the references to this list by its length

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