-
Notifications
You must be signed in to change notification settings - Fork 43
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
Rbs se3 viz #153
Open
mmaurus
wants to merge
5
commits into
rock-core:master
Choose a base branch
from
mmaurus:RBS_SE3_viz
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Rbs se3 viz #153
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
67bd987
added visualizer for RigidBodyStateSE3 and Wrench
mmaurus ae55026
using osgviz PrimitivesFactory for displaying arrow and circular arro…
mmaurus e6b0c18
added test script vor wrench visualization
mmaurus 3374a61
fixed intendation and empty lines
mmaurus 3b0eaea
addded test for WrenchVisualization
mmaurus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
require_relative 'helpers' | ||
require 'orocos' | ||
Orocos.load_typekit 'base' | ||
|
||
module Vizkit | ||
describe 'WrenchVisualization' do | ||
include TestHelpers | ||
|
||
before do | ||
register_widget(@vizkit3d_widget = | ||
Vizkit.default_loader.create_plugin("vizkit3d::Vizkit3DWidget")) | ||
@viz = @vizkit3d_widget.createPlugin('base', 'WrenchVisualization') | ||
|
||
@wrench = Types.base.samples.Wrench.new | ||
@wrench.frame_id = "test_frame" | ||
@wrench.force = Types.base.Vector3d.new(1,1,1) | ||
@wrench.torque = Types.base.Vector3d.new(-1,-1,1) | ||
@viz.updateData(@wrench) | ||
|
||
@viz.setResolution(1.0) | ||
|
||
@vizkit3d_widget.setCameraEye(5, 4, 5) | ||
@vizkit3d_widget.setCameraLookAt(0, 0, 0) | ||
@vizkit3d_widget.show | ||
end | ||
|
||
# describe "updateData(Wrench)" do | ||
# @wrench = Types.base.samples.Wrench.new | ||
# @wrench.frame_id = "test_frame" | ||
# @wrench.force = Types.base.Vector3d.new(1,1,1) | ||
# @wrench.torque = Types.base.Vector3d.new(-1,-1,1) | ||
|
||
# it "updates wrench" do | ||
# @viz.updateData(@wrench) | ||
# confirm 'Force should be displayed as a red arrow from (0,0,0) to (1,1,1) and torque as a green arrow from (0,0,0) to (-1,-1,1) with a circular arrow rotating counter-clockwise around axis' | ||
# end | ||
|
||
# it "updates wrench" do | ||
# @wrench.force = Types.base.Vector3d.new(1,0,0) | ||
# @wrench.torque = Types.base.Vector3d.new(0,1,0) | ||
# @viz.updateData(@wrench) | ||
# confirm 'Force should be displayed as a red arrow from (0,0,0) to (1,0,0) and torque as a green arrow from (0,0,0) to (0,1,0) with a circular arrow rotating counter-clockwise around axis' | ||
# end | ||
|
||
# it "updates wrench" do | ||
# @wrench.force = Types.base.Vector3d.new(0,1,0) | ||
# @wrench.torque = Types.base.Vector3d.new(0,0,1) | ||
# @viz.updateData(@wrench) | ||
# confirm 'Force should be displayed as a red arrow from (0,0,0) to (0,1,0) and torque as a green arrow from (0,0,0) to (0,0,1) with a circular arrow rotating counter-clockwise around axis' | ||
# end | ||
|
||
# it "updates wrench" do | ||
# @wrench.force = Types.base.Vector3d.new(0,0,1) | ||
# @wrench.torque = Types.base.Vector3d.new(1,0,0) | ||
# @viz.updateData(@wrench) | ||
# confirm 'Force should be displayed as a red arrow from (0,0,0) to (0,0,1) and torque as a green arrow from (0,0,0) to (1,0,0) with a circular arrow rotating counter-clockwise around axis' | ||
# end | ||
|
||
# it "updates wrench" do | ||
# @wrench.force = Types.base.Vector3d.new(0,0,0) | ||
# @wrench.torque = Types.base.Vector3d.new(0,0,0) | ||
# @viz.updateData(@wrench) | ||
# confirm 'Nothing should be displayed' | ||
# end | ||
|
||
# it "updates wrench" do | ||
# @wrench.force = Types.base.Vector3d.new(0.1,0,0) | ||
# @wrench.torque = Types.base.Vector3d.new(0.3,0,0) | ||
# @viz.updateData(@wrench) | ||
# confirm 'Force should be displayed as a red arrow from (0,0,0) to (0,0,0.1) and torque as a green arrow from (0,0,0) to (0.3,0,0) with a circular arrow rotating counter-clockwise around axis. Both arrows should be displayed without the arrow head' | ||
# end | ||
# end | ||
|
||
describe "setSeperateAxesTorque" do | ||
it "displays torque axis component" do | ||
torque = Types.base.Vector3d.new(1,1,1) | ||
@viz.setTorque(torque) | ||
@viz.setSeperateAxesTorque(true) | ||
confirm 'Torque should be displayed as three arrows along axes each with length 1 and a circular arrow rotating counter-clockwise' | ||
|
||
end | ||
|
||
it "displays torque" do | ||
torque = Types.base.Vector3d.new(1,1,1) | ||
@viz.setTorque(torque) | ||
@viz.setSeperateAxesTorque(false) | ||
confirm 'Torque should be displayed as one arrows starting from (0,0,0) to (1,1,1) with circular arrow rotating counter-clockwise' | ||
end | ||
end | ||
|
||
describe "setSeperateAxesForce" do | ||
it "displays force axis component" do | ||
force = Types.base.Vector3d.new(1,1,1) | ||
@viz.setForce(force) | ||
@viz.setSeperateAxesForce(true) | ||
confirm 'Force should be displayed as three arrows along axes each with length 1' | ||
end | ||
|
||
it "displays force" do | ||
force = Types.base.Vector3d.new(1,1,1) | ||
@viz.setForce(force) | ||
@viz.setSeperateAxesForce(false) | ||
confirm 'Force should be displayed as one arrows starting from (0,0,0) to (1,1,1)' | ||
end | ||
end | ||
|
||
# describe "setResolution" do | ||
# wrench = Types.base.samples.Wrench.new | ||
# wrench.frame_id = "test_frame" | ||
# wrench.force = Types.base.Vector3d.new(1,0,0) | ||
# wrench.torque = Types.base.Vector3d.new(0,1,0) | ||
|
||
# it "sets resolution to 1" do | ||
# @viz.updateData(wrench) | ||
# @viz.setResolution(1.0) | ||
# confirm "Force and torque will be displayed as arrows from (0,0,0) to (1,0,0) / (0,1,0)" | ||
# end | ||
# it "it sets resolution to 0.1" do | ||
# @viz.updateData(wrench) | ||
# @viz.setResolution(0.1) | ||
# confirm "Force and torque will be displayed as arrows from (0,0,0) to (0.1,0,0) / (0,0.1,0) without arrow head" | ||
# end | ||
# end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really believe we should consider other alternatives before adding
osgViz
as a "hard" dependency inbase/types
.This is also breaking rock-core's build.
@doudou
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In practice, base/types already depends on
gui/vizkit3d
which depends on osgViz. The (optional) dependency should definitely be explicitly added to the manifest, though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that will be a problem in constrained environments (i.e embedded computers running iodrivers_base based drivers). Can we please don't do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The keyword was optional ;-). The dependency on osgViz that this PR adds is also optional as the whole
viz/
folder is disabled by the Rock CMake macros if vizkit3d is not available or if ROCK_VIZ_ENABLED is set to OFF.base/types already depends optionally on
gui/vizkit3d
. In constrained environments, you usually excludegui/.*
which removes that particular dependencyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed that, sorry. I guess I was misled by the breaking build (which is probably breaking for some other reason I didn't look into). Did this pass on your CI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is when building
base/types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what PrimitivesFactory is or where it comes from. I was looking at osgViz since it was what you mentioned in your comment.
Didn't check CI yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PrimitivesFactory is a module in osgViz