hpp-gepetto-viewer 6.1.0
Display of hpp robots and obstacles in gepetto-viewer
 
Loading...
Searching...
No Matches
gepetto.viewer.Viewer Class Reference

Public Member Functions

 __init__ (self, problemSolver, viewerClient=None, ghost=False, collisionURDF=False, displayName=None, displayArrows=False, displayCoM=False)
 
 createWindowAndScene (self, viewerClient, name)
 
 addCallback (self, cb)
 
 buildRobotBodies (self)
 
 addLandmark (self, linkname, size)
 
 displayPathMap (self, nameRoadmap, pathID, radiusSphere=0.03, sizeAxis=0.09, colorNode=[1, 0.0, 0.0, 1.0], colorEdge=[1, 0.0, 0.0, 0.5], joint=None)
 
 displayRoadmap (self, nameRoadmap, radiusSphere=0.01, sizeAxis=0.03, colorNode=[1.0, 1.0, 1.0, 1.0], colorEdge=[0.85, 0.75, 0.15, 0.7], joint=None)
 
 solveAndDisplay (self, nameRoadmap, numberIt, radiusSphere=0.01, sizeAxis=0.03, colorNode=[1.0, 1.0, 1.0, 1.0], colorEdge=[0.85, 0.75, 0.15, 0.7], joint=None)
 
 loadObstacleModel (self, filename, prefix, guiOnly=False)
 
 loadPolyhedronObstacleModel (self, name, filename, guiOnly=False)
 
 loadPointCloudFromPoints (self, str name, float resolution, list[Point3D] points, list[ColorRGBA]|None colors=None, bool guiOnly=False)
 
 moveObstacle (self, name, position, guiOnly=False)
 
 computeObjectPosition (self)
 
 publishRobots (self)
 
 __call__ (self, args)
 
 startCapture (self, filename, extension)
 
 stopCapture (self)
 
 captureFrame (self, filename)
 
 toggleVisual (self, visual)
 
 drawRobotAABB (self)
 

Public Attributes

 problemSolver = problemSolver
 
 robot = problemSolver.robot
 
 collisionURDF = collisionURDF
 
 color = Color()
 
 client = viewerClient
 
list callbacks = []
 
 displayName = displayName
 
 displayArrows = displayArrows
 
list colorVelocity = [0.2, 1, 0, 0.6]
 
list colorAcceleration = [1, 0, 0, 0.6]
 
float arrowRadius = 0.01
 
float arrowMinSize = 0.05
 
float arrowMaxSize = 1.0 - self.arrowMinSize
 
 amax
 
 vmax
 
 displayCoM = displayCoM
 
str windowName = "scene_" + name
 
 windowId = viewerClient.gui.getWindowID(self.windowName)
 
 robotBodies = list()
 
list guiObjectNames = [prefix + o for j, prefix, o in self.robotBodies]
 
list hppObjectNames = [o for j, prefix, o in self.robotBodies]
 
 robotConfig
 

Static Public Attributes

str sceneName = "0_scene_hpp_"
 
bool removeLightSources = True
 

Protected Member Functions

 _removeLightSources (self, nodes)
 
 _initDisplay (self)
 

Detailed Description

Simultaneous control of hppcorbaserver and gepetto-viewer-server

This class implements clients to both
\\li hppcorbaserver through hpp.corbaserver.problem_solver.ProblemSolver
    python class,
\\li gepetto-viewer-server through gepetto.corbaserver.Client python class.

Operation that need to be synchronized between hppcorbaserver internal
model and graphical user interface should be implemented by this class.

Constructor & Destructor Documentation

◆ __init__()

gepetto.viewer.Viewer.__init__ ( self,
problemSolver,
viewerClient = None,
ghost = False,
collisionURDF = False,
displayName = None,
displayArrows = False,
displayCoM = False )
Constructor
\\param problemSolver object of type ProblemSolver
\\param viewerClient if not provided, a new client to
       gepetto-viewer-server is created.
\\param displayArrow if True, the publish method will display 2 arrows
                     representing the velocity (green) and acceleration
                     (red) of the root.
           This parameter can only be used if the robot have at least 6
           extraDOF storing the velocity and acceleration of the root.
\\param displayCoM if True, the publish method will also display a small red
                   sphere representing the position of the CoM for the
                   published configuration.

The robot loaded in hppcorbaserver is loaded into gepetto-viewer-server.

Member Function Documentation

◆ __call__()

gepetto.viewer.Viewer.__call__ ( self,
args )

◆ _initDisplay()

gepetto.viewer.Viewer._initDisplay ( self)
protected

◆ _removeLightSources()

gepetto.viewer.Viewer._removeLightSources ( self,
nodes )
protected

◆ addCallback()

gepetto.viewer.Viewer.addCallback ( self,
cb )
\\param cb Callable object, whose arguments are this object
and a robot configuration.

◆ addLandmark()

gepetto.viewer.Viewer.addLandmark ( self,
linkname,
size )
 Add a landmark
\\sa gepetto::corbaserver::GraphicalInterface::addLandmark

◆ buildRobotBodies()

gepetto.viewer.Viewer.buildRobotBodies ( self)

◆ captureFrame()

gepetto.viewer.Viewer.captureFrame ( self,
filename )
Save current scene to image.
\\sa gepetto::corbaserver::GraphicalInterface::captureFrame

◆ computeObjectPosition()

gepetto.viewer.Viewer.computeObjectPosition ( self)
Synchronize object positions in gepetto-viewer-server

Get position of objects from hppcorbaserver and forward to
gepetto-viewer-server.

◆ createWindowAndScene()

gepetto.viewer.Viewer.createWindowAndScene ( self,
viewerClient,
name )

◆ displayPathMap()

gepetto.viewer.Viewer.displayPathMap ( self,
nameRoadmap,
pathID,
radiusSphere = 0.03,
sizeAxis = 0.09,
colorNode = [1, 0.0, 0.0, 1.0],
colorEdge = [1, 0.0, 0.0, 0.5],
joint = None )
Display the part of the roadmap used by the solution path
\\param nameRoadmap : the name of the osgNode added to the scene
\\param pathID : the id of the path we want to display
\\param radiusSphere : the radius of the node
\\param sizeAxis : size of axes (proportionnaly to the radius of the sphere)
                   0 = only sphere
\\param colorNode : the color of the sphere for the nodes (default value : red)
\\param colorEdge : the color of the edges (default value : light red)
\\param joint : the link we want to display the configuration
                (by defaut, root link of the robot)
BE CAREFULL : in the .py file wich init the robot, you must define a valid
                tf_root (this is the displayed joint by default)
notes : the edges are always straight lines and doesn't represent the real
        path beetwen the configurations of the nodes

◆ displayRoadmap()

gepetto.viewer.Viewer.displayRoadmap ( self,
nameRoadmap,
radiusSphere = 0.01,
sizeAxis = 0.03,
colorNode = [1.0, 1.0, 1.0, 1.0],
colorEdge = [0.85, 0.75, 0.15, 0.7],
joint = None )
Display the roadmap created by problem.solve()
\\param radiusSphere : the radius of the node
\\param sizeAxis : size of axes (proportionnaly to the radius of the sphere)
                  0 = only sphere
\\param colorNode : the color of the sphere for the nodes
                    (default value : white)
\\param colorEdge : the color of the edges (default value : yellow)
\\param joint : the link we want to display the configuration
               (by defaut, root link of the robot)
BE CAREFULL : in the .py file wich init the robot, you must define a valid
              tf_root (this is the displayed joint by default)
notes : the edges are always straight lines and doesn't represent the real
        path beetwen the configurations of the nodes

◆ drawRobotAABB()

gepetto.viewer.Viewer.drawRobotAABB ( self)

◆ loadObstacleModel()

gepetto.viewer.Viewer.loadObstacleModel ( self,
filename,
prefix,
guiOnly = False )
Load obstacles from a urdf file

\\param filename name of the urdf file, may contain "package://"
\\param prefix prefix added to object names in case the same file
       is loaded several times,
\\param guiOnly whether to control only gepetto-viewer-server

◆ loadPointCloudFromPoints()

gepetto.viewer.Viewer.loadPointCloudFromPoints ( self,
str name,
float resolution,
list[Point3D] points,
list[ColorRGBA] | None colors = None,
bool guiOnly = False )
Load a point cloud as an obstacle

\\param name name of the object,
\\param resolution the Octomap OcTree resolution.
\\param points a Nx3 matrix representing the points of the point cloud.
\\param colors a Nx4 matrix representing the colors of the point cloud, if any.
\\param guiOnly whether to control only gepetto-viewer-server

◆ loadPolyhedronObstacleModel()

gepetto.viewer.Viewer.loadPolyhedronObstacleModel ( self,
name,
filename,
guiOnly = False )
Load polyhedron from a 3D mesh file

\\param filename name of the 3D mesh file, may contain "package://"
\\param name name of the object,
\\param guiOnly whether to control only gepetto-viewer-server

◆ moveObstacle()

gepetto.viewer.Viewer.moveObstacle ( self,
name,
position,
guiOnly = False )
Move Obstacle

\\param name Name of the object
\\param position Position of the object as a 7-d vector
       (translation-quaternion)
\\param guiOnly whether to control only gepetto-viewer-server

◆ publishRobots()

gepetto.viewer.Viewer.publishRobots ( self)

◆ solveAndDisplay()

gepetto.viewer.Viewer.solveAndDisplay ( self,
nameRoadmap,
numberIt,
radiusSphere = 0.01,
sizeAxis = 0.03,
colorNode = [1.0, 1.0, 1.0, 1.0],
colorEdge = [0.85, 0.75, 0.15, 0.7],
joint = None )
build the roadmap and diplay it during construction
(delete existing roadmap if problem already solved )
\\param nameRoadmap : name of the new roadmap
\\param numberIt : number of iteration beetwen to refresh of the roadmap
(be careful, if numberIt is too low it can crash gepetto-viewer-server)
\\param radiusSphere : the radius of the node
\\param sizeAxis : size of axes (proportionnaly to the radius of the sphere)
                    0 = only sphere
\\param colorNode : the color of the sphere for the nodes
                    (default value : white)
\\param colorEdge : the color of the edges (default value : yellow)
\\param joint : the link we want to display the configuration
                (by defaut, root link of the robot)

◆ startCapture()

gepetto.viewer.Viewer.startCapture ( self,
filename,
extension )
Start a screen capture
\\sa gepetto::corbaserver::GraphicalInterface::startCapture

◆ stopCapture()

gepetto.viewer.Viewer.stopCapture ( self)
Stop a screen capture
\\sa gepetto::corbaserver::GraphicalInterface::stopCapture

◆ toggleVisual()

gepetto.viewer.Viewer.toggleVisual ( self,
visual )

Member Data Documentation

◆ amax

gepetto.viewer.Viewer.amax
Initial value:
= omniORB.any.from_any(
self.problemSolver.hppcorba.problem.getParameter(
"Kinodynamic/accelerationBound"
)
)

◆ arrowMaxSize

gepetto.viewer.Viewer.arrowMaxSize = 1.0 - self.arrowMinSize

◆ arrowMinSize

gepetto.viewer.Viewer.arrowMinSize = 0.05

◆ arrowRadius

gepetto.viewer.Viewer.arrowRadius = 0.01

◆ callbacks

list gepetto.viewer.Viewer.callbacks = []

◆ client

gepetto.viewer.Viewer.client = viewerClient

◆ collisionURDF

gepetto.viewer.Viewer.collisionURDF = collisionURDF

◆ color

gepetto.viewer.Viewer.color = Color()

◆ colorAcceleration

gepetto.viewer.Viewer.colorAcceleration = [1, 0, 0, 0.6]

◆ colorVelocity

gepetto.viewer.Viewer.colorVelocity = [0.2, 1, 0, 0.6]

◆ displayArrows

gepetto.viewer.Viewer.displayArrows = displayArrows

◆ displayCoM

gepetto.viewer.Viewer.displayCoM = displayCoM

◆ displayName

gepetto.viewer.Viewer.displayName = displayName

◆ guiObjectNames

gepetto.viewer.Viewer.guiObjectNames = [prefix + o for j, prefix, o in self.robotBodies]

◆ hppObjectNames

list gepetto.viewer.Viewer.hppObjectNames = [o for j, prefix, o in self.robotBodies]

◆ problemSolver

gepetto.viewer.Viewer.problemSolver = problemSolver

◆ removeLightSources

bool gepetto.viewer.Viewer.removeLightSources = True
static

◆ robot

gepetto.viewer.Viewer.robot = problemSolver.robot

◆ robotBodies

gepetto.viewer.Viewer.robotBodies = list()

◆ robotConfig

gepetto.viewer.Viewer.robotConfig

◆ sceneName

gepetto.viewer.Viewer.sceneName = "0_scene_hpp_"
static

◆ vmax

gepetto.viewer.Viewer.vmax
Initial value:
= omniORB.any.from_any(
self.problemSolver.hppcorba.problem.getParameter(
"Kinodynamic/velocityBound"
)
)

◆ windowId

gepetto.viewer.Viewer.windowId = viewerClient.gui.getWindowID(self.windowName)

◆ windowName

str gepetto.viewer.Viewer.windowName = "scene_" + name

The documentation for this class was generated from the following file: