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
wsRemoteApiOverview << Previous Next >> rosInterf

rosInterfaces

ROS Interfaces

There are several ROS interfaces available for CoppeliaSim. Each one offers a specific behaviour, feature, or a way to operate:

  • The ROS Interface: the ROS Interface duplicates the C++ ROS API with a good fidelity. This makes it the ideal choice for very flexible communication via ROS, but might require a little bit more insight on the various messages and the way ROS operates.
  • The ROS 2 Interface: the ROS 2 Interface duplicates the C++ ROS 2 API with a good fidelity. This makes it the ideal choice for very flexible communication via ROS 2, but might require a little bit more insight on the various messages and the way ROS 2 operates.
  • ROS interfaces developed by others: those are not directly supported by us. For instance, the CoppeliaSim ROS bridge.
  • All ROS interfaces can normally operate side-by-side, but we highly recommend you to first try your hands on the ROS Interface, since this is the most flexible and natural approach. The packages to the first two above listed ROS interfaces are located here and here. Use the catkin tools to build those packages, otherwise you might run into difficulties.

    As an example, a vision sensor ROS2 publisher could look like:

    function sysCall_init()
        visionSensor=sim.getObject('/Vision_sensor')
    
        -- Enable an image publisher:
        pub=simROS2.createPublisher('/image', 'sensor_msgs/msg/Image')
        simROS2.publisherTreatUInt8ArrayAsString(pub)
    end
    
    function sysCall_sensing()
        -- Publish the image of the vision sensor:
        local img,resolution=sim.getVisionSensorImg(visionSensor)
        data={}
        data.header={stamp=simROS2.getTime(), frame_id='a'}
        data.height=resolution[2]
        data.width=resolution[1]
        data.encoding='rgb8'
        data.is_bigendian=1
        data.step=resolution[1]*3
        data.data=img
        simROS2.publish(pub,data)
    end
    
    function sysCall_cleanup()
        simROS2.shutdownPublisher(pub)
    end

    The subscriber on the other hand could look like:

    function sysCall_init()
        -- Enable an image subscriber:
        sub=simROS2.createSubscription('/image', 'sensor_msgs/msg/Image', 'image_callback')
        simROS2.subscriptionTreatUInt8ArrayAsString(sub)
    end
    
    function image_callback(msg)
        -- Here we have received an image
    end
    
    function sysCall_cleanup()
        simROS2.shutdownSubscription(sub)
    end

    Also have a look at the ROS tutorial and the external controller tutorial.




    wsRemoteApiOverview << Previous Next >> rosInterf

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