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

Add arrow to selected lanes #223

Merged
merged 3 commits into from
Aug 29, 2019
Merged

Conversation

BMarchi
Copy link

@BMarchi BMarchi commented Aug 14, 2019

Ready for review

@BMarchi BMarchi force-pushed the bmarchi/add_arrow_to_selected_lanes branch 3 times, most recently from 895035b to eaaca3e Compare August 16, 2019 17:23
moveDown = true;
currentTick = 0;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@BMarchi haha you did it. Consider turning moveDown into a an integer that can be either -1 or 1 and multiples step before summation. It'll simplify the code.

Copy link
Contributor

Choose a reason for hiding this comment

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

@BMarchi nit: can we call moveDown something else e.g. currentDirection ?


public:

/// \brief Constructor. Creates a cone and adds it as a child to the RootVisual of the scene, which will move
Copy link
Contributor

Choose a reason for hiding this comment

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

@BMarchi consider removing Constructor., it is somewhat redundant.

/// \brief Moves the arrow to a given world position and resets the downwards movement.
/// \param[in] _distanceFromCamera How far the camera is from the clicked point.
/// \param[in] _worldPosition World position of the cursor ray cast click.
void MoveArrowAt(double _distanceFromCamera, const ignition::math::Vector3d& _worldPosition);
Copy link
Contributor

Choose a reason for hiding this comment

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

@BMarchi I'm not sure MoveArrowAt expresses the intent you describe in the documentation. Consider HoverOver or something along those lines.

void MoveArrowAt(double _distanceFromCamera, const ignition::math::Vector3d& _worldPosition);
/// \brief Toggles the visibility of the arrow.
/// \param[in] _visible Boolean that determines if the arrow should be visible or not.
void SetArrowVisibility(bool _visible);
Copy link
Contributor

Choose a reason for hiding this comment

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

@BMarchi consider SetVisibility, Arrow is likely redundant.


const double scaleIncrement = 1.0 + scaleFactor * _distanceFromCamera;
const double newMinBBZAxis = scaleIncrement * minBoundingBox.Z();
this->arrow->SetWorldScale(scaleIncrement, scaleIncrement, scaleIncrement);
Copy link
Contributor

Choose a reason for hiding this comment

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

@BMarchi I see what you're doing here, but does it scale appropriately if you zoom in/out? Should the scaling code be separate and called upon zoom?

Copy link
Author

Choose a reason for hiding this comment

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

In practice it looks fine to me. I wanted to avoid user interaction with the arrow's scale directly

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I'll take a look locally.

@BMarchi BMarchi force-pushed the bmarchi/add_arrow_to_selected_lanes branch from eaaca3e to 4e6372c Compare August 20, 2019 12:40
moveDown = true;
currentTick = 0;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@BMarchi nit: can we call moveDown something else e.g. currentDirection ?

/// \brief Move the arrow based on the distance travelled by the camera's ray distance.
/// \param[in] _distance Distance travelled from the camera's world position to the clicked object.
/// \param[in] _worldPosition Position where the camera's ray hit.
void MoveArrowAt(double _distance, const ignition::math::Vector3d& _worldPosition);
Copy link
Contributor

Choose a reason for hiding this comment

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

@BMarchi PutArrowAt ?

/// \param[in] _distanceFromCamera How far the camera is from the clicked point.
/// \param[in] _worldPosition World position of the cursor ray cast click.
void SelectAt(double _distanceFromCamera, const ignition::math::Vector3d& _worldPosition);
/// \brief Toggles the visibility of the arrow.
Copy link
Contributor

Choose a reason for hiding this comment

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

@BMarchi nit: add one extra blank line here.


const double scaleIncrement = 1.0 + scaleFactor * _distanceFromCamera;
const double newMinBBZAxis = scaleIncrement * minBoundingBox.Z();
this->arrow->SetWorldScale(scaleIncrement, scaleIncrement, scaleIncrement);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I'll take a look locally.

@BMarchi BMarchi force-pushed the bmarchi/add_arrow_to_selected_lanes branch from 4e6372c to ab8d180 Compare August 20, 2019 15:09
@BMarchi BMarchi requested a review from hidmic August 20, 2019 15:19
@hidmic hidmic mentioned this pull request Aug 20, 2019
14 tasks
@hidmic
Copy link
Contributor

hidmic commented Aug 20, 2019

Feedback from @liangfok and @andrewbest-tri: lower the arrow so that it lays closer to the lane surface and casted shadows become a better indicator.

@liangfok
Copy link
Collaborator

Can you post a screenshot?

@BMarchi
Copy link
Author

BMarchi commented Aug 22, 2019

This is how it looks
arrow1

@liangfok
Copy link
Collaborator

Looks good. Thanks for the screenshot. Perhaps changing the color of the yellow edge of the lane that's selected, it'll be even more clear. When there's multiple overlapping lanes with no height difference, like at an intersection, I wander if we can click multiple times, each time changing which of the N overlapping lanes is selected.

@BMarchi
Copy link
Author

BMarchi commented Aug 22, 2019

For the moment, we can't do anything to a single lane, since the road is only one mesh, so changing the material will imply that the whole road will change. #218 explains the problems we have. This is meant to be a quick and cheap solution (better than nothing) until we can find out how to make a proper outline since it's not easy to do

@BMarchi BMarchi force-pushed the bmarchi/add_widget_for_rules_visualization branch from 311ba5f to bc5542d Compare August 23, 2019 11:27
hidmic
hidmic previously approved these changes Aug 23, 2019
Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

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

LGTM pending conflict resolution

@BMarchi BMarchi force-pushed the bmarchi/add_arrow_to_selected_lanes branch from 2c268b0 to 1bd709c Compare August 26, 2019 13:33
@BMarchi BMarchi changed the base branch from bmarchi/add_widget_for_rules_visualization to master August 26, 2019 13:34
@BMarchi BMarchi requested a review from hidmic August 26, 2019 13:35
ignition::math::Vector3d worldPosition = this->arrow->WorldPosition();
this->arrow->SetWorldPosition(worldPosition.X(), worldPosition.Y(), worldPosition.Z() + currentDirection * step);
++currentTick;
if (currentTick == totalTicks) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@BMarchi nit: last two lines could be collapsed into one.

this->cylinder->SetVisible(false);
this->cylinder->SetWorldPosition(0., 0., 0.);
// This size is enough for visualization.
this->cylinder->SetWorldScale(0.5, 0.5, 0.2);
Copy link
Contributor

Choose a reason for hiding this comment

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

@BMarchi as I told you offline, this is likely to run into some issues when dealing with very small lanes. Unless we somehow bound its size by the lane's area, which is going to be tough. Maybe once we get an outline we don't need this one anymore?

Copy link
Author

Choose a reason for hiding this comment

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

The arrow is useful but I think that with the outliner, the cylinder isn't necessary

hidmic
hidmic previously approved these changes Aug 26, 2019
Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

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

LGTM!

hidmic
hidmic previously approved these changes Aug 28, 2019
Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

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

LGTM pending green CI

Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

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

LGTM as soon as CI catches up.

@BMarchi BMarchi merged commit 8f3f999 into master Aug 29, 2019
@BMarchi BMarchi deleted the bmarchi/add_arrow_to_selected_lanes branch September 18, 2019 13:17
@stonier stonier mentioned this pull request Dec 6, 2022
16 tasks
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.

3 participants