irsl_choreonoid モジュール

https://github.com/IRSL-tut/irsl_choreonoid

irsl_choreonoid.cnoid_util

https://github.com/IRSL-tut/irsl_choreonoid/blob/main/irsl_choreonoid/cnoid_util.py

irsl_choreonoid.cnoid_util.load_script(filename)

Loading a script file

パラメータ:

filename (str) -- URL [ URL is like 'scheme://netloc/xxx/yyy/zzz' ]

irsl_choreonoid.cnoid_util.parseURL(url)

Parsing URL with IRSL original scheme

パラメータ:

url (str) -- URL

戻り値:

Absolute path

戻り値の型:

str

例外:

SyntaxError -- Unknown scheme or netloc is passed

サンプル

>>> parseURL('choreonoid://share/dir/file')
/choreonoid/share/choreonoid-2.0/dir/file
>>> parseURL('env://HOME/dir/file')
/home/user/dir/file
>>> parseURL('file:///dir/file')
/dir/file
>>> parseURL('file://./dir/file')
/current_dir/dir/file
>>> parseURL('file://~/dir/file')
/home/user/dir/file

Note: URL is like 'scheme://netloc/xxx/yyy/zzz'

Implemented scheme is 'choreonoid', 'env', 'file'

irsl_choreonoid.cnoid_util.loadRobot(fname, name=None, **kwargs)

Loading robot model (.body, .vrml, .urdf??)

パラメータ:
  • fname (str) -- filename of robot-model

  • name (str, optional) -- name of loaded instance

戻り値:

instance of cnoid.Body.Body

戻り値の型:

cnoid.Body.Body

irsl_choreonoid.cnoid_util.exportBody(fname, body, extModelFileMode=None, filePrefix='', allInOne=True, fixMassParam=True, fixMaterial=True)

Exporting .body file from an instance of cnoid.Body.Body

パラメータ:
  • fname (str)

  • body (cnoid.Body.Body)

  • extModelFileMode (int, optional) -- 0; EmbedModels, 1; LinkToOriginalModelFiles, 2; CopyModelFiles, 3; ReplaceWithStdSceneFiles, 4; ReplaceWithObjModelFiles

  • filePrefix (str, optional) -- Add URI for exporting mesh files

  • allInOne (boolean, default=True) -- Using with filePrefix, if True, all shapes will be exported as a file.

  • fixMassParam (boolean, default=False) -- If True, links with mass==1.0 and inertia is identity is set small mass-parameter (they may loaded without mass parameter)

  • fixMaterial (bool, default=True) -- add empty material if shape does not has material

irsl_choreonoid.cnoid_util.exportURDF(fname, body, **kwargs)

Exporting .urdf file from an instance of cnoid.Body.Body

パラメータ:
  • fname (str)

  • body (cnoid.Body.Body)

  • kwargs (dict[str, param])

  • AddGeometry (boolean, default=True) -- Add geometries

  • AddOffset (boolean, default=True) -- Add offset of links

  • ExportDevices (boolean)

  • MeshFilePrefix (str) -- Prefix of files exporting as mesh-files(.dae, .stl)

  • MeshURLPrefix (str) -- Prefix of file-name written in URDF

  • RobotName (str) -- Name of exporting robot

  • UseURDFPrimitiveGeometry (boolean, default=True) -- Use primitive defined at URDF

  • UseXacro (boolean)

  • Verbose (boolean)

irsl_choreonoid.cnoid_util.exportBodyAsMesh(fname, input_body, meshScale=None, offset=None, useCollision=False, **kwargs)

Exporting a mesh file converted from an instance of cnoid.Body.Body

パラメータ:
irsl_choreonoid.cnoid_util.convertBodyFileToMeshFile(mesh_file_name, body_file_name, **kwargs)

Converting a mesh file to a body file

パラメータ:
irsl_choreonoid.cnoid_util.castValueNode(_valuenode)

Casting cnoid.Util.ValueNode type to python primitive type

パラメータ:

_valuenode (cnoid.Util.ValueNode) -- ValueNode

戻り値:

Instance of python primitive type

戻り値の型:

dict, list, int, float, bool, str

irsl_choreonoid.cnoid_util.mappingToDict(mapping)

Converting cnoid.Util.Mapping to dict

パラメータ:

mapping (cnoid.Util.Mapping) -- Instance of mapping to be converted

戻り値:

Converted dictionary

戻り値の型:

dict

irsl_choreonoid.cnoid_util.listingToList(listing)

Converting cnoid.Util.Listing to list

パラメータ:

listing (cnoid.Util.Listing) -- Instance of listing to be converted

戻り値:

Converted list

戻り値の型:

list

irsl_choreonoid.cnoid_util.dictToMapping(indict)

Converting dict to cnoid.Util.Mapping

パラメータ:

indict (dict) -- Dict to be converted

戻り値:

Converted mapping

戻り値の型:

cnoid.Util.Mapping

irsl_choreonoid.cnoid_util.listToListing(inlist)

Converting list to cnoid.Util.Mapping

パラメータ:

inlist (list) -- List to be converted

戻り値:

Converted mapping

戻り値の型:

cnoid.Util.Mapping

irsl_choreonoid.cnoid_util.cnoidPosition(rotation=None, translation=None)

Concatnating translation part and rotation part

パラメータ:
  • translation (numpy.array, optional) -- 1x3 vector

  • rotation (numpy.array, optional) -- 3x3 matrix

戻り値:

4x4 homogeneous transformation matrix

戻り値の型:

numpy.array

irsl_choreonoid.cnoid_util.cnoidRotation(cPosition)

Extracting rotation part of 4x4 matrix

パラメータ:

cPosition (numpy.array) -- 4x4 homogeneous transformation matrix

戻り値:

3x3 matrix ( rotation part of cPosition )

戻り値の型:

numpy.array

irsl_choreonoid.cnoid_util.cnoidTranslation(cPosition)

Extracting translation part of 4x4 matrix

パラメータ:

cPosition (numpy.array) -- 4x4 homogeneous transformation matrix

戻り値:

1x3 vector ( translation part of cPosition )

戻り値の型:

numpy.array

irsl_choreonoid.cnoid_util.fv(*args, **kwargs)

Simple function for making numpy.array

パラメータ:
  • args (list[float]) -- List will be passed to numpy.array

  • kwargs (dict) -- Keyword arguments will be passed to numpy.array

戻り値:

vector or matrix

戻り値の型:

numpy.array

注釈

This function just return numpy.array(args, **kwargs)

サンプル

fv(0.1, 0.2, 0.3) => array([0, 1, 2])

Just reducing the number of typing numpy.array([0.1, 0.2, 0.3]) => fv(0.1, 0.2, 0.3)

irsl_choreonoid.cnoid_util.isInChoreonoid()
パラメータ:

None

戻り値:

True if this script running on python-console of Choreonoid

戻り値の型:

boolean

irsl_choreonoid.cnoid_base

https://github.com/IRSL-tut/irsl_choreonoid/blob/main/irsl_choreonoid/cnoid_base.py

irsl_choreonoid.cnoid_base.loadProject(project_file)

Loading project file (currend project may be changed)

パラメータ:

project_file (str) -- filename of project file (.cnoid)

irsl_choreonoid.cnoid_base.getItemTreeView()

DEPRECATED: use cnoid.Base.ItemTreeView.instance

irsl_choreonoid.cnoid_base.getRootItem()

DEPRECATED: use cnoid.Base.RootItem.instance

irsl_choreonoid.cnoid_base.getOrAddWorld(name='World')

Getting or creating WorldItem

パラメータ:

name (str, default = 'World') -- name of WorldItem

戻り値:

added or found WorldItem

戻り値の型:

cnoid.Base.WorldItem

irsl_choreonoid.cnoid_base.addSimulator(world=None, simulator_name='AISTSimulator')

Adding SimulatorItem

パラメータ:
  • world (optional) -- world item, simulator should be created under this world

  • simulator_name (str, default = 'AISTSimulator') -- name of SimulatorItem to be added

戻り値:

Added SimulatorItem

戻り値の型:

cnoid.BodyPlugin.AISTSimulatorItem

irsl_choreonoid.cnoid_base.createGLVisionSimulatorItem(targetBodies, targetSensors, **kwargs)
パラメータ:
  • targetBodies (str) -- name of body

  • targetSensors (str) -- name of sensor

  • kwargs -- optional settings

戻り値:

Creating a item for simulating camera

戻り値の型:

cnoid.GLVisionSimulatorPlugin.GLVisionSimulatorItem

サンプル

>>> option = { 'MaxFrameRate': 1000,
               'MaxLatency': 0,
               'VisionDataRecordingEnabled': False,
               'DedicatedSensorThreadsEnabled': True,
               'BestEffortMode': True,
               'RangeSensorPrecisionRatio': 2.0,
               'AllSceneObjectsEnabled': True,
               'HeadLightEnabled': True,
               'AdditionalLightsEnabled': True, }
>>> vis = createGLVisionSimulatorItem('RobotName', 'LeftCamera,RightCamera', **option)
irsl_choreonoid.cnoid_base.loadRobotItem(fname, name=None, world=True, addItem=True)

Load robot model and add it as a BodyItem

パラメータ:
  • fname (str) -- filename (or path)

  • name (str, optional) -- name of loaded robot-model

  • world (boolean or WorldItem, default = True) -- if True, WorldItem is added

  • addItem (boolean) -- if True and world if False, loaded item is added to RootItem

戻り値:

Loaded robot-model

戻り値の型:

cnoid.BodyPlugin.BodyItem

irsl_choreonoid.cnoid_base.findItem(name, root=None)

Finding item in ItemTreeView

パラメータ:

name (str) -- name of item to be searched

戻り値:

found item (first one)

戻り値の型:

cnoid.Base.Item

irsl_choreonoid.cnoid_base.findItems(name, root=None)

Finding item in ItemTreeView

パラメータ:

name (str) -- name of item to be searched

戻り値:

all found items which has the name

戻り値の型:

list [ cnoid.Base.Item ]

irsl_choreonoid.cnoid_base.findItemsByQuery(query, root=None)

Finding item which is query returning True in ItemTreeView

パラメータ:

query (callable, taking 1 argument, argtype cnoid.Base.Item) -- Query function which rturns true if the item should be extracted

戻り値:

all found items that query returns True

戻り値の型:

list [ cnoid.Base.Item ]

irsl_choreonoid.cnoid_base.findItemsByName(name, root=None)

Finding item with the same name in ItemTreeView

パラメータ:

name (str) -- name of item to be searched

戻り値:

all found items which has the name

戻り値の型:

list [ cnoid.Base.Item ]

irsl_choreonoid.cnoid_base.findItemsByClassExact(cls, root=None)

Finding item with class given as the argument in ItemTreeView

パラメータ:

cls (class) -- class of item to be searched

戻り値:

all found items which has the name

戻り値の型:

list [ cnoid.Base.Item ]

irsl_choreonoid.cnoid_base.findItemsByClass(cls, root=None)

Finding item with class given as the argument in ItemTreeView

パラメータ:

cls (class) -- class of item to be searched

戻り値:

all found items which has the name

戻り値の型:

list [ cnoid.Base.Item ]

irsl_choreonoid.cnoid_base.removeItem(item_)

Removing item

パラメータ:

item (cnoid.Base.Item) -- item to be removed

irsl_choreonoid.cnoid_base.findBodyItem(name_or_body, root=None)

Seaching BodyItem

パラメータ:

name_or_body (str or cnoid.Body.Body) -- If type is str, searching BodyItem with the same name. If type is body, searching BodyItem which has identical body

戻り値:

found BodyItem

戻り値の型:

cnoid.Base.Item

irsl_choreonoid.cnoid_base.findRobot(name)

DEPRECATED: use findBodyItem

irsl_choreonoid.cnoid_base.cameraPositionLookingFor(eye, direction, up, opencv=True)

Generating camera coordinates where designated direction is the camera's optical axis

パラメータ:
  • eye (numpy.array or list[float]) -- 3D position of the camera

  • direction (numpy.array or list[float]) -- Direction of the camera's optical axis

  • up (numpy.array or list[float]) -- Up direction

  • opencv (boolean, default = True) -- OpenCV stype coordinates will be returned

戻り値:

Camera coordinates

戻り値の型:

cnoid.IRSLCoords.coordinates

注釈

Refer cnoid.Util.SgCamera.positionLookingFor

irsl_choreonoid.cnoid_base.cameraPositionLookingAt(eye, center, up, opencv=True)

Generating camera coordinates looking at the point

パラメータ:
  • eye (numpy.array or list[float]) -- 3D position of the camera

  • center (numpy.array or list[float]) -- 3D position wherer the camera's optical axis passes through

  • up (numpy.array or list[float]) -- Up direction

  • opencv (boolean, default = True) -- OpenCV stype coordinates will be returned

戻り値:

Camera coordinates

戻り値の型:

cnoid.IRSLCoords.coordinates

注釈

Refer cnoid.Util.SgCamera.positionLookingAt

irsl_choreonoid.cnoid_base.saveImageOfScene(filename)

Saving scene as image file

パラメータ:

filename (str) -- Name of the file to be saved

注釈

Refer cnoid.Base.SceneWidget.saveImage

irsl_choreonoid.cnoid_base.currentSceneView()

Returning the instance of SceneView

パラメータ:

None

戻り値:

Current Instance of SceneView ( return cnoid.Base.SceneView.instance )

戻り値の型:

cnoid.Base.SceneView

irsl_choreonoid.cnoid_base.currentSceneWidget()

Returning the instance of SceneWidget

パラメータ:

None

戻り値:

Current Instance of SceneWidget ( return cnoid.Base.SceneView.instance.sceneWidget )

戻り値の型:

cnoid.Base.SceneWidget

irsl_choreonoid.cnoid_base.getCameraCoords(withFOV=True, opencv=True)

Returning camera position of current scene

パラメータ:
  • withFOV (boolean, default = True) -- If true, getting camera's field of view

  • opencv (boolean, default = True) -- OpenCV stype coordinates will be returned

戻り値:

Tuple with camera coordinates and camera's filed of view

戻り値の型:

(cnoid.IRSLCoords.coordinates, float)

irsl_choreonoid.cnoid_base.setCameraCoords(cds, fov=None, update=True, opencv=True)

Setting camera coordinates of current scene

パラメータ:
  • cds (cnoid.IRSLCoords.coordinates) -- Camera's coordinates to be set

  • fov (float, default = None) -- Camera's filed of view to be set

  • update (boolean, default=True) -- If True, rendering scene with updated camera position

  • opencv (boolean, default=True) -- cds is OpenCV stype coordinates

irsl_choreonoid.cnoid_base.getCameraCoordsParam(withFOV=True, opencv=True)

Returning camera position of current scene (returning dictionary type)

パラメータ:

withFOV (boolean, default = True) -- If true, getting camera's field of view

戻り値:

Dictionary can be read with irsl_choreonoid.robot_util.make_coordinates, and added the keyword 'fov'

戻り値の型:

dict[str, param]

irsl_choreonoid.cnoid_base.setCameraCoordsParam(param_dict, opencv=True)

Setting camera coordinates of current scene (receiving dictionary type)

パラメータ:

param_dict (dict[str, param]) -- Dictionary can be read with irsl_choreonoid.robot_util.make_coordinates, and added the keyword 'fov'

irsl_choreonoid.cnoid_base.getCameraMatrix()

Getting camera matrix of this scene

Retuns:

numpy.array (3x3 matrix) : Camera Matrix

irsl_choreonoid.cnoid_base.setCameraMatrix(camera_matrix, width=None, height=None)

Setting camera matrix of this scene

パラメータ:
  • camera_matrix (numpy.array[3x3]) -- Camera matrix to be set

  • width (int, optional) -- Set width of this scene

  • height (int, optional) -- Set height of this scene

irsl_choreonoid.cnoid_base.projectPoints(point_list, world=True)

Projecting 3D points to 2D points on image plane

パラメータ:

point_list (list [ numpy.array[3x3] ]) -- List 3D points on world coordinates

戻り値:

List of projected points

戻り値の型:

list [ numpy.array ]

irsl_choreonoid.cnoid_base.unprojectPoints(uv_list, depth=1.0, depth_list=None, centerRelative=False, world=True)

Projecting 3D points to 2D points on image plane

パラメータ:

point_list (list [ numpy.array[3x3] ]) -- List 3D points on world coordinates

戻り値:

List of projected points

戻り値の型:

list [ numpy.array ]

irsl_choreonoid.cnoid_base.setBackgroundColor(backgound_color)

Setting color of background

パラメータ:

background_color (numpy.array or list[float]) -- Vector with 3 elements. Eech element represents 'Red', 'Green', 'Blue'.

irsl_choreonoid.cnoid_base.disableGrid(plane=None)

Disabling to show grids

パラメータ:

plane (int, optional) -- ID of plane to be disabled. 0: XY, 1: XZ, 2: YZ

irsl_choreonoid.cnoid_base.enableGrid(plane=0)

Showing grids

パラメータ:

plane (int, default = 0) -- ID of plane to show. 0: XY, 1: XZ, 2: YZ

irsl_choreonoid.cnoid_base.setCoordinateAxes(on=True)

On/Off of the coordinate axes on the screen

パラメータ:

on (boolean, default=True) -- On/Off of the coordinate axes

irsl_choreonoid.cnoid_base.setViewSize(width, height)

Setting size of view(widget)

パラメータ:
  • width (int) -- Width of the widget to be set

  • height (int) -- Height of the widget to be set

irsl_choreonoid.cnoid_base.viewAll()

Setting camera position as viewing all objects

irsl_choreonoid.cnoid_base.getAllBoundingBox()

Getting a boundingBox of all objects on the scene

戻り値:

BoundingBox of all objects on the scene

戻り値の型:

BoundingBox

irsl_choreonoid.make_shapes

https://github.com/IRSL-tut/irsl_choreonoid/blob/main/irsl_choreonoid/make_shapes.py

irsl_choreonoid.make_shapes.extractShapes(sg_node, currentCoords=None)

Extracting SgShape from SceneGraph

パラメータ:
  • sg_node (cnoid.Util.SgNode) -- Root node to start searching

  • currentCoords (cnoid.IRSLCoords.coordinates, optional) -- Offset coordinates to extracted object

戻り値:

List of extracted objects which is tuple of object-instance and coordinates of this object

戻り値の型:

list [ tuple [ cnoid.Util.SgShape, cnoid.IRSLCoords.coordinates ] ]

irsl_choreonoid.make_shapes.extractPlots(sg_node, currentCoords=None)

Extracting SgPlot from SceneGraph

パラメータ:
  • sg_node (cnoid.Util.SgNode) -- Root node to start searching

  • currentCoords (cnoid.IRSLCoords.coordinates, optional) -- Offset coordinates to extracted object

戻り値:

List of extracted objects which is tuple of object-instance and coordinates of this object

戻り値の型:

list [ tuple [ cnoid.Util.SgPlot, cnoid.IRSLCoords.coordinates ] ]

irsl_choreonoid.make_shapes.extractDrawables(sg_node, currentCoords=None)

Extracting drawables (SgShape, SgPlot, SgText) from SceneGraph

パラメータ:
  • sg_node (cnoid.Util.SgNode) -- Root node to start searching

  • currentCoords (cnoid.IRSLCoords.coordinates, optional) -- Offset coordinates to extracted object

戻り値:

List of extracted objects which is tuple of object-instance and coordinates of this object

戻り値の型:

list [ tuple [ instance of drawables, cnoid.IRSLCoords.coordinates ] ]

Remove collision shapes from a specific link while preserving its visual shapes.

パラメータ:

inlink (cnoid.Body.Link) -- Link object

メモ

The operation mutates inlink in place. Any collision geometry originally attached to the link will be removed.

Remove visual geometry from a link, preserving only its collision shapes.

パラメータ:

inlink (cnoid.Body.Link) -- Link object

メモ

The operation mutates inlink in place. Any collision geometry originally attached to the link will be removed.

irsl_choreonoid.make_shapes.addCollisionShape(target_link, shape_from_mkshapes)

Add a collision shape node to a target link with the correct relative transform.

パラメータ:

メモ

This function computes the relative transform between the target link's frame and the provided shape, wraps the shape's scene graph node in an SgPosTransform with that pose, and registers it as a collision shape on the link.

irsl_choreonoid.make_shapes.addVisualShape(target_link, shape_from_mkshapes)

Add a visual shape node to a target link with the correct relative transform.

パラメータ:

メモ

This function computes the relative transform between the target link's frame and the provided shape, wraps the shape's scene graph node in an SgPosTransform with that pose, and registers it as a collision shape on the link.

irsl_choreonoid.make_shapes.replaceCollision(alink, madeShape)

Replace the collision geometry attached to a link.

Removes all existing collision shapes from the given link and, if a new shape is provided, attaches it as the current collision geometry.

パラメータ:
irsl_choreonoid.make_shapes.replaceVisual(alink, madeShape)

Replace the visual geometry attached to a link.

Removes all existing visual shapes from the given link and, if a new shape is provided, attaches it as the current visual geometry.

パラメータ:
irsl_choreonoid.make_shapes.removeNodes(sg_node, target_nodes)

Recursively remove specified nodes from a scene-graph subtree.

Traverses the children of the given scene-graph node depth-first and removes any child that appears in the provided target_nodes collection. Traversal only descends into nodes identified as group nodes by isGroupNode(). Non-group nodes are not traversed. This function mutates the scene graph in place.

パラメータ:
  • sg_node (cnoit.Util.SgNode) -- The root node of the subtree to process.

  • target_nodes ([ cnoit.Util.SgNode ]) -- A collection of nodes to remove from the scene graph.

irsl_choreonoid.make_shapes.removePrimitiveTypeNodes(sg_node, type_list=None)

Remove shape nodes with specified primitive types from a scene graph node.

This function traverses the given scene graph node, collects shape nodes via extractShapes, and removes those whose mesh.primitiveType matches any of the values in type_list. If type_list is None, all extracted shape nodes are removed.

パラメータ:
  • sg_node (cnoit.Util.SgNode) -- The root or parent scene graph node to process.

  • type_list ([int]) -- Optional iterable of primitive type identifiers to match against each shape's mesh.primitiveType. If None, all shapes are targeted for removal.

メモ

  • Condidates of type_list : [ SgMesh.MeshType, SgMesh.BoxType, SgMesh.SphereType, SgMesh.CylinderType, SgMesh.ConeType, SgMesh.CapsuleType ]

irsl_choreonoid.make_shapes.removePrimitiveTypeTrees(sg_group, meshTypes=[<PrimitiveType.CylinderType: 3>])

Remove shape nodes with specified primitive types from a scene graph node.

This function traverses the given scene graph node, collects shape nodes via extractShapes, and removes those whose mesh.primitiveType matches any of the values in type_list. If type_list is None, all extracted shape nodes are removed.

パラメータ:
  • sg_node (cnoit.Util.SgNode) -- The root or parent scene graph node to process.

  • meshTypes ([int]) -- Optional iterable of primitive type identifiers to match against each shape's mesh.primitiveType. If None, all shapes are targeted for removal.

メモ

  • Condidates of type_list : [ SgMesh.MeshType, SgMesh.BoxType, SgMesh.SphereType, SgMesh.CylinderType, SgMesh.ConeType, SgMesh.CapsuleType ]

irsl_choreonoid.make_shapes.loadScene(fname, meshScale=None, fileUri=None, wrapped=True, rawShape=False, coords=None, **kwargs)

Loading scene(wrl, scene, ...) file using cnoid.Util.SceneLoader

パラメータ:
  • fname (str) -- File name to be loaded

  • fileUri (str, optional) -- If fileUri is set, shapes will be set Uri for exporting files

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgShape will be returned (ignore wrapped)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Loaded scene as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.loadMesh(fname, meshScale=None, fileUri=None, wrapped=True, rawShape=False, coords=None, forceGenerateNormals=True, creaseAngle=0.5235987755982988, **kwargs)

Loading mesh file using cnoid.AssimpPlugin module

パラメータ:
  • fname (str) -- File name to be loaded

  • fileUri (str, optional) -- If fileUri is set, shapes will be set Uri for exporting files

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgShape will be returned (ignore wrapped)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Loaded scene as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeBox(x, y=None, z=None, wrapped=True, rawShape=False, coords=None, texture=None, **kwargs)

Making 'Box' shape using cnoid.Util.MeshGenerator

パラメータ:
  • x (float) -- Length of x-axis, if y and z is None, making 'cube'

  • y (float, optional) -- Length of y-direction edge

  • z (float, optional) -- Length of z-direction edge

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgShape will be returned (ignore wrapped)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • texture (str, optional) -- Image file-name of texture

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

注釈

Origin of generated shape is the center of it

irsl_choreonoid.make_shapes.makeCylinder(radius, height, wrapped=True, rawShape=False, coords=None, texture=None, **kwargs)

Making 'Cylinder' shape using cnoid.Util.MeshGenerator

パラメータ:
  • radius (float) -- Radius of the cylinder

  • height (float) -- Height of the cylinder

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgShape will be returned (ignore wrapped)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • texture (str, optional) -- Image file-name of texture

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

注釈

Center circle with indicated radius on XZ-plane and sweep to both side with half of height, along y-direction

irsl_choreonoid.make_shapes.makeSphere(radius, wrapped=True, rawShape=False, coords=None, texture=None, **kwargs)

Make 'Sphere' shape using cnoid.Util.MeshGenerator

パラメータ:
  • radius (float) -- Radius of the sphere

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgShape will be returned (ignore wrapped)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • texture (str, optional) -- Image file-name of texture

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

注釈

Origin of generated shape is the center of it

irsl_choreonoid.make_shapes.makeCone(radius, height, wrapped=True, rawShape=False, coords=None, texture=None, **kwargs)

Making 'Cone' shape using cnoid.Util.MeshGenerator

パラメータ:
  • radius (float) -- Radius of the cone

  • height (float) -- Height of the cone

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgShape will be returned (ignore wrapped)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • texture (str, optional) -- Image file-name of texture

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeCapsule(radius, height, wrapped=True, rawShape=False, coords=None, **kwargs)

Makeing 'Capsule' shape using cnoid.Util.MeshGenerator

パラメータ:
  • radius (float) -- Radius of the cupsule

  • height (float, optional) -- Height of the capsule

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgShape will be returned (ignore wrapped)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

注釈

Similar dimensions to 'makeCylinder' (bottom cricle is at minus y, cone's tip is at plus y)

irsl_choreonoid.make_shapes.makeTorus(radius, corssSectionRadius, beginAngle=None, endAngle=None, wrapped=True, rawShape=False, coords=None, **kwargs)

Makeing 'Torus' shape using cnoid.Util.MeshGenerator

パラメータ:
  • radius (float) -- Outer radius of the torus

  • crossSectionRadius (float) -- Radius of cross section

  • beginAngle (float, optional) -- If beginAngle and endAngle is passed, part of whole torus is created

  • endAngle (float, optional)

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgShape will be returned (ignore wrapped)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeExtrusion(crossSection, spine, wrapped=True, rawShape=False, coords=None, texture=None, **kwargs)

Makeing 'Extrusion' shape using cnoid.Util.MeshGenerator

パラメータ:
  • crossSection (list[list[float]], N x 2 matrix) -- / arg for cnoid.Util.MeshGenerator.Extrusion

  • spine (list[list[float]], M x 3 matrix) -- / arg for cnoid.Util.MeshGenerator.Extrusion

  • orientation (list[AngleAxis], optional) -- / arg for cnoid.Util.MeshGenerator.Extrusion

  • scale (list[list[float]], N x 2 matrix, optional) -- / arg for cnoid.Util.MeshGenerator.Extrusion

  • creaseAngle (float, optional) -- / arg for cnoid.Util.MeshGenerator.Extrusion

  • beginCap (boolean, optional) -- / arg for cnoid.Util.MeshGenerator.Extrusion

  • endCap (boolean, optional) -- / arg for cnoid.Util.MeshGenerator.Extrusion

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgShape will be returned (ignore wrapped)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • texture (str, optional) -- Image file-name of texture

  • kwargs (dict[str, param]) -- Keywords for generating material, mesh, and makeExtrusionParam

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeElevationGrid(xDimension, zDimension, xSpacing, zSpacing, height, wrapped=True, rawShape=False, coords=None, texture=None, **kwargs)

Makeing 'Extrusion' shape using cnoid.Util.MeshGenerator

パラメータ:
  • xDimension (int) -- Dimension of x-direction / arg for cnoid.Util.MeshGenerator.ElevationGrid

  • zDimension (int) -- Dimension of z-direction / arg for cnoid.Util.MeshGenerator.ElevationGrid

  • xSpacing (float) -- X length is (xDimension - 1) x xSpacing / arg for cnoid.Util.MeshGenerator.ElevationGrid

  • zSpacing (float) -- Z length is (zDimension - 1) x zSpacing / arg for cnoid.Util.MeshGenerator.ElevationGrid

  • height (list[float]) -- Size is ( xDimension x zDimension ) / arg for cnoid.Util.MeshGenerator.ElevationGrid

  • ccw (boolean, optional) -- / arg for cnoid.Util.MeshGenerator.ElevationGrid

  • creaseAngl (float, optional) -- / arg for cnoid.Util.MeshGenerator.ElevationGrid

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgShape will be returned (ignore wrapped)

  • texture (str, optional) -- Image file-name of texture

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • kwargs (dict[str, param]) -- Keywords for generating material, mesh, and makeElevationParam

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makePoints(points, pointSize=10.0, colors=None, colorIndices=None, wrapped=True, rawShape=False, coords=None, **kwargs)

Makeing '3D point cloud' shape

パラメータ:
  • points (numpy.array) -- N x 3 matrix (N is number of points)

  • pointSize (float, default=1.0)

  • colors (list[list[float]], optional)

  • colorIndices (list[int], optional)

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgPointSet will be returned (ignore wrapped)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeText(text, textHeight=1.0, color=None, wrapped=True, rawShape=False, coords=None, **kwargs)

Makeing 'Text' shape

パラメータ:
  • text (str) -- String to be displayed

  • textHeight (float, default=1.0)

  • color (list[float], optional)

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgText will be returned (ignore wrapped)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeLines(line_points, line_indices=None, lineWidth=5.0, colors=None, colorIndices=None, coords=None, wrapped=True, rawShape=False, **kwargs)

Makeing Lines

パラメータ:
  • line_points (numpy.array) -- N x 3 matrix (N is number of points)

  • line_indices (list [ tuple [int] ]) -- example, [ (0, 1), (2, 3) ] represents two lines, line0 is from point0 to point1, line1 is from point2 to point3

  • lineWidth (float, default=5.0)

  • colors (list[list[float]], optional)

  • colorIndices (list[int], optional)

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgText will be returned (ignore wrapped)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeTetrahedron(base_width, base_height, height, base_center=None, center_x=None, center_y=None, wrapped=True, rawShape=False, coords=None, **kwargs)

Making 'Tetrahedron' shape

パラメータ:
  • base_width (float)

  • base_height (float)

  • height (float)

  • base_center (float, optional)

  • center_x (float, optional)

  • center_y (float, optional)

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgShape will be returned (ignore wrapped)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeTriangles(vertices, indices=None, wrapped=True, rawShape=False, coords=None, **kwargs)

Making 'Raw Triangle Mesh' shape

パラメータ:
  • vertices (numpy.array) -- N x 3 matrix (N is number of vertices) or list[numpy.array]

  • indices (list[int], optional) -- size of this list should be M x 3 (M is number of faces)

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • rawShape (boolean, default = False) -- If True, instance of cnoid.Util.SgShape will be returned (ignore wrapped)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeAxis(radius=0.075, length=1.0, axisLength=0.35, axisRadius=0.125, axisRatio=None, color=None, scale=None, coords=None, wrapped=True, **kwargs)

Makeing single axis shape using cylinder and cone

パラメータ:
  • radius (float, default=0.15)

  • length (float, default=0.8)

  • axisLength (float, default=0.3)

  • axisRadius (float, default=0.25)

  • axisRatio (float, optional)

  • color (list[float], optional)

  • scale (float, optional)

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.make3DAxis(radius=0.15, length=0.8, axisLength=0.3, axisRadius=0.25, axisRatio=None, color=None, scale=None, x_color=[1, 0, 0], y_color=[0, 1, 0], z_color=[0, 0, 1], coords=None, wrapped=True, **kwargs)

Makeing '3D-axis' shape using cylinder and cone

パラメータ:
  • radius (float, default=0.15)

  • length (float, default=0.8)

  • axisLength (float, default=0.3)

  • axisRadius (float, default=0.25)

  • axisRatio (float, optional)

  • color (list[float], optional)

  • scale (float, optional)

  • x_color (list[float], default=[1,0,0])

  • y_color (list[float], default=[0,1,0])

  • z_color (list[float], default=[0,0,1])

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.make3DAxisBox(width=0.2, length=0.8, color=None, scale=None, x_color=[1, 0, 0], y_color=[0, 1, 0], z_color=[0, 0, 1], coords=None, wrapped=True, **kwargs)

Makeing '3D-axis' shape using box

パラメータ:
  • width (float, default=0.2)

  • length (float, default=0.8)

  • color (list[float], optional)

  • scale (float, optional)

  • x_color (list[float], default=[1,0,0])

  • y_color (list[float], default=[0,1,0])

  • z_color (list[float], default=[0,0,1])

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeCoords(length=1.0, lineWidth=2.0, color=None, x_color=[1, 0, 0], y_color=[0, 1, 0], z_color=[0, 0, 1], coords=None, wrapped=True, **kwargs)

Makeing '3D-axis' shape using line

パラメータ:
  • length (float, default=0.8)

  • lineWidth (float, default=2.0)

  • color (list[float], optional)

  • x_color (list[float], default=[1,0,0])

  • y_color (list[float], default=[0,1,0])

  • z_color (list[float], default=[0,0,1])

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeCross(length=1.0, lineWidth=2.0, color=None, x_color=[1, 0, 0], y_color=[0, 1, 0], z_color=[0, 0, 1], coords=None, wrapped=True, **kwargs)

Makeing '3D-axis' shape using crossing line

パラメータ:
  • length (float, default=0.8)

  • lineWidth (float, default=2.0)

  • color (list[float], optional)

  • x_color (list[float], default=[1,0,0])

  • y_color (list[float], default=[0,1,0])

  • z_color (list[float], default=[0,0,1])

  • coords (cnoid.IRSLCoords.coordinates, optional)

  • wrapped (boolean, default = True) -- If True, the loaded scene is wrapped by irsl_choreonoid.irsl_draw_object.coordsWrapper

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeLineAlignedShape(start, end, size=0.001, shape='box', verbose=False, **kwargs)

Makeing object which is aligned with a desginated line

パラメータ:
  • start (numpy.ndarray) -- 3D vector representing start-point of a line

  • end (numpy.ndarray) -- 3D vector representing end-point of a line

  • size (float) -- Size of generated object (radius or edge length)

  • shape (str) -- Type of Shape, 'box', 'cylinder', 'capsule', 'cone'

  • verbose (bool, default=False) -- If True, printing debug message

  • kwargs (dict[str, param]) -- Keywords for generating material and mesh

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeParallelogram(height, length, width, offset=None, angle=None, front_cut=None, back_cut=None, **kwargs)

Making a geometry, 'Parallelogram'

パラメータ:
  • height (float) -- Height of the geometry

  • length (float) -- Length of bottom edge

  • width (float) -- Width of the geometry

  • offset (float, optional) -- Offset of a top edge and a bottom edge

  • angle (float, optional) -- range is [0, PI]

  • front_cut (float, optional) -- Cut from front-side if angle > 0

  • back_cut (float, optional) -- Cut from back-side if angle > 0

  • **kwargs -- Passing to irsl_choreonoid.make_shapes.makeExtrusion

Retuns:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper : Created object as a node of SceneGraph or wrapped class for interactive programming

irsl_choreonoid.make_shapes.makeBasket(width, height, tall, thickness=0.1, bottom_thickness=0.1, wrapped=True, rawShape=False, **kwargs)

Making basket shape

パラメータ:
  • width (float) -- width of bottom plate (x-axis)

  • height (float) -- height of bottom plate (y-axis)

  • tall (float) -- tall of basket

  • thickness (float, default = 0.1) -- thickness of walls

  • bottom_thickness (float, default = 0.1) -- thickness of bottom plate

  • wrapped (boolean, default=True) -- Just passing to makeBox

  • rawShape (boolean, default=False) -- Just passing to makeBox

  • kwargs (dict[str, param]) -- Extra keyword arguments passing to makeBox

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeTableSingleLeg(width, height, tall, thickness=0.05, bottom_thickness=0.04, bottom_width=0.4, bottom_height=0.4, leg_size=0.1, wrapped=True, rawShape=False, **kwargs)

Making table with single leg

パラメータ:
  • width (float) -- width of top plate (x-axis)

  • height (float) -- height of top plate (y-axis)

  • tall (float) -- tall of table

  • thickness (float, default = 0.05) -- thickness of top plate

  • bottom_thickness (float, default = 0.04) -- thickness of bottom plate

  • bottom_width (float, default = 0.4) -- width of bottom plate

  • bottom_height (float, default = 0.4) -- height of bottom plate

  • leg_size (float, default = 0.1) -- leg size

  • wrapped (boolean, default=True) -- Just passing to makeBox

  • rawShape (boolean, default=False) -- Just passing to makeBox

  • kwargs (dict[str, param]) -- Extra keyword arguments passing to makeBox

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeTable4Legs(width, height, tall, thickness=0.05, leg_size=0.1, wrapped=True, rawShape=False, **kwargs)

Making table with 4 legs

パラメータ:
  • width (float) -- width of top plate (x-axis)

  • height (float) -- height of top plate (y-axis)

  • tall (float) -- tall of table

  • thickness (float, default = 0.05) -- thickness of top plate

  • leg_size (float, default = 0.1) -- leg size

  • wrapped (boolean, default=True) -- Just passing to makeBox

  • rawShape (boolean, default=False) -- Just passing to makeBox

  • kwargs (dict[str, param]) -- Extra keyword arguments passing to makeBox

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeRoundTable(radius, tall, thickness=0.05, bottom_thickness=0.04, bottom_width=0.4, bottom_height=0.4, leg_size=0.1, wrapped=True, rawShape=False, **kwargs)

Making round table with single leg

パラメータ:
  • radius (float) -- width of top plate (x-axis)

  • tall (float) -- tall of table

  • thickness (float, default = 0.05) -- thickness of top plate

  • bottom_thickness (float, default = 0.04) -- thickness of bottom plate

  • bottom_width (float, default = 0.4) -- width of bottom plate

  • bottom_height (float, default = 0.4) -- height of bottom plate

  • leg_size (float, default = 0.1) -- leg size

  • wrapped (boolean, default=True) -- Just passing to makeBox

  • rawShape (boolean, default=False) -- Just passing to makeBox

  • kwargs (dict[str, param]) -- Extra keyword arguments passing to makeBox

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeWireframeCone(wrapped=True, rawShape=False, scale=[1, 1, 1], **kwargs)

Making cone with lines

パラメータ:
  • wrapped (boolean, default=True) -- Just passing to makeBox

  • rawShape (boolean, default=False) -- Just passing to makeBox

  • kwargs (dict[str, param]) -- Extra keyword arguments passing to makeBox

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeBoxFromBoundingBox(bbox, line=False, wrapped=True, rawShape=False, **kwargs)

Making box with the same size and position passed bounding-box

パラメータ:
  • bbox (cnoid.Util.BoundingBox or object has 'boundingBox' method)

  • line (boolean, default=False) -- If True, BoundingBox is shown with line

  • wrapped (boolean, default=True) -- Just passing to makeBox

  • rawShape (boolean, default=False) -- Just passing to makeBox

  • kwargs (dict[str, param]) -- Extra keyword arguments passing to makeBox

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeLineAlignedWall(points, height=1.0, thickness=0.1, **kwargs)

Making a wall which is aligned with a multi-segment line points on XY plane, extrude them by Z-axis(height)

パラメータ:
  • points (list[numpy.array]) -- List of 2D point, representing a line on XY-plane

  • height (float, default=1.0) -- Height of the wall

  • thickness (float, default=0.1) -- Thickness of the wall

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

サンプル

>>> points=[]
>>> NN = 36
>>> for idx in range(NN+1):
>>>     xx = 2*PI/NN*idx
>>>     ss = math.sin(xx)
>>>     points.append(fv(xx, ss))
>>> sp = mkshapes.makeLineAlignedWall(points)
irsl_choreonoid.make_shapes.makeLineAxis(from_point, to_point, axis_length=1.0, axis_angle=0.5, ortho_axis=None, **kwargs)

Making simple line and axis

パラメータ:
  • from_point (numpy.array) -- Start of the line

  • to_point (numpy.array) -- End of the line, axis tip will indicate at this point

  • axis_length (float, default = 1.0) -- Length of the axis tip arrows

  • axis_angle (float, default = 0.5) -- Angle of axis tip

  • ortho_axis (numpy.array, optional)

戻り値:

Created object as a node of SceneGraph or wrapped class for interactive programming

戻り値の型:

cnoid.Util.SgPosTransform or irsl_choreonoid.irsl_draw_object.coordsWrapper

irsl_choreonoid.make_shapes.makeTexturedPlate(img_array, coords=None, width=1.0, height=None, aspectRatio=None, thickness=0.001)

Creates a textured plate with the given image array.

パラメータ:
  • img_array (np.ndarray) -- Image array with shape (height, width, channels).

  • coords (coordinates, optional) -- Pose coordinates for the plate.

  • width (float, default=1.0) -- Width of the plate in meters.

  • height (float, optional) -- Height of the plate in meters. If None, calculated from width and aspectRatio. Defaults to None.

  • aspectRatio (float, optional) -- Aspect ratio (height/width) of the plate. If None, calculated from the image array dimensions. Defaults to None.

  • thickness (float, default=0.001) -- Thickness of the plate in meters.

戻り値:

A box object with the texture applied and positioned according to the given coordinates.

戻り値の型:

Box

注釈

The coords parameter is expected to be in OpenCV camera coordinates.

irsl_choreonoid.make_shapes.exportMesh(fname, sg_node, meshScale=None, verbose=False, generatePrimitiveMesh=True, ignoreURDFPrimitive=False, outputType=None, expandVertices=False)

Exporting SgNode as a mesh file (using Assimp)

パラメータ:
  • fname (str) -- File name to be saved

  • sg_node (cnoid.Util.SgNode) -- Root node of scene to be saved

  • meshScale (float, optional)

  • verbose (boolean, default=False)

  • generatePrimitiveMesh (boolean, default=True)

  • ignoreURDFPrimitive (boolean, default=False)

  • outputType (str, optional)

irsl_choreonoid.make_shapes.exportScene(fname, sg_node, meshScale=None, exportMesh=False, **kwargs)

Exporting SgNode as .scen file

パラメータ:
  • fname (str) -- File name to be saved

  • sg_node (cnoid.Util.SgNode) -- Root node of scene to be saved

  • meshScale (float, optional)

  • exportMesh (boolean, default=False) -- Exporting mesh instead of primitive type

  • kwargs (dict[str, param]) -- Extra keyword arguments for using to execute ''StdSceneWriter.<keyword> = <value>''

irsl_choreonoid.make_shapes.addUriToShape(sg_node, base_name='mesh', base_uri='file:///tmp', allInOne=False)

Exporting SgNode as .scen file

パラメータ:
  • sg_node (cnoid.Util.SgNode) -- Root node of scene to be add uri

  • base_name (str) -- Base name of uri

  • base_uri (str) -- Base uri to be add

注釈

uri : {base_uri}/{base_name}_{counter}

irsl_choreonoid.robot_util

https://github.com/IRSL-tut/irsl_choreonoid/blob/main/irsl_choreonoid/robot_util.py

irsl_choreonoid.robot_util.make_coordinates(coords_map, scale=1.0)

Generating coordinates(cnoid.IRSLCoords.coordinates) from dictionary

パラメータ:
  • coords_map (dict[str, list[float]]) -- dictionary of describing transformation

  • scale (float, default = 1.0) -- Scaling for making coordinates

戻り値:

generated coordinates

戻り値の型:

cnoid.IRSLCoords.coordinates

例外:

Exception -- If there is not valid keyword

サンプル

>>> make_coordinates( {'position' : [1, 2, 3]} )
<coordinates[address] 1 2 3 / 0 0 0 1 >
>>> make_coordinates( {'pos' : [1, 2, 3], 'rpy' : [math.pi/3, 0, 0]} )
<coordinates[address] 1 2 3 / 0.5 0 0 0.866025 >
>>> make_coordinates({'rot' : [[0, -1, 0],[1, 0, 0], [0, 0, 1]]})
<coordinates[address] 0 0 0 / 0 0 0.707107 0.707107 >
>>> make_coordinates( {'angle-axis' : [0, 1, 0, math.pi/4] })
<coordinates[address] 0 0 0 / 0 0.382683 0 0.92388 >
>>> make_coordinates( {'quaternion' : [0, 0, 0, 1] })
<coordinates[address] 0 0 0 / 0 0 0 1 >
irsl_choreonoid.robot_util.make_coords_map(coords, method=None, scale=1.0)

Generating dictonary describing transformation

パラメータ:
戻り値:

Dictonary can be used by make_coordinates

戻り値の型:

dict[str, list[float]]

サンプル

>>> make_coords_map( make_coordinates( {'position' : [1, 2, 3]} ) )
{'pos': [1.0, 2.0, 3.0], 'aa': [1.0, 0.0, 0.0, 0.0]}
>>> make_coords_map(make_coordinates( {'pos' : [0.01, 0.02, 0.03]} ), method = 'translation', scale=1000.0)
{'translation': [10.0, 20.0, 30.0], 'rotation': [1.0, 0.0, 0.0, 0.0]}
irsl_choreonoid.robot_util.make_translation_rotation(coords, unit='mm', degree=True)

Generating dictonary describing transformation (using translation, rotation)

パラメータ:
  • coords (cnoid.IRSLCoords.coordinates) -- Transformation

  • unit (str, default='mm') -- Unit of length. 'm', 'mm', 'cm', or 'inch'

  • degree (boolean, default=True) -- Unit of angle. If True, use degree, otherwise use radian

戻り値:

Dictonary can be used in .body

戻り値の型:

dict[str, list[float]]

irsl_choreonoid.robot_util.axisAlignedCoords(axis, target_axis=array([0., 1., 0.]), rotate=None, up_axis=None)

Generating axis aligned coordinates.

target_axis on the generated coordinates will be axis on the world-coordinates

パラメータ:
  • axis (list[float]) -- Target direction(axis)

  • target_axis (list[float]) -- Target axis to be alined

戻り値:

generated coordinates

戻り値の型:

cnoid.IRSLCoords.coordinates

サンプル

>>> ay = axisAlignedCoords([1., 1., 1.,], coordinates.Y)
>>> ay.y_axis
array([0.57735027, 0.57735027, 0.57735027])
>>> az = axisAlignedCoords([1., 1., 1.,], coordinates.Z)
>>> az.z_axis
array([0.57735027, 0.57735027, 0.57735027])
>>> target = fv(1., 1., 1.)
>>> aa = axisAlignedCoords([1., 0., 1.,], target)
>>> aa.transform_vector(target)
array([1.22474487, 0.        , 1.22474487])
class irsl_choreonoid.robot_util.IKWrapper(robot, tip_link, tip_to_eef=None, use_joints=None, solver='QP')

ベースクラス: object

Utility class for solving inverse-kinematics

__init__(robot, tip_link, tip_to_eef=None, use_joints=None, solver='QP')
パラメータ:
  • robot (cnoid.Body.Body) -- robot model using this instance

  • tip_link (str, cnoid.Body.Link) -- name or instance of tip_link

  • tip_to_eef (cnoid.IRSLCoords.coordinates, optional) -- coordinates of end-effector relative to tip_link

  • use_joints (list[str, int, cnoid.Body.Link] , optional) -- list of joint name, index or instance

  • solver (str, default = 'QP') -- type of solver

注釈

Coordinates system

world -> robot(root_link) -> (using joints) -> tip_link -> tip_to_eef -> end-effector < -- > target-coords(world)

Inverse-kinematics would be solved to make target-coords and end-effector at the same position.

flush()

Updating the robot in scene

パラメータ:

None

updateDefault()

Updating default values (using joints, default_pose, default_coords)

パラメータ:

None

property endEffector

Current 6DOF coordinates of end-effector

戻り値:

coordinates of current end-effector

戻り値の型:

cnoid.IRSLCoords.coordinates

getEndEffector(**kwargs)

Getting end-effector (function version of self.endEffector)

パラメータ:

kwargs (dict[str, param]) -- ignored

戻り値:

end-effector

戻り値の型:

cnoid.IRSLCoords.coordinates

resetJointWeights()

Reset current joint-list to default joint-list (reverting effects of using setJoints)

パラメータ:

None

setJoints(jlist, enable=True)

Adding or removing joints to/from using joint-list

パラメータ:
  • jlist (list[str, int, cnoid.Body.Link]) -- list of joint name, index or instance

  • enable (boolean, default = True) -- if True, joints are added, else joint are removed from using joint-list

例外:

Exception -- If wrong joint is passed

inverseKinematics(target, revert_if_failed=True, retry=100, **kwargs)

Top method to solve inverse-kinematics

パラメータ:
  • target (cnoid.IRSLCoords.coordinates) -- target coordinates of inverse-kinematics

  • revert_if_failed (boolean, default = True) -- if True, no modification (moving joint and root-link) to robot-model when calculation of IK is failed

  • retry (int, defualt = 100) -- number of retrying solving IK

  • constraint (str or list[float], optional) -- '6D', 'position', 'rotation', 'xyzRPY'

  • weight (float, default = 1.0) -- weight of constraint

  • base_type (str or list[float], optional) -- '2D', 'planer', 'position', 'rotation'

  • base_weight (float, default = 1.0) -- weight of base movement (evaluation phase)

  • base_dq_weight (float, default = 0.01) -- weight of velocity of base movement

  • joint_dq_weight (list[float], optional) -- weight of velocity of joints (list length should be the same as num of joints)

  • max_iteration (int, defulat = 32) -- number of iteration

  • threshold (float, default = 5e-5) -- threshold for checking convergence

  • position_precision (list[float], optional) -- precision of position. [prec_x, prec_y, prec_z, prec_R, prec_P, prec_Y]

  • add_noise (float or boolean, optional) -- if True or number, adding noise to angle of joint before solving IK

  • debug (boolean, default = False) -- if True, printing debug message

戻り値:

IK was success or not, and total count of calculation

戻り値の型:

(boolean, int)

注釈

constraint : [1,1,1, 1,1,1] base_type : [1,1,1, 1,1,1]

angleVector(_angle_vector=None)

Returning current joint angle of self.robot ロボット(self.robot)への関節角度の指定して現状の値を返す。

パラメータ:
  • _angle_vector (numpy.array, optional) -- 1 x len(self.default_joints) vector

  • 各エレメントが関節角度になっているvector (numpy.array)

戻り値:

1 x len(self.default_joints) vector 現在のロボットの状態で、各エレメントが関節角度になっているvector(numpy.array)。要素数はself.default_jointと同じ。

戻り値の型:

numpy.array

currentAngleVector(_angle_vector=None)

Returning current joint angle of self.robot

パラメータ:

_angle_vector (numpy.array, optional) -- 1 x len(self.current_joints) vector

戻り値:

1 x len(self.current_joints) vector

戻り値の型:

numpy.array

注釈

self.current_joints would be changed by setJoints method

rootCoords(cds=None)

Setting and getting coordinates of rootLink

パラメータ:

cds (cnoid.IRSLCoords.coordinates, optional) -- If argument is set, coordinates of rootLink is updated by it

戻り値:

coordinates of rootLink

戻り値の型:

cnoid.IRSLCoords.coordinates

resetPose()

Resetting pose (angleVector and rootCoords)

パラメータ:

None

戻り値:

current angleVector

戻り値の型:

numpy.array

addNoise(max_range=0.1, joint_list=None)

addNoise(self, max_range = 0.1, joint_list = None):

パラメータ:
  • max_range (float, default = 0.1) -- range of adding noise

  • joint_list (list[str, int, cnoid.Body.Link], optional) -- If argument is not set, self.default_joints would be used

property robot

Robot model using this instance

戻り値:

robot model

戻り値の型:

cnoid.Body.Body

Tip link (direct parent of end-effector)

戻り値:

tip link

戻り値の型:

cnoid.Body.Link

property tip_to_eef

Transformation between origin of tip_link and end-effector

戻り値:

Transformation to end-effector at tip_link coordinates

戻り値の型:

cnoid.IRSLCoords.coordinates

property joint_weights

Weight of joints

戻り値:

weight of joints

戻り値の型:

list[float]

property current_joints

Current joint-list

戻り値:

current_joints using IK, currentAngleVector

戻り値の型:

list[cnoid.Body.Link]

property default_joints

Default joint-list (stored while initialization)

戻り値:

default_joints

戻り値の型:

list[cnoid.Body.Link]

property default_pose

AngleVector stored while initialization

戻り値:

1 x len(self.default_joints) vector

戻り値の型:

numpy.array

property default_coords

RootCoords stored while initialization

戻り値:

Transformation to end-effector at tip_link coordinates

戻り値の型:

cnoid.IRSLCoords.coordinates

irsl_choreonoid.robot_util.linkDirectChildren(lk)
irsl_choreonoid.robot_util.linkDescendants(lk)
irsl_choreonoid.robot_util.mergedMassPropertyOfAllDescendants(plink)

Merge mass-property of all descendants of parent link

パラメータ:

plink (cnoid.Link) -- parent link

戻り値:

(mass, center of mass[at parent link coordinates], inertia tensor[around center of mass])

戻り値の型:

(float, numpy.array, numpy.array)

irsl_choreonoid.robot_util.mergedMassPropertyOfList(linkList)

Merge mass-property of list of link

パラメータ:

linkList (list[cnoid.Link]) -- List of link, the first element is treated as the parent link

戻り値:

(base_coordinate, mass, center of mass[at base_coordinates], inertia tensor[around center of mass])

戻り値の型:

(coordinates, float, numpy.array, numpy.array)

class irsl_choreonoid.robot_util.RobotModelWrapped(robot, **kwargs)

ベースクラス: coordsWrapper

RobotModel for programming Interactively

RobotModel is displayed as cnoid.Base.RobotItem

サンプル

>>> robot_kin = RobotModel.loadMode('/path/to/your/robot.body')
>>> ## robot_kin is just kinematic-model of the robot
>>> robot_itm = RobotModel.loadModelItem('/path/to/your/robot.body')
>>> ## robot_item is displayed at item-list
__init__(robot, **kwargs)
パラメータ:

robot (cnoid.Body.Body or cnoid.BodyPlugin.BodyItem) -- robot model using in this class

registerNamedPose(name, angles=None, root_coords=None)

Registering named pose for using with irsl_choreonoid.robot_util.RobotModelWrapped.setNamedPose

パラメータ:
  • name (str) -- Name of registered pose

  • angles (numpy.array or list[float]) -- Angle-vector to be able to pass irsl_choreonoid.robot_util.RobotModelWrapped.angleVector

  • root_coords (cnoid.IRSLCoords.coordinates) -- Coordinates of Root

registerEndEffector(name, tip_link, tip_link_to_eef=None, joint_list=None, joint_tuples=None)

Registering named pose for using with irsl_choreonoid.robot_util.RobotModelWrapped.getLimb, etc.

パラメータ:
  • name (str) -- Name of limb as registered end-effector

  • tip_link (str or cnoid.Body.Link) -- Link which is direct parent of coordinates of end-effector

  • tip_link_to_eef (cnoid.IRSLCoords.coordinates) -- Coordinates tip_link to end_effector represented on link's coordinate

  • joint_list (list[str] or list[cnoid.Body.Link])

  • tuple((actual_name (joint_tuples () -- str, nickname:str)) ) : Tuple of actual_name and nick_name

class EndEffector(robot, name, tip_link, tip_link_to_eef=None, joint_list=None, joint_tuples=None, hook=None)

ベースクラス: object

EndEffector class for manipulating end-effector, limb, joint-group

__init__(robot, name, tip_link, tip_link_to_eef=None, joint_list=None, joint_tuples=None, hook=None)

Use RobotModelWrapped.registerEndEffector

nicknameOf(joint_name)
rename(nick_name)

Renaming using registered nick-name

パラメータ:

nick_name (str) -- nick-name

戻り値:

actual name

戻り値の型:

str

joint(jname)

Getting joint in this limb by name

パラメータ:

jname (str) -- name or nick-name of a joint

戻り値:

Instance of the joint

戻り値の型:

cnoid.Body.Link

property endEffector

Getting coordinate of the end-effector (return value is generated on demand)

戻り値:

Coordinate of the end-effector

戻り値の型:

cnoid.IRSLCoords.coordinates

property IK

Getting IKWrapper instance using this EndEffector

戻り値:

IKWrapper instance using this EndEffector

戻り値の型:

irsl_choreonoid.robot_util.IKWrapper

property angleMap

Getting dictionary [ key='jointName', value=jointAngle ]

戻り値:

Dictionary of key='jointName', value=jointAngle for joints in this Limb

戻り値の型:

dict [str, float ]

inverseKinematics(coords, **kwargs)

Solving inverse kinematic on this limb

パラメータ:
戻り値:

IK was success or not, and total count of calculation

戻り値の型:

(boolean, int)

move(vec, wrt=<wrt.local: 1>, **kwargs)

Relative moving end-effector linearly by translation vector

パラメータ:
  • vec (numpy.array) -- Translation vector

  • wrt (default = cnoid.IRSLCoords.coordinates.wrt.local) -- Just passing to cnoid.IRSLCoords.coordinates.translate

  • kwargs (dict) -- Just passing to IKWrapper

戻り値:

IK was success or not, and total count of calculation

戻り値の型:

(boolean, int)

rotate(angle, axis, wrt=<wrt.local: 1>, **kwargs)

Relative moving end-effector angularly by angle-axis

パラメータ:
  • angle (float) -- Rotation angle

  • axis (numpy.array) -- Rotation axis

  • wrt (default = cnoid.IRSLCoords.coordinates.wrt.local) -- Just passing to cnoid.IRSLCoords.coordinates.rotate

  • kwargs (dict) -- Just passing to IKWrapper

戻り値:

IK was success or not, and total count of calculation

戻り値の型:

(boolean, int)

moveCoords(coords, wrt=<wrt.local: 1>, **kwargs)

Relative moving end-effector by transformation of coordinates

パラメータ:
  • coords (cnoid.IRSLCoords.coordinates) -- Relative coordinates

  • wrt (default = cnoid.IRSLCoords.coordinates.wrt.local) -- Just passing to cnoid.IRSLCoords.coordinates.transform

  • kwargs (dict) -- Just passing to IKWrapper

戻り値:

IK was success or not, and total count of calculation

戻り値の型:

(boolean, int)

jointAngle(name, angle=None)

Setting or getting angle of the joint (limb version)

パラメータ:
  • name (str) -- Name of a joint, 'nickname' is acceptable.

  • angle (float, optional) -- Angle [radian] to be set

戻り値:

Angle of the joint, if do not find the name, None would be returned

戻り値の型:

float

setAngleMap(angle_map)

Setting angles of the joint (limb version)

パラメータ:

angle_map (dict[str, float]) -- Keyword is a joint name and value is a joint angle. 'nickname' is acceptable.

戻り値:

If angles is set, returns True

戻り値の型:

boolean

getAngleMap(*args)

Getting angles of the joint (limb version)

パラメータ:

name_list (list[str]) -- List of joint names. 'nickname' is acceptable.

戻り値:

Keyword is a joint name and value is a joint angle.

戻り値の型:

dict[str, float]

angleVector(angle_vector=None)

Setting or getting angle-vector (limb version)

パラメータ:

angle_vector (numpy.array) -- Vector of angle[radian] to be set

戻り値:

Vector of angle[radian]

戻り値の型:

numpy.array

property robot

Robot-model using wrapped by this instance

戻り値:

Instance of robot model currently using

戻り値の型:

cnoid.Body.Body

property item

Robot-model using wrapped by this instance

戻り値:

Instance of robot-item currently using

戻り値の型:

cnoid.BodyPlugin.BodyItem

setMode(mode=None)

Set updating mode

パラメータ:

mode (int, optional) -- Mode to be set (0: kinematics mode, 1: rendering mode, 2: rendering immediately mode)

戻り値:

Current mode (0: kinematics mode, 1: rendering mode, 2: rendering immediately mode, -1: do nothing while hook)

戻り値の型:

int

List of links

戻り値:

List of links

戻り値の型:

list [cnoid.Body.Link]

property linkNames

List of link names

戻り値:

List of link names

戻り値の型:

list [str]

property jointList

List of joints

戻り値:

List of joints

戻り値の型:

list [cnoid.Body.Link]

property jointNames

List of joint names

戻り値:

List of joint names

戻り値の型:

list [str]

property deviceList

List of devices

戻り値:

List of devices

戻り値の型:

list [cnoid.Body.Device]

property deviceNames

List of device names

戻り値:

List of device names

戻り値の型:

list [str]

device(arg)

Instance of the device

パラメータ:

arg (str, int, object) -- name or index of the device

戻り値:

instance of the device

戻り値の型:

cnoid.Body.Device

linkCoords(str_idx_instance)

Coordinates of the link

パラメータ:

str_index_instance (str, int, object) -- name or index of the link

戻り値:

coordinate of the link

戻り値の型:

cnoid.IRSLCoords.coordinates

jointCoords(str_idx_instance)

Coordinates of the joint

パラメータ:

str_index_instance (str, int, object) -- name or index of the joint

戻り値:

coordinate of the joint

戻り値の型:

cnoid.IRSLCoords.coordinates

deviceCoords(str_idx_instance)

Coordinates of the device

パラメータ:

str_index_instance (str, int, object) -- name or index of the device

戻り値:

coordinate of the device

戻り値の型:

cnoid.IRSLCoords.coordinates

angleVector(angles=None)

Setting or getting angle-vector

パラメータ:

angle_vector (numpy.array) -- Vector of angle[radian] to be set

戻り値:

Vector of angle[radian]

戻り値の型:

numpy.array

jointAngle(name, angle=None)

Setting or getting angle of the joint

パラメータ:
  • name (str) -- Name of a joint

  • angle (float, optional) -- Angle [radian] to be set

戻り値:

Angle of the joint, if do not find the name, None would be returned

戻り値の型:

float

setAngleMap(angle_map)

Setting angles of the joint

パラメータ:

angle_map (dict[str, float]) -- Keyword is a joint name and value is a joint angle. 'nickname' is acceptable.

戻り値:

If angles is set, returns True

戻り値の型:

boolean

getAngleMap(*args)

Getting angles of the joint

パラメータ:

name_list (list[str]) -- List of joint names. 'nickname' is acceptable.

戻り値:

Keyword is a joint name and value is a joint angle.

戻り値の型:

dict[str, float]

rootCoords(coords=None)

Getting or setting coordinates of root link of robot

パラメータ:

coords (cnoid.IRSLCoords.coordinates, optional) -- Coordinate to be set

戻り値:

Current coordinates of root link of robot

戻り値の型:

cnoid.IRSLCoords.coordinates

setDefaultPose()

Setting default pose if registered

setInitialPose()

Setting initial pose if registered

setZeroPose()

Setting all joint angles to zero

setNamedPose(name)

Setting named pose, name should be registered by irsl_choreonoid.robot_util.RobotModelWrapped.registerNamedPose

パラメータ:

name (str) -- Name of registered pose

getLimb(limb_name)

Getting limb as end-effector, name should be registered by irsl_choreonoid.robot_util.RobotModelWrapped.registerEndEffector

パラメータ:

limb_name (str) -- Name of registered limb as end-effector

戻り値:

Instance of EndEffector

戻り値の型:

irsl_choreonoid.robot_util.RobotModelWrapped.EndEffector

例外:

Exception -- If wrong limb name is passed

getEndEffector(limb_name)

Getting coordinates of end-effector of limb (return value is generated on demand)

パラメータ:

limb_name (str) -- Name of registered limb as end-effector

戻り値:

Current coordinates of end-effector of limb

戻り値の型:

cnoid.IRSLCoords.coordinates

property rleg

Pre defined accessor of limb, same as self.getLimb('rleg')

戻り値:

Instance of EndEffector (rleg)

戻り値の型:

irsl_choreonoid.robot_util.RobotModelWrapped.EndEffector

property lleg

Pre defined accessor of limb, same as self.getLimb('lleg')

戻り値:

Instance of EndEffector (lleg)

戻り値の型:

irsl_choreonoid.robot_util.RobotModelWrapped.EndEffector

property rarm

Pre defined accessor of limb, same as self.getLimb('rarm')

戻り値:

Instance of EndEffector (rarm)

戻り値の型:

irsl_choreonoid.robot_util.RobotModelWrapped.EndEffector

property larm

Pre defined accessor of limb, same as self.getLimb('larm')

戻り値:

Instance of EndEffector (larm)

戻り値の型:

irsl_choreonoid.robot_util.RobotModelWrapped.EndEffector

property arm

Pre defined accessor of limb, same as self.getLimb('arm')

戻り値:

Instance of EndEffector (arm)

戻り値の型:

irsl_choreonoid.robot_util.RobotModelWrapped.EndEffector

property head

Pre defined accessor of limb, same as self.getLimb('head')

戻り値:

Instance of EndEffector (head)

戻り値の型:

irsl_choreonoid.robot_util.RobotModelWrapped.EndEffector

property torso

Pre defined accessor of limb, same as self.getLimb('torso')

戻り値:

Instance of EndEffector (torso)

戻り値の型:

irsl_choreonoid.robot_util.RobotModelWrapped.EndEffector

property rlegEndEffector

Pre defined accessor to end-effector, same as self.getLimb('rleg').endEffector

戻り値:

Current coordinates of end-effector of limb(rleg)

戻り値の型:

cnoid.IRSLCoords.coordinates

property llegEndEffector

Pre defined accessor to end-effector, same as self.getLimb('lleg').endEffector

戻り値:

Current coordinates of end-effector of limb(lleg)

戻り値の型:

cnoid.IRSLCoords.coordinates

property rarmEndEffector

Pre defined accessor to end-effector, same as self.getLimb('rarm').endEffector

戻り値:

Current coordinates of end-effector of limb(rarm)

戻り値の型:

cnoid.IRSLCoords.coordinates

property larmEndEffector

Pre defined accessor to end-effector, same as self.getLimb('larm').endEffector

戻り値:

Current coordinates of end-effector of limb(larm)

戻り値の型:

cnoid.IRSLCoords.coordinates

property armEndEffector

Pre defined accessor to end-effector, same as self.getLimb('arm').endEffector

戻り値:

Current coordinates of end-effector of limb(arm)

戻り値の型:

cnoid.IRSLCoords.coordinates

property headEndEffector

Pre defined accessor to end-effector, same as self.getLimb('head').endEffector

戻り値:

Current coordinates of end-effector of limb(head)

戻り値の型:

cnoid.IRSLCoords.coordinates

property torsoEndEffector

Pre defined accessor to end-effector, same as self.getLimb('torso').endEffector

戻り値:

Current coordinates of end-effector of limb(torso)

戻り値の型:

cnoid.IRSLCoords.coordinates

inverseKinematics(coords, limb_name='default', **kwargs)

Solving inverse kinematic of the limb

パラメータ:
  • coords (cnoid.IRSLCoords.coordinates) -- Coordinate of the target

  • limb_name (str, default='default') -- Name of the limb

  • **kwargs (dict) -- Just passing to IKWrapper

戻り値:

IK was success or not, and total count of calculation

戻り値の型:

(boolean, int)

footMidCoords(p=0.5)

Getting coordinates representing mid-point of leg's end-effector

パラメータ:

p (float, default=0.5) -- Parameter of mid-point. (0.5, 0.0, 1.0 represents the center, rleg, lleg, respectively)

戻り値:

Coordinates indicating the mid-point of legs

戻り値の型:

cnoid.IRSLCoords.coordinates

注釈

This method requires settings of limbs( 'rleg' and 'lleg' )

fixLegToCoords(coords=None, p=0.5)

Locating the robot by fixing the legs to designated coordinates

パラメータ:
  • coords (cnoid.IRSLCoords.coordinates, optional) -- Target coordinates ( footMidCoords of this robot will be the same as this coordinates )

  • p (float, default=0.5) -- Parameter of mid-point. (0.5, 0.0, 1.0 represents the center, rleg, lleg, respectively)

注釈

This method requires settings of limbs( 'rleg' and 'lleg' )

fixSelfCoordsToTarget(selfcoords, target_coords)
keepJointLimit(on_=True)

Setting mode to keep joint limits

パラメータ:

on (boolean, default=True)

戻り値:

Returns current settings

戻り値の型:

(boolean)

trimJointAngles()

Force setting joint angles inside the range of limits

calcMinimumDuration(target_angle_vector, original_angle_vector=None, ratio=1.0)

Calculating duration for the fastest movement depend on a joint limit

パラメータ:
  • target_angle_vector (numpy.array) -- AngleVector to be moved to

  • original_angle_vector (numpy.array, optional) -- AngleVector to be moved from. If this argument is not given, current angles will be used.

  • ratio (float) -- Result will be multipled by this value

戻り値:

Duration [ second ]

戻り値の型:

float

fullBodyIK(targets, limbs, com_target=None, base_target=None, revert_if_failed=True, retry=10, **kwargs)

Top method to solve fullbody inverse-kinematics

パラメータ:
  • targets (cnoid.IRSLCoords.coordinates) -- List of coordinates as target for inverse-kinematics

  • limbs (irsl_choreonoid.robot_util.RobotModelWrapped.EndEffector) -- List of limb(EndEffector), size of limbs should be equal to size of targets

  • com_target (numpy.array) -- Target of COM ( Center of Mass )

  • base_target (cnoid.IRSLCoords.coordinates) -- Target of base (root_link)

  • revert_if_failed (boolean, default = True) -- if True, no modification (moving joint and root-link) to robot-model when calculation of IK is failed

  • retry (int, defualt = 100) -- number of retrying solving IK

  • **kwargs (dict) -- Other keywords just passing to fullBodyIKRaw (See irsl_choreonoid.robot_util.RobotModelWrapped.fullBodyIKRaw)

戻り値:

IK was success or not, and total count of calculation

戻り値の型:

(boolean, int)

注釈

constraint : [1,1,1, 1,1,1] base_type : [1,1,1, 1,1,1]

fullBodyIKRaw(targets, limbs, com_target=None, base_target=None, constraint='6D', base_type='xy', com_constraint=[1, 1, 0], weight=1.0, base_weight=1.0, debug=False, max_iteration=32, threshold=5e-05, threshold_we=5e-05, use_joint_limit=True, joint_limit_max_error=0.01, position_precision=None, com_precision=None, joint_limit_precision=0.1, **kwargs)
legsCOM_IK(r_target, l_target, com_target=None, **kwargs)
armsCOM_IK(r_target, l_target, com_target=None, **kwargs)
moveCentroidOnFoot(p=0.5, com_height=None, **kwargs)

Move projected centroid to the center of feet

パラメータ:
  • p (float, default = 0.5) -- Parameter of center position (p == 0.5 means center, p == 0.0 means right-foot, p == 1.0 means left-foot)

  • com_height (float, optional) -- Set target of height of CenterOfMass

Adding new link

パラメータ:

注釈

keywords for kwargs are listed below. JointName, Mass, CenterOfMass, Inertia, EquivalentRotorInertia, JointId, JointAxis, JointVelocityRange, JointRange, JointEffortRange, InitialJointDisplacement, ActuationMode

setFrame(name, parentLink, offset)

Setting temporary frame (link), which is connected by fixed-joint

パラメータ:
  • name (str) -- Name of the adding link

  • parentLink (str or cnoid.Body.Link) -- Link name or instance of link which the adding link is connected to

  • offset (cnoid.IRSLCoords.coordinates) -- Offset from parentLink to the adding link ( on parentLink coordinates )

generateCurrentVisual(scalable=False, init_coords=None)

Generate visual (scene graph) of robot with current state

パラメータ:
  • scalable (boolean, default=False) -- Enable methods, scale and switch

  • init_coords (cnoid.IRSLCoords.coordinates, optional) -- Coordinates of root-coords of generated visual

戻り値:

Wrapped SceneGrap (can visualize with DrawInterface)

戻り値の型:

( irsl_draw_object.coordsWrapper )

getDeviceMap()

Generates a list of device information dictionaries for all devices

戻り値:

A list where each element is a dictionary containing the device's coordinates map, type, name, id, and associated link name.

戻り値の型:

list of dict

addDeviceFromMap(dev_map)

Adds devices to a robot body from a device map.

パラメータ:
  • inBody (object) -- The robot body or RobotModel instance to which devices will be added.

  • dev_map (list of dict) -- A list of dictionaries, each specifying a device to add. Each dictionary should contain at least the 'type' and 'link' keys, and may optionally include 'name', 'id', and other configuration parameters.

注釈

The style of dev_map is the same as the returns from getDeviceMap

classmethod loadModel(fname, **kwargs)

Load a robot model as a kinematic model from a file.

パラメータ:
  • fname (str) -- The path to the robot model file to be loaded.

  • **kwargs -- Additional keyword arguments to pass to both irsl_choreonoid.cnoid_util.loadRobot() and the class constructor.

戻り値:

An instance of the current class initialized with the loaded robot model.

例外:
  • FileNotFoundError -- If the specified file does not exist.

  • RuntimeError -- If the robot model file cannot be parsed or loaded.

classmethod loadModelItem(fname, **kwargs)

Load a robot model as a BodyItem in the item-list.

パラメータ:
  • fname (str) -- The path to the robot model file to be loaded.

  • **kwargs -- Additional keyword arguments to pass to both irsl_choreonoid.cnoid_util.loadRobotItem() and the class constructor.

戻り値:

An instance of the current class initialized with the loaded robot model.

例外:
  • FileNotFoundError -- If the specified file does not exist.

  • RuntimeError -- If the robot model file cannot be parsed or loaded.

class irsl_choreonoid.robot_util.ImportedRobotModel(robot=None, item=True, world=False, name=None, **kwargs)

ベースクラス: RobotModelWrapped

Class for making specific robot model

  1. Set model_cls.model_file in the module

  2. model_module.robot_class should be set

サンプル

>>> ### SpecificRobotClass.py
>>> class SpecificRobotClass(ImportedRobotModel):
>>>     def __init__(self, robot=None, item=True, world=False, **kwargs):
>>>         super().__init__(robot=robot, item=item, world=world, **kwargs)
>>>
>>>     def _setting_before_init(self, robot, **kwargs):  ## override
>>>         pass
>>>
>>>     def _init_ending(self, **kwargs): ## override
>>>         pass
>>> SpecificRobotClass.model_file = 'path_to_model_file' ## 1. ##
>>> robot_class = SpecificRobotClass ## 2. ##
__init__(robot=None, item=True, world=False, name=None, **kwargs)
パラメータ:
  • robot (cnoid.Body.Body or cnoid.BodyPlugin.BodyItem)

  • item (boolean, default=True) -- If true, loading as BodyItem

  • world (boolean, default=True) -- If true, BodyItem will be loaded under WorldItem

  • name (str, optional) -- name of loaded model

irsl_choreonoid.robot_util.getDeviceMap(inBody)

Generates a list of device information dictionaries for all devices in the given robot body.

パラメータ:

inBody (object) -- The robot body object. If it is an instance of RobotModel, devices are accessed via inBody.robot.devices, otherwise via inBody.devices.

戻り値:

A list where each element is a dictionary containing the device's coordinates map, type, name, id, and associated link name.

戻り値の型:

list of dict

irsl_choreonoid.robot_util.addDeviceFromMap(inBody, dev_map)

Adds devices to a robot body from a device map.

パラメータ:
  • inBody (object) -- The robot body or RobotModel instance to which devices will be added.

  • dev_map (list of dict) -- A list of dictionaries, each specifying a device to add. Each dictionary should contain at least the 'type' and 'link' keys, and may optionally include 'name', 'id', and other configuration parameters.

注釈

The style of dev_map is the same as the returns from getDeviceMap

irsl_choreonoid.robot_util.replaceCamera(oldcam, newcam)

Replace oldcam to newcam

パラメータ:
  • oldcam (cnoid.Body.Camera)

  • newcam (cnoid.Body.Camera)

戻り値:

replaced Camera

戻り値の型:

cnoid.Body.Camera

注釈

This is used to change device,Camera to device,DepthCamera

irsl_choreonoid.draw_coords

https://github.com/IRSL-tut/irsl_choreonoid/blob/main/irsl_choreonoid/draw_coords.py

class irsl_choreonoid.draw_coords.DrawCoordsList(x_color=array([1, 0, 0]), y_color=array([0, 1, 0]), z_color=array([0, 0, 1]), length=0.1, width=None)

ベースクラス: object

Drawing list of coordinates

__init__(x_color=array([1, 0, 0]), y_color=array([0, 1, 0]), z_color=array([0, 0, 1]), length=0.1, width=None)

DrawCoordsList(initializer)

パラメータ:
  • x_color (numpy.array, default = [1, 0, 0]) -- color of x-axis

  • y_color (numpy.array, default = [0, 1, 0]) -- color of y-axis

  • z_color (numpy.array, default = [0, 0, 1]) -- color of z-axis

  • length (float, default = 0.1) -- length of axis

  • width (float, optional) -- width of axis

property count

Number of coords stored in this instance

戻り値:

current number of coords stored in this instance

戻り値の型:

int

property T

Transformation matrix

戻り値:

4x4 matrix, homogeneous transformation matrix (cnoidPosition)

戻り値の型:

numpy.array

property interface

Actual interface instance

戻り値:

actual instance to draw lines

戻り値の型:

cnoid.DrawInterface.DrawInterface

setOrigin(coords)

Setting new origin

パラメータ:

coords (cnoid.IRSLCoords.coordinates) -- new origin to be set

getOrigin()

Getting current origin

パラメータ:

None

戻り値:

current origin

戻り値の型:

cnoid.IRSLCoords.coordinates

setLineWidth(_width)

Set line width

パラメータ:

_width (float) -- line width to be set

flush()

Force rendering coords

パラメータ:

None

clear()

Clear all drawn coords

パラメータ:

None

addCoords(coords, flush=True)

Draw coordinates (3-axis, position and rotation)

パラメータ:
戻り値:

number of drawn coords

戻り値の型:

int

addCross(coords, flush=True)

Draw cross (3-axis, line is crossing at center)

パラメータ:
戻り値:

number of drawn coords

戻り値の型:

int

addPoint(point, flush=True)

Draw point (cross with no rotation)

パラメータ:
  • point (numpy.array) -- 1x3 vector, point to be drawn

  • flush (boolean, default = True) -- if True, rendering scene immediately

戻り値:

number of drawn coords

戻り値の型:

int

class irsl_choreonoid.draw_coords.DrawCoordsListWrapped(**kwargs)

ベースクラス: DrawCoordsList, coordsWrapper

Wrapped version of irsl_choreonoid.DrawCoordsList

Using for drawing coordinates interactively

__init__(**kwargs)
パラメータ:

kwargs (dict[str, param]) -- this is passing to irsl_choreonoid.robot_util.make_coordinates for making initial_coords of coordsWrapper

class irsl_choreonoid.draw_coords.GeneralDrawInterfaceWrapped(**kwargs)

ベースクラス: GeneralDrawInterface, coordsWrapper

Wrapped version of cnoid.DrawInterface.GeneralDrawInterface

Using for drawing SceneGraph objects interactively

property SgPosTransform

Generating instance of cnoid.Util.SgPosTransform, which represents the root position of this instance

Returns:

Root of drawn objects in this instance at SceneGraph

Return Type:

cnoid.Util.SgPosTransform

__init__(**kwargs)
パラメータ:

kwargs (dict[str, param]) -- this is passing to irsl_choreonoid.robot_util.make_coordinates for making initial_coords of coordsWrapper

flush(doImmediately=False)

Force rendering scene

パラメータ:

None

clear(flush=True)

Clear all added objects

パラメータ:

flush (boolean, default = True) -- If it is False, the scene is not rendered

addObject(obj, update=True, hook=True)

This method is overrided, just passing arguments to addPyObject

addObjects(objlst, update=True, hook=True)

Adding objects to be drawn

パラメータ:
  • objlst (list[cnoid.Util.SgNode]) -- list of objects to be drawn

  • update (boolean, default = False) -- if True, rendering scene immediately

removeObject(obj, update=True)

This method is overrided, just passing arguments to removePyObject

removeObjects(objlst, update=True)

Removing objects to be drawn

パラメータ:
  • objlst (list[cnoid.Util.SgNode]) -- list of objects to be removed

  • update (boolean, default = False) -- if True, rendering scene immediately

addPyObject(obj, update=True, hook=True)

Adding object to be drawn

パラメータ:
  • obj (cnoid.Util.SgNode) -- object to be drawn

  • update (boolean, default = False) -- if True, rendering scene immediately

removePyObject(obj, update=True)

Removing drawn object

パラメータ:
  • obj (cnoid.Util.SgNode) -- object to be removed

  • update (boolean, default = False) -- if True, rendering scene immediately

addAll(*objs, update=True)

Add all objects contained in the arguments

パラメータ:
  • objs* (cnoid.Util.SgNode or list contained SgNode) -- objects to be drawn

  • update (boolean, default = True) -- if True, rendering scene immediately

class coordsWrapper

Base class for using coordinates interactively.

Inherited by class DrawCoordsListWrapped and class GeneralDrawInterfaceWrapped.

https://github.com/IRSL-tut/irsl_choreonoid/blob/main/irsl_choreonoid/irsl_draw_object.py

class irsl_choreonoid.irsl_draw_object.coordsWrapper(target, init_coords=None, update_callback=None, kinematics_callback=None, original_object=None, scalable=False)

ベースクラス: coordinates

class coordsWrapper(cnoid.IRSLCoords.coordinates)

This class aims to wrap a cnoid Object which have position (SgPosTransform, Link, etc.)

You can access to this object with methods in cnoid.IRSLCoords.coordinates,

Some mthods (newcoords, translate, rotate, transform) to update itself are overrided to add calling callback_function.

Then, you can run some process when the position of the target is updated.

__init__(target, init_coords=None, update_callback=None, kinematics_callback=None, original_object=None, scalable=False)
パラメータ:
  • target (object) -- wrapped target which have property 'T' for setting cnoidPosition

  • init_coords (cnoid.IRSLCoords.coordinates, optional) -- coordinates of this instance

  • update_callback (function(), optional) -- callback function which is called when target is updated (including drawing)

  • kinematics_callback (function(), optional) -- callback function which is called when target is updated (only updating kinematics)

  • scalable (boolean, default=False) -- call setScalable() within constructor

assoc(child, coords=None)

Associate coordinates as a child

パラメータ:
dissoc(child)

Finish association with child coordinates

パラメータ:

child (irsl_choreonoid.irsl_draw_object.coordsWrapper)

dissocFromParent()

Finish association with parent coordinates

clearChildren()

Clear all children

property descendants

Getting all children

isChild(coords)

Query: Is it a child ?

isParent(coords)

Query: Is it a parent ?

hasChild()

Query: Does it have child ?

setScalable()

Enabling to use methods, setScale and setTurnedOn

setColorChangeable()

Enabling to use methods, changeColor

changeColor(color=None, ambient=None, emissive=None, specular=None, specularExponent=None, transparent=None, update=False)

Changing color ( use setColorChangeable method before using this method )

updateTarget(update=True)

Updating self.target and call callback_function

パラメータ:

None

setUpdateCallback(func)

Setting callback function for updating drawings

パラメータ:

func (function()) -- callback function which is called when target is updated

setKinematicsCallback(func)

Setting callback function for updating kinematics

パラメータ:

func (function()) -- callback function which is called when target is updated

newcoords(cds)

Wrapped method of newcoords in cnoid.IRSLCoords.coordinates

パラメータ:

cds (cnoid.IRSLCoords.coordinates) -- replace pos and rot in self with cds

戻り値:

identical instance which was called with this method

戻り値の型:

cnoid.IRSLCoords.coordinates

translate(pos, wrt=None)

Wrapped method of translate in cnoid.IRSLCoords.coordinates

パラメータ:
戻り値:

identical instance which was called with this method

戻り値の型:

cnoid.IRSLCoords.coordinates

locate(pos, wrt=None)

Wrapped method of locate in cnoid.IRSLCoords.coordinates

パラメータ:
戻り値:

identical instance which was called with this method

戻り値の型:

cnoid.IRSLCoords.coordinates

rotate(ang, axis, wrt=None)

Wrapped method of rotate in cnoid.IRSLCoords.coordinates

パラメータ:
戻り値:

identical instance which was called with this method

戻り値の型:

cnoid.IRSLCoords.coordinates

orient(ang, axis, wrt=None)

Wrapped method of orient in cnoid.IRSLCoords.coordinates

パラメータ:
戻り値:

identical instance which was called with this method

戻り値の型:

cnoid.IRSLCoords.coordinates

rotate_with_matrix(rot, wrt=None)

Wrapped method of rotate_with_matrix in cnoid.IRSLCoords.coordinates

パラメータ:
戻り値:

identical instance which was called with this method

戻り値の型:

cnoid.IRSLCoords.coordinates

orient_with_matrix(rot, wrt=None)

Wrapped method of orient_with_matrix in cnoid.IRSLCoords.coordinates

パラメータ:
戻り値:

identical instance which was called with this method

戻り値の型:

cnoid.IRSLCoords.coordinates

transform(trs, wrt=None)

Wrapped method of transform in cnoid.IRSLCoords.coordinates

パラメータ:
戻り値:

identical instance which was called with this method

戻り値の型:

cnoid.IRSLCoords.coordinates

move_to(trs, wrt=None)

Wrapped method of move_to in cnoid.IRSLCoords.coordinates

パラメータ:
戻り値:

identical instance which was called with this method

戻り値の型:

cnoid.IRSLCoords.coordinates

property target

Wrapped target of this instance, which was manipulated by methods of this class

戻り値:

instance which have method 'T' to set cnoidPosition (4x4 matrix)

戻り値の型:

object

property object

Wrapped object of this instance, which was manipulated by methods of this class

戻り値:

Utility slot set while initializing

戻り値の型:

object

注釈

target is a transformed target such as cnoid.Util.SgPosTransform object is a utility slot for handling a child of the target (Shape, etc...)

setScale(float_or_vec, update=False)

Setting scale of drawn objects

パラメータ:
  • float_or_vec (float or [float]) -- Parameter of scale

  • update (boolean, default=False) -- Update drawn object in screen

setTurnedOn(on=True, update=False)

Switching On/Off of drawn objects

パラメータ:
  • on (boolean, default=False) -- Switch to draw this object

  • update (boolean, default=False) -- Update drawn object in screen

module irsl_choreonoid.control_utils

https://github.com/IRSL-tut/irsl_choreonoid/blob/main/irsl_choreonoid/control_utils.py

irsl_choreonoid.control_utils.interpolateCoords(tt, coords_list)

not implemented yet

class irsl_choreonoid.control_utils.Sequencer(dt=0.001)

ベースクラス: object

Sequencer to set target-angles every cycle with interpolatin

__init__(dt=0.001)
パラメータ:

dt (float, default=0.001)

setNoInterpolation(angle_vectors, step=1)

Set angle-vectors without interpolation

パラメータ:
  • angle_vectors (list[ numpy.array ]) -- List of angle-vector

  • step (int, default=1) -- Target angle is updated every step-times of cycle

setWithSteps(angle_vector, step=2)

Set single angle-vector with linear interpolation

パラメータ:
  • angle_vector (numpy.array) -- Target angle-vector

  • step (int, default=2) -- After step cycle, target-angles equals to angle_vector

class irsl_choreonoid.control_utils.BodySequencer(body, dt=0.001)

ベースクラス: Sequencer

__init__(body, dt=0.001)

module irsl_choreonoid.simulation_utils

https://github.com/IRSL-tut/irsl_choreonoid/blob/main/irsl_choreonoid/simulation_utils.py

module irsl_choreonoid.setup_cnoid

https://github.com/IRSL-tut/irsl_choreonoid/blob/main/irsl_choreonoid/setup_cnoid.py

class irsl_choreonoid.setup_cnoid.SetupCnoid(rootItem=None, worldItem=None)

ベースクラス: object

Utility class for setting .cnoid file from python script

__init__(rootItem=None, worldItem=None)
パラメータ:
  • rootItem (cnoid.Base.Item, optional) -- If set, it is used as root for creating environment

  • worldItem (cnoid.Base.WorldItem, optional) -- If set, it is used as a worldItem

buildEnvironment(info_dict, world='World', createWorld=False, setCamera=False, offset=None)

Building environment (setting objects) under the WorldItem

パラメータ:
  • dict['key' (info_dict () -- value] ) : Dictionary for representing objects on environment

  • world (str, default='World') -- Name of WorldItem, added objects under this item

  • createWorld (boolean, default=False) -- If True, creating new WorldItem

  • setCamera (boolean, default=False) -- If True, set camera position

  • offset (cnoid.IRSLCoords.coordinates) -- Offset of objects

addExtraWorld(world_info)

abstract method

createCnoid(info_dict, addDefaultSimulator=True, addDefaultWorld=True, noEnvironment=False)

Creating project from parameters

パラメータ:
  • dict['key' (info_dict () -- value] ) : Dictionary for representing the project

  • addDefaultSimulator (boolean, default=True) -- If True, adding new SimulatorItem if there is no instruction in info_dict

  • addDefaultWorld (boolean, default=True) -- If True, adding new WorldItem if there is no instruction in info_dict

  • noEnvironment (boolean, default=False) -- If True, not adding environment(objects). Use buildEnvironment method.

buildEnvironmentFromYaml(yamlFile, **kwargs)

Building environment from yaml-file

パラメータ:
  • yamlFile (str) -- File name to load

  • kwargs (dict) -- Keyword to pass to setup_cnoid.buildEnvironment

createCnoidFromYaml(yamlFile, **kwargs)

Creating project from yaml-file

パラメータ:
  • yamlFile (str) -- File name to load

  • kwargs (dict) -- Keyword to pass to setup_cnoid.createCnoid

classmethod setEnvironmentFromYaml(yamlFile, **kwargs)

Setup environment from yaml-file (classmethod of buildEnvironmentFromYaml)

パラメータ:
  • yamlFile (str) -- File name to load

  • kwargs (dict) -- Keyword to pass to setup_cnoid.buildEnvironment

戻り値:

Instance of setup_cnoid

戻り値の型:

irsl_choreonoid.setup_cnoid

classmethod setCnoidFromYaml(yamlFile, **kwargs)

Setup project from yaml-file (classmethod of createCnoidFromYaml)

パラメータ:
  • yamlFile (str) -- File name to load

  • kwargs (dict) -- Keyword to pass to setup_cnoid.createCnoid

戻り値:

Instance of setup_cnoid

戻り値の型:

irsl_choreonoid.setup_cnoid

classmethod setupEnvironment(info, **kwargs)

Building environment (setting objects) under the WorldItem (class method)

パラメータ:
  • dict['key' (info_dict () -- value] ) : Dictionary for representing objects on environment

  • world (str, default='World') -- Name of WorldItem, added objects under this item

  • createWorld (boolean, default=False) -- If True, creating new WorldItem

  • setCamera (boolean, default=False) -- If True, set camera position

  • offset (cnoid.IRSLCoords.coordinates) -- Offset of objects

classmethod setupCnoid(info, **kwargs)

Creating project from parameters (class method)

パラメータ:
  • dict['key' (info_dict () -- value] ) : Dictionary for representing the project

  • addDefaultSimulator (boolean, default=True) -- If True, adding new SimulatorItem if there is no instruction in info_dict

  • addDefaultWorld (boolean, default=True) -- If True, adding new WorldItem if there is no instruction in info_dict

  • noEnvironment (boolean, default=False) -- If True, not adding environment(objects). Use buildEnvironment method.

startSimulator(realTime=None)

Starting simulation

パラメータ:

realTime (boolean, default=None) -- If True, simulator will run with realtime sync mode

irsl_choreonoid.RobotBuilder

https://github.com/IRSL-tut/irsl_choreonoid/blob/main/irsl_choreonoid/RobotBuilder.py

class irsl_choreonoid.RobotBuilder.RobotBuilder(robot=None, gui=True, name=None)

ベースクラス: object

Building robot interactively

サンプル

>>> bx = rb.makeBox(0.3)
>>> l_root = rb.createLinkFromShape(name='Root', root=True, density=400.0)
>>> j = rb.createJointShape(jointType=Link.JointType.RevoluteJoint)
>>> lg = rb.makeBox(x=0.2, y=0.2, z=0.6)
>>> lg.translate(fv(0, 0, 0.3))
>>> l0=rb.createLinkFromShape(name='LINK0', parentLink=l_root, density=400.0, JointId=0, JointName='JOINT0', InitialJointAngle=0.0, JointRange=[-PI, PI], JointVelocityRange=[-PI*10, PI*10], JointEffortRange=[-100, 100], EquivalentRotorInertia=0.1)
>>> rb.exportBody('/tmp/test.body', modelName='test')
class JointType(*values)

ベースクラス: IntEnum

__init__(robot=None, gui=True, name=None)
パラメータ:
  • robot (,optional)

  • gui (boolean, default=True)

  • name (str, optional)

property body

Currently builded robot model

戻り値:

Currently builded robot model

戻り値の型:

cnoid.Body.Body

property bodyItem

Currently displayed BodyItem

戻り値:

Currently displayed BodyItem

戻り値の型:

cnoid.BodyPlugin.BodyItem

property draw

DrawInterface for accessing raw-level display methods

戻り値:

DrawInterface

戻り値の型:

irsl_choreonoid.draw_coords.DrawInterfaceWrapped

hideRobot()

Hiding robot model (uncheck RobotItem)

showRobot()

Showing robot model (check RobotItem)

resetRobot()

Resetting joint-angles of the robot

newRobot(robot=None, name=None)

Restarting with new robot(item)

パラメータ:
  • robot (str, optional)

  • name (str, optional) -- name of RobotItem

clear()

Clearing showing geometries

objects()

Getting list of shown objects

addShape(shape)

Adding a shape

パラメータ:

shape (cnoid.Util.SgNode) -- Shape to be added

addShapes(shapes)

Adding a shapes

パラメータ:

shapes (list[cnoid.Util.SgNode]) -- Shapes to be added

removeShape(shape)

Removing a shape

パラメータ:

shape (cnoid.Util.SgNode) -- Shape to be removed

removeShapes(shapes)

Removing a shapes

パラメータ:

shapes (list[cnoid.Util.SgNode]) -- Shapes to be removed

createLinkFromShape(name=None, mass=None, density=1000.0, parentLink=None, root=False, clear=True, collision=None, useCollisionForMassparam=False, overwriteMassparam=None, **kwargs)

Creating link from drawn shapes and appending to the other link

パラメータ:
  • name (str, optional)

  • mass (float, optional)

  • density (float, default=1000.0)

  • parentLink (cnoid.Body.Link, optional)

  • root (boolean, default=False)

  • clear (boolean, default=True)

  • collision (cnoid.Util.SgNode, optional)

  • useCollisionForMassparam (boolean, default=False)

  • overwriteMassparam (dict, optional) -- 'mass', 'COM', 'inertia'

  • **kwargs

戻り値:

Created link

戻り値の型:

cnoid.Body.Link

viewInfo(autoScale=False, **kwargs)

Showing information of links. (joint-type, joint-axis, mass, center-of-mass, inertia) :param autoScale: :type autoScale: boolean, default=False :param **kwargs: The other keywords will be passed to irsl_choreonoid.RobotBuilder.RobotBuilder.createVisualizedLinkShape

戻り値:

Created shapes

戻り値の型:

list [ SceneGraph ]

notifyUpdate()

Notifying update for redrawing robot-model and shapes

createJointShape(jointType=<JointType.FreeJoint: 2>, wrapped=True, coords=None, add=True, scale=0.3, **kwargs)

Creating and showing jointShape

パラメータ:
戻り値:

Created shape

戻り値の型:

Shape

Creating a link

パラメータ:
  • name (str, default='')

  • mass (float, default=0.1)

  • COM (numpy.array, optional)

  • density (float, optional)

  • inertia (numpy.array, optional)

  • shape (cnoid.Util.SgNode, optional)

  • visual (cnoid.Util.SgNode, optional)

  • collision (cnoid.Util.SgNode, optional)

  • **kwargs

戻り値:

Created Link

戻り値の型:

cnoid.Body.Link

Creating a link and adding it as root-link

パラメータ:

**kwargs

戻り値:

Created Link

戻り値の型:

cnoid.Body.Link

createVisualizedLinkShape(alink, scale=0.1, wrapped=True, addCOM=True, addInertia=True, addJoint=True, addDevice=True, addToLink=False, noLinkShape=False, useCollision=False, useInertiaBox=False)
パラメータ:
  • alink (cnoid.Body.Link) -- Target link to be visualized

  • scale (float, default=0.1) -- Scale factor of shapes

  • wrapped (boolean, default=True) -- Returns wrapped object

  • addCOM (boolean, default=True) -- Add COM(Center Of Mass) shapes

  • addInertia (boolean, default=True) -- Add inertia-tensor shapes

  • addJoint (boolean, default=True) -- Add joint-type shapes

  • addDevice (boolean, default=True) -- Add device-type shapes

  • addToLink (boolean, default=False) -- Add shapes directly to alink

  • noLinkShape -- (boolean, default=False) :

  • useCollision (boolean, default=False) -- Use collision shape as visualized shape

  • useInertiaBox (boolean, default=False) -- Use box shape for visualizing inertia-tensor (default: ellipsoid)

戻り値:

Created shape

戻り値の型:

Shape

exportBody(fname, modelName=None, mode=0, **kwargs)

Exporting created robot-model to file as .body file

パラメータ:
  • fname (str) -- Name of file

  • modelName (str, optional)

  • mode (int, default=0) -- 0; EmbedModels, 1; LinkToOriginalModelFiles, 2; CopyModelFiles, 3; ReplaceWithStdSceneFiles, 4; ReplaceWithObjModelFiles

  • kwargs (dict)

exportURDF(fname, **kwargs)

Exporting created robot-model to file as .urdf file

パラメータ:
  • fname (str) -- Name of file

  • kwargs (dict)

loadScene(fname, wrapped=True, add=True, **kwargs)

Loading scene as a shape, see irsl_choreonoid.make_shapes.loadScene

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape

loadMesh(fname, wrapped=True, add=True, **kwargs)

Loading mesh as a shape, see irsl_choreonoid.make_shapes.loadMesh

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape

makeBox(x, y=None, z=None, wrapped=True, add=True, **kwargs)

Making box shape, see irsl_choreonoid.make_shapes.makeBox

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape

makeCylinder(radius, height, wrapped=True, add=True, **kwargs)

Making cylinder shape, see irsl_choreonoid.make_shapes.makeCylinder

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape

makeSphere(radius, wrapped=True, add=True, **kwargs)

Making sphere shape, see irsl_choreonoid.make_shapes.makeSphere

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape

makeCone(radius, height, wrapped=True, add=True, **kwargs)

Making cone shape, see irsl_choreonoid.make_shapes.makeCone

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape

makeCapsule(radius, height, wrapped=True, add=True, **kwargs)

Making capsule shape, see irsl_choreonoid.make_shapes.makeCapsule

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape

makeTorus(radius, corssSectionRadius, beginAngle=None, endAngle=None, wrapped=True, add=True, **kwargs)

Making torus shape, see irsl_choreonoid.make_shapes.makeTorus

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape

makeExtrusion(crossSection, spine, wrapped=True, add=True, **kwargs)

Making extrusion shape, see irsl_choreonoid.make_shapes.makeExtrusion

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape

makeElevationGrid(xDimension, zDimension, xSpacing, zSpacing, height, wrapped=True, add=True, **kwargs)

Making elevation-grid shape, see irsl_choreonoid.make_shapes.makeElevationGrid

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape

make3DAxis(coords=None, add=True, **kwargs)

Making 3D-axis shape, see irsl_choreonoid.make_shapes.make3DAxis

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape

make3DAxisBox(coords=None, add=True, **kwargs)

Making 3D-axis shape (type: box), see irsl_choreonoid.make_shapes.make3DAxisBox

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape

makeCoords(coords=None, add=True, **kwargs)

Making 3D-axis shape (type: line), see irsl_choreonoid.make_shapes.makeCoords

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape

makeCross(coords=None, add=True, **kwargs)

Making 3D-axis shape (type: crossing-line), see irsl_choreonoid.make_shapes.makeCross

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape

makeLineAlignedShape(start, end, add=True, **kwargs)

Making shape which is aligned to designated line, see irsl_choreonoid.make_shapes.makeLineAlignedShape

パラメータ:

add (boolean, default=True)

戻り値:

Created shape

戻り値の型:

Shape