CoppeliaSim 4.3.0 User Manual - CoppeliaSim 4.3.0 使用者手冊

  • Home
    • Site Map
    • reveal
    • blog
  • welcome
  • userInterface
    • pagesAndViews
    • coordinateDialog
    • positionDialog
    • orientationDialog
    • objectMovement
    • positionOrientationTransformation
    • settings
    • shortcuts
  • scenesAndModels
    • scenes
    • models
    • modelDialog
  • environment
    • environmentPropertiesDialog
    • textureDialog
  • entities
    • collections
    • objects
      • sceneObjectPropertiesDialog
      • commonPropertiesDialog
    • collidableObjects
    • measurableObjects
    • detectableObjects
    • viewableObjects
    • convexHull
    • layerSelectionDialog
      • cameras
      • cameraPropertiesDialog
      • lights
      • lightPropertiesDialog
      • shapes
      • shapeReferenceFrames
      • primitiveShapes
      • convexDecomposition
      • shapeProperties
      • shapeDynamicsProperties
      • shapeDynamicEngineProperties
      • geometryDialog
      • shapeEditModes
      • triangleEditMode
      • vertexEditMode
      • edgeEditMode
      • groupedShapeEditMode
      • joints
      • jointModes
      • jointProperties
      • jointDynamicsProperties
      • jointDynamicEngineProperties
      • dummies
      • dummyPropertiesDialog
      • graphs
      • graphPropertiesDialog
      • proximitySensors
      • proximitySensorDescription
      • proximitySensorPropertiesDialog
      • proximitySensorVolumeDialog
      • proximitySensorDetectionParameterDialog
      • visionSensors
      • visionSensorDescription
      • visionSensorPropertiesDialog
      • forceSensors
      • forceSensorPropertiesDialog
      • octrees
      • octreePropertiesDialog
      • pointClouds
      • pointCloudPropertiesDialog
    • paths
  • functionality
    • geometricCalculations
    • collisionDetection
    • distanceCalculation
      • geometricPlugin
      • simGeom API
      • coppeliaGeometricRoutines
      • CoppeliaGeometricRoutinesAPI
    • IGLPluginAPIreference
    • kinematics
    • basicsOnIkGroupsAndIkElements
    • solvingIkAndFk
      • kinematicsPlugin
      • simIKAPI
      • coppeliaKinematicsRoutines
      • CoppeliaKinematicsRoutinesAPI
    • dynamicsModule
    • designingDynamicSimulations
      • dynamicsDialog
      • dynamicsEngineDialog
    • dataVisualizationAndOutput
    • externalFrontEnd
    • dataTransformation
    • meansOfCommunication
      • remoteApiOverview
      • zmqRemoteApiOverview
      • wsRemoteApiOverview
      • rosInterfaces
      • rosInterf
      • ROSPluginAPIreference
      • ros2Interface
      • ROS2PluginAPIreference
    • ZMQPluginAPIreference
    • WSPluginAPIreference
    • pathsAndTrajectories
    • pathAndMotionPlanningModules
    • OMPLPluginAPIreference
    • syntheticVision
    • IMPluginAPIreference
    • simVisionAPI
    • customUIPlugin
    • UIPluginAPIreference
    • simUI-widgets
    • QMLPluginAPIreference
    • importExport
    • xmlFormat
      • urdfPlugin
      • APIFunctions
      • sdfPlugin
      • SDFPluginAPIreference
    • aviRecorder
    • AssimpPluginAPIreference
    • GLTFPluginAPIreference
      • commandLine
      • LuaCmdPluginAPIreference
      • miscellaneousFunctionality
      • SurfRecPluginAPIreference
      • ICPPluginAPIreference
      • SubprocessPluginAPIreference
  • writingCode
    • scripts
      • embeddedScripts
      • simulationScripts
      • mainScript
      • childScripts
      • customizationScripts
      • scriptProperties
      • scriptEditor
    • addOns
    • sandboxScript
    • scriptExecution
    • threadedAndNonThreadedCode
      • callbackFunctions
      • dynCallbackFunctions
      • jointCallbackFunctions
      • contactCallbackFunction
      • visionCallbackFunctions
      • triggerCallbackFunctions
      • userConfigCallbackFunctions
    • luaPythonDifferences
    • luaCrashCourse
    • plugins
    • mainClientApplication
    • accessingSceneObjects
    • explicitHandling
    • apisOverview
      • apiFunctions
      • apiConstants
      • objectParameterIDs
  • simulation
    • simulationPropertiesDialog
  • tutorials
    • bubbleRobTutorial
    • buildingAModelTutorial
    • lineFollowingBubbleRobTutorial
    • inverseKinematicsTutorial
    • externalControllerTutorial
    • pluginTutorial
    • robotLanguageIntegrationTutorial
    • rosTutorial
      • ros1Tutorial
      • ros2Tutorial
    • compilingCoppeliaSim
externalFrontEnd << Previous Next >> meansOfCommunication

dataTransformation

Data manipulation/transformation

Data in CoppeliaSim can transformed in various ways:

  • data packing/unpacking
  • linear algebra functionality
  • image processing
  • path data transformation
  • sim.transformBuffer
  • other matrix/transformation related functions
  • Following example illustrates how to pack/unpack data. Other functions can be found here:

    -- Packing/unpacking specific type of data:
    local data={1,2,3}
    local binaryPackedData=sim.packDoubleTable(data) -- binary packing
    data=sim.unpackDoubleTable(binaryPackedData) -- binary unpacking
    
    base16=require('base16')
    local base16PackedData=base16.encode(binaryPackedData) -- base16 encoding
    binaryPackedData=base16.decode(base16PackedData) -- base16 decoding
    
    base64=require('base64')
    local base64PackedData=base64.encode(binaryPackedData) -- base64 encoding
    binaryPackedData=base64.decode(base64PackedData) -- base64 decoding
    
    local base64Buffer=sim.transformBuffer(binaryPackedData,sim.buffer_uint8,1,0,sim.buffer_base64)
    local originalBuffer=sim.transformBuffer(base64Buffer,sim.buffer_base64,1,0,sim.buffer_uint8)
    
    
    -- Packing/unpacking random data:
    local data={1,'hello',{value='world'},{1,{2,3}}}
    local binaryPackedData=sim.packTable(data) -- binary packing
    data=sim.unpackTable(binaryPackedData) -- binary unpacking
    
    cbor=require('cbor')
    local cborPackedData=cbor.encode(data) -- cbor encoding
    data=cbor.decode(cborPackedData) -- cbor decoding
    
    

    More packing/unpacking functions can be found here.


    Following example illustrates usage of the linear algebra functionality:

    -- Get the absolute transformation matrices of an object and its parent:
    local absObj=Matrix4x4:frompose(sim.getObjectPose(objectHandle,-1))
    local absParentObj=Matrix4x4:frompose(sim.getObjectPose(parentHandle,-1))
    
    -- Compute the relative transformation matrix of the object:
    local relObj=Matrix4x4:inv(absParentObj)*absObj
    
    -- Get the relative transformation matrix of the object directly:
    local relObj2=Matrix4x4:frompose(sim.getObjectPose(objectHandle,parentHandle))
    
    -- Check that both matrices are same:
    print(relObj:sub(relObj2):abs():max())

    The documentation for the linear algebra functionality can be found here.




    externalFrontEnd << Previous Next >> meansOfCommunication

    Copyright © All rights reserved | This template is made with by Colorlib