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

Tape Measure Plugin #456

Merged
merged 29 commits into from
Dec 16, 2020
Merged

Tape Measure Plugin #456

merged 29 commits into from
Dec 16, 2020

Conversation

JShep1
Copy link

@JShep1 JShep1 commented Nov 11, 2020

An initial prototype of the tape measure plugin.

Hotkey for new measurement: m

See also #458 for right click mid-measure-action cancellation.

I made a few decisions here that I think we can discuss and possibly change:

  • I added gui events for a mouse hover and the left click event in Scene3D. My reasoning was primarily that I needed to get the data from the ScreenToScene() call within Scene3D but didn't want to couple this plugin together with Scene3D itself. I'm not sure if this is the best route to go, but it was the best I could think of for now, are there any other better ideas as to how to do this? I was thinking we could eventually move the gui events header to ign-common so that ign-gui can contain plugins like this that don't depend on the ecm but still need data from the Scene3D would this be a reasonable path? Any foreseen issues?
  • I only added singular measurements for now. There are a couple main reasons. The first is that text markers are only currently supported in OGRE 1.x, if we had multiple markers in a OGRE 2 scene, the user would have no way of knowing what the distance would be for each measurement. For this reason, I simply put the distance for the measurement within the gui window. The second reason is that we have no way of being able to selectively remove specific measurements if multiple existed within the scene. We will need to add support for user interaction with markers for this to be possible.

Additionally, @ColeOSRF is working on new icons for the measurement button and the delete button.

Example:
tapemeasure

Depends on gazebosim/gz-gui#148 for gui events

John Shepherd added 5 commits October 21, 2020 23:13
Signed-off-by: John Shepherd <[email protected]>
Signed-off-by: John Shepherd <[email protected]>
Signed-off-by: John Shepherd <[email protected]>
Signed-off-by: John Shepherd <[email protected]>
Signed-off-by: John Shepherd <[email protected]>
@github-actions github-actions bot added the 🏰 citadel Ignition Citadel label Nov 11, 2020
@JShep1 JShep1 added the enhancement New feature or request label Nov 11, 2020
John Shepherd added 4 commits November 10, 2020 17:02
Signed-off-by: John Shepherd <[email protected]>
Signed-off-by: John Shepherd <[email protected]>
Signed-off-by: John Shepherd <[email protected]>
Signed-off-by: John Shepherd <[email protected]>
@chapulina chapulina added the GUI Gazebo's graphical interface (not pure Ignition GUI) label Nov 11, 2020
@JShep1
Copy link
Author

JShep1 commented Nov 11, 2020

Design doc for this plugin can be found here https:/ignitionrobotics/design/blob/master/tape_measure_tool.md

John Shepherd added 5 commits November 11, 2020 10:34
Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

Works well for me.

I don't think that this can be avoided if we use the MarkerManager, but a user could send a DELETE_ALL at any time and mess up the tape measure's markers. I think the least we can do is be prepared in case this happens, by never assuming the markers we placed will be there.

I tried calling the following service while using the tape measure, and the worst I could get is that one of the end markers disappears, but not both. You can also end up with no markers, but the distance is non-zero. I think these aren't big issues, but just something to keep in mind.

ign service -s /marker --reqtype ignition.msgs.Marker --reptype ignition.msgs.Empty --timeout 2000 --req "action: DELETE_ALL"

src/gui/plugins/tape_measure/TapeMeasure.cc Outdated Show resolved Hide resolved
src/gui/plugins/tape_measure/TapeMeasure.qml Show resolved Hide resolved
src/gui/plugins/scene3d/Scene3D.cc Show resolved Hide resolved
src/gui/plugins/tape_measure/TapeMeasure.cc Outdated Show resolved Hide resolved
markerMsg.set_action(ignition::msgs::Marker::ADD_MODIFY);
markerMsg.set_type(ignition::msgs::Marker::SPHERE);
ignition::msgs::Set(markerMsg.mutable_scale(),
ignition::math::Vector3d(0.1, 0.1, 0.1));
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this will probably be complicated to achieve with markers, but I'll just make an observation for the future.

The fixed scale means that the points may be too big or too small depending on what's being simulated and the user's zoom level. Maybe they're too big to measure the distance between fingers of a robot hand, but too small when measuring the size of a road. One option would be to scale it according to the zoom level like it's done for the transform controls:

scale_tape

Copy link
Author

Choose a reason for hiding this comment

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

Good point, I believe that functionality is coming from this line? After thinking about it for a second, I think the effect comes from the world "moving away" and the visual gizmo staying the same size. @ColeOSRF do you know how this tool is usually handled in large vs small scenarios and when the user is zooming in and out?

src/gui/plugins/tape_measure/TapeMeasure.cc Outdated Show resolved Hide resolved
src/gui/plugins/tape_measure/TapeMeasure.qml Outdated Show resolved Hide resolved
src/gui/plugins/tape_measure/TapeMeasure.qml Outdated Show resolved Hide resolved
src/gui/plugins/tape_measure/TapeMeasure.qml Outdated Show resolved Hide resolved
@JShep1 JShep1 added the needs upstream release Blocked by a release of an upstream library label Nov 20, 2020
@chapulina
Copy link
Contributor

Just dropping a cross-reference link here. This requires: gazebosim/gz-gui#148

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

Works for me! Before merging this, we need to:

@JShep1 JShep1 removed the needs upstream release Blocked by a release of an upstream library label Dec 16, 2020
Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

🚀

@chapulina chapulina merged commit 3a09c86 into ign-gazebo3 Dec 16, 2020
@chapulina chapulina deleted the jshep1/tape_measure_plugin branch December 16, 2020 19:17
@adlarkin adlarkin mentioned this pull request Dec 18, 2020
Lobotuerk added a commit to Lobotuerk/ign-gazebo that referenced this pull request Jan 11, 2021
* Initial commit

Signed-off-by: Martiño Crespo <[email protected]>

* Added plugin files

Signed-off-by: Martiño Crespo <[email protected]>

* Initial .sdf file

Signed-off-by: Martiño Crespo <[email protected]>

* Pipeline for getting sensor contacts

Signed-off-by: Martiño Crespo <[email protected]>

* Added visualization of postion and forces

Signed-off-by: Martiño Crespo <[email protected]>

* Added plugin for Transform Control

Signed-off-by: Martiño Crespo <[email protected]>

* Added initial interpolation

Signed-off-by: Martiño Crespo <[email protected]>

* Code check

Signed-off-by: Martiño Crespo <[email protected]>

* Update info after specified milliseconds

Signed-off-by: Martiño Crespo <[email protected]>

* Set marker lifetime for better performance

Signed-off-by: Martiño Crespo <[email protected]>

* Added Depth Camera

Signed-off-by: Martiño Crespo <[email protected]>

* Added callback and unpacking to Depth Camera messages

Signed-off-by: Martiño Crespo <[email protected]>

* Compute and visualize normal forces

Signed-off-by: Martiño Crespo <[email protected]>

* PR Feedback 1

Signed-off-by: Martiño Crespo <[email protected]>

* Update sdf example to a more realistic environment

Signed-off-by: Martiño Crespo <[email protected]>

* Allow moving Depth Camera from model origin

Signed-off-by: Martiño Crespo <[email protected]>

* Make markers dimensions available as parameters

Signed-off-by: Martiño Crespo <[email protected]>

* Visualize sensor as a marker instead of <visual> and filter out normal forces outside sensor

Signed-off-by: Martiño Crespo <[email protected]>

* PR Feedback 2

Signed-off-by: Martiño Crespo <[email protected]>

* PR Feedback 3

Signed-off-by: Martiño Crespo <[email protected]>

* Minor fixes for sdf, sensor marker and profiler

Signed-off-by: Martiño Crespo <[email protected]>

* PR Feedback 4

Signed-off-by: Martiño Crespo <[email protected]>

* fix mac warning

Signed-off-by: Mabel Zhang <[email protected]>

* Helper function to set component data (gazebosim#436)

Signed-off-by: Louise Poubel <[email protected]>

* Remove unneeded if statement (gazebosim#432)

Signed-off-by: John Shepherd <[email protected]>

* Fixes flaky RecordAndPlayback test in INTEGRATION_log_system (gazebosim#463)

The flakiness comes from two sources:
1. Poses recorded by the LogRecorder are published by the
   SceneBroadcaster system throttled at 60 Hz. The throttle mechanism
   uses real-time instead of sim-time which causes a variance in the
   number of recorded poses from run to run. However, the expected number of
   recorded poses was calculated with the assumption that the simulation
   would run with a 1.0 RTF. If the CPU load is high, there could be a
   mismatch between the expected and the actual number of recorded
   poses, which causes the test to fail.
   This can be checked by running the test with
`cpulimit -l 20 -f  bin/INTEGRATION_log_system  -- --gtest_filter="*RecordAndPlayback"`

2. An attempt is made to match up played back poses with the closest
   timestamp in the recorded file. These poses are again published by
   the SceneBroadcaster, so they are subject to the same kind of timing
   issues as the recorded poses.

The solution in this patch for the first issue is to determine the
expected number of recorded poses by counting them in a separate system
that mimics the throttling mechanism of ign-transport. For the second
issue, a testing system is added to the playback server bypassing the
SceSceneBroadcaster altogether.

Signed-off-by: Addisu Z. Taddese <[email protected]>

* Make PeerTracker test more robust (gazebosim#452)

Signed-off-by: Louise Poubel <[email protected]>

Co-authored-by: Michael Carroll <[email protected]>

* Clarify how sim time is interpreted in a System's step (gazebosim#467)

Signed-off-by: Ashton Larkin <[email protected]>

* 3 ➡️  4: fixes for gazebosim#463 (gazebosim#469)

Signed-off-by: Louise Poubel <[email protected]>

* Link link tutrial (gazebosim#472)

Signed-off-by: Louise Poubel <[email protected]>

* Switch to async state service request (gazebosim#461)

Signed-off-by: Ian Chen <[email protected]>

* Use a std::promise/std::future to avoid busy waiting the step ack messages in NetworkManagerPrimary (gazebosim#470)

Signed-off-by: Ivan Santiago Paunovic <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>

Co-authored-by: Louise Poubel <[email protected]>

* Fix tests that use Fuel paths with uppercase letters (gazebosim#480)

As of gazebosim/gz-fuel-tools#130, fuel paths use all lowercase letters. This fixes some tests that had uppercase letters.
Signed-off-by: Addisu Z. Taddese <[email protected]>

* 4.1.0 (gazebosim#485)

Signed-off-by: Ashton Larkin <[email protected]>

* Update key event handling (gazebosim#466)

Signed-off-by: John Shepherd <[email protected]>

* Fix slot in Plotting plugin (gazebosim#490)

Signed-off-by: Alejandro Hernández <[email protected]>

* Tape Measure Plugin (gazebosim#456)

Signed-off-by: John Shepherd <[email protected]>

* Satisfy make codecheck (gazebosim#491)

Signed-off-by: Louise Poubel <[email protected]>

* Move deselect and preview termination to render thread (gazebosim#493)

Signed-off-by: John Shepherd <[email protected]>

* Fix codecheck (gazebosim#499)

Signed-off-by: Nate Koenig <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>

* Logical Audio Sensor Plugin (gazebosim#401)

Signed-off-by: Ashton Larkin <[email protected]>

* Codecheck - initialize primitive in LogicalAudio component (gazebosim#502)

Signed-off-by: Ashton Larkin <[email protected]>

* 3 to 4: fix codecheck for ign-gazebo4

Signed-off-by: Ashton Larkin <[email protected]>

* 3 to 4: resolve codecheck warnings

Signed-off-by: Ashton Larkin <[email protected]>

* add frame_id and child_frame_id attribute support for DiffDrive (gazebosim#361)

Add configuration of the odom frame_id and child_frame_id fields from sdf attributes <frame_id> and <child_frame_id>

Signed-off-by: Guillaume <[email protected]>
Signed-off-by: Guillaume Doisy <[email protected]>

* Require ign-gui 4.1.0 (gazebosim#505)

Signed-off-by: Louise Poubel <[email protected]>

* Fix shadow artifacts by disabling double sided rendering (gazebosim#446)

* read double sided sdf param

Signed-off-by: Ian Chen <[email protected]>

* update migration

Signed-off-by: Ian Chen <[email protected]>

* Make the tunnels example world more interesting (gazebosim#462)

Signed-off-by: Louise Poubel <[email protected]>

* add double sided msg to sdf conversion

Signed-off-by: Ian Chen <[email protected]>

Co-authored-by: Louise Poubel <[email protected]>

* Add ability to record video based on sim time (gazebosim#414)

* add ability to record video from gui camera using sim time

Signed-off-by: Ian Chen <[email protected]>

* add msg

Signed-off-by: Ian Chen <[email protected]>

* use QueryBoolText

Signed-off-by: Ian Chen <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: Louise Poubel <[email protected]>

* Add lockstep mode to video recording (gazebosim#419)

Signed-off-by: Ian Chen <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: Louise Poubel <[email protected]>

* Kinetic energy monitor plugin (gazebosim#492)

Signed-off-by: Gonzalo de Pedro <[email protected]>
Signed-off-by: Nate Koenig <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: Louise Poubel <[email protected]>

* Disable right click menu when using measuring tool (gazebosim#458)

Signed-off-by: John Shepherd <[email protected]>

Co-authored-by: Louise Poubel <[email protected]>

* Bump to 3.6.0 (gazebosim#524)

Signed-off-by: Louise Poubel <[email protected]>

* Don't make docs on macOS (gazebosim#528)

add comment about doxygen bug

Signed-off-by: Louise Poubel <[email protected]>
Signed-off-by: Steve Peters <[email protected]>

Co-authored-by: Louise Poubel <[email protected]>

* Updates to ardupilot migration tutorial (gazebosim#525)

Signed-off-by: Louise Poubel <[email protected]>

* Update gtest to 1.10.0 for Windows compilation (ign-gazebo3) (gazebosim#506)

* Compile new gtest with c++11
* Use INSTANTIATE_TEST_SUITE_P instead of deprecated -INSTANTIATE_TEST_CASE_P

Signed-off-by: Jose Luis Rivero <[email protected]>

* Apply suggestions from code review

Signed-off-by: Michael Carroll <[email protected]>

Co-authored-by: Louise Poubel <[email protected]>

* change nullptr to a int ptr for qt 5.15.2 bug (gazebosim#527)

See: https://bugreports.qt.io/browse/QTBUG-89114
Signed-off-by: acxz <[email protected]>

Co-authored-by: Louise Poubel <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>

* Generate valid topics everywhere (support names with spaces) (gazebosim#522)

Signed-off-by: Louise Poubel <[email protected]>

* One more tutorial version bump

Signed-off-by: Michael Carroll <[email protected]>

* Fix bad merge

Signed-off-by: Michael Carroll <[email protected]>

* change nullptr to a int ptr for qt 5.15.2 bug (gazebosim#527)

See: https://bugreports.qt.io/browse/QTBUG-89114
Signed-off-by: acxz <[email protected]>

Co-authored-by: Louise Poubel <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>

* Generate valid topics everywhere (support names with spaces) (gazebosim#522)

Signed-off-by: Louise Poubel <[email protected]>

* Change deprecated test case->suite

Signed-off-by: Michael Carroll <[email protected]>

* 3 ➡️ 4 (gazebosim#533)

* Clarify how sim time is interpreted in a System's step (gazebosim#467)
* add frame_id and child_frame_id attribute support for DiffDrive (gazebosim#361)
* Add ability to record video based on sim time (gazebosim#414)
* add ability to record video from gui camera using sim time
* add msg
* use QueryBoolText
* Add lockstep mode to video recording (gazebosim#419)
* Disable right click menu when using measuring tool (gazebosim#458)
* Bump to 3.6.0 (gazebosim#524)
* Don't make docs on macOS (gazebosim#528)
* Updates to ardupilot migration tutorial (gazebosim#525)
* Update gtest to 1.10.0 for Windows compilation (ign-gazebo3) (gazebosim#506)
* Compile new gtest with c++11
* Use INSTANTIATE_TEST_SUITE_P instead of deprecated -INSTANTIATE_TEST_CASE_P
* Apply suggestions from code review
* One more tutorial version bump
* Fix bad merge
* change nullptr to a int ptr for qt 5.15.2 bug (gazebosim#527)
* Generate valid topics everywhere (support names with spaces) (gazebosim#522)
* Change deprecated test case->suite

Co-authored-by: Ashton Larkin <[email protected]>
Co-authored-by: G.Doisy <[email protected]>
Co-authored-by: Ian Chen <[email protected]>
Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: Louise Poubel <[email protected]>
Co-authored-by: John Shepherd <[email protected]>
Co-authored-by: Steve Peters <[email protected]>
Co-authored-by: Jose Luis Rivero <[email protected]>
Co-authored-by: Akash Patel <[email protected]>

* Add support for topic statistics on breadcrumb deployments (gazebosim#532)

* Add support for topic statistics on breadcrumb deployments

Signed-off-by: Nate Koenig <[email protected]>

* Require version 9.1 of ignition transport

Signed-off-by: Nate Koenig <[email protected]>

* Move to after mutex

Signed-off-by: Nate Koenig <[email protected]>

Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: Carlos Agüero <[email protected]>

Co-authored-by: Martiño Crespo <[email protected]>
Co-authored-by: Louise Poubel <[email protected]>
Co-authored-by: Mabel Zhang <[email protected]>
Co-authored-by: John Shepherd <[email protected]>
Co-authored-by: Addisu Z. Taddese <[email protected]>
Co-authored-by: Michael Carroll <[email protected]>
Co-authored-by: Ashton Larkin <[email protected]>
Co-authored-by: Ian Chen <[email protected]>
Co-authored-by: Ivan Santiago Paunovic <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: Nate Koenig <[email protected]>
Co-authored-by: G.Doisy <[email protected]>
Co-authored-by: Gonzo <[email protected]>
Co-authored-by: Steve Peters <[email protected]>
Co-authored-by: Jose Luis Rivero <[email protected]>
Co-authored-by: Akash Patel <[email protected]>
Co-authored-by: Carlos Agüero <[email protected]>
@ahcorde ahcorde mentioned this pull request Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel enhancement New feature or request GUI Gazebo's graphical interface (not pure Ignition GUI)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants