ROS2Interface Plugin API reference

This plugin provides an interface with the ROS2 API

simROS2.actionClientTreatUInt8ArrayAsString

Description After calling this function, this action client will treat uint8 arrays as string. Using strings should be in general much faster that using int arrays in Lua.
Lua synopsis simROS2.actionClientTreatUInt8ArrayAsString(int actionClientHandle)
Lua parameters
actionClientHandle (int): the action client handle
Lua return values -
See also simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.actionServerActionAbort

Description Indicate that a goal could not be reached and has been aborted. Only call this if the goal was executing but cannot be completed. This is a terminal state, no more methods should be called on a goal after this is called.
Lua synopsis simROS2.actionServerActionAbort(int actionServerHandle, string goalUUID, table result)
Lua parameters
actionServerHandle (int): the action server handle
goalUUID (string): the goal unique identifier
result (table of ): the result message
Lua return values -
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.actionServerActionCanceled

Description Indicate that a goal has been canceled. Only call this if the goal is executing or pending, but has been canceled. This is a terminal state, no more methods should be called on a goal after this is called.
Lua synopsis simROS2.actionServerActionCanceled(int actionServerHandle, string goalUUID, table result)
Lua parameters
actionServerHandle (int): the action server handle
goalUUID (string): the goal unique identifier
result (table of ): the result message
Lua return values -
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.actionServerActionExecute

Description Indicate that the server is starting to execute a goal. Only call this if the goal is pending.
Lua synopsis simROS2.actionServerActionExecute(int actionServerHandle, string goalUUID)
Lua parameters
actionServerHandle (int): the action server handle
goalUUID (string): the goal unique identifier
Lua return values -
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.actionServerActionIsActive

Description Check if goal is pending or executing
Lua synopsis bool result=simROS2.actionServerActionIsActive(int actionServerHandle, string goalUUID)
Lua parameters
actionServerHandle (int): the action server handle
goalUUID (string): the goal unique identifier
Lua return values
result (bool): false if the goal has reached a terminal state
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.actionServerActionIsCanceling

Description Check if there is a cancel request
Lua synopsis bool result=simROS2.actionServerActionIsCanceling(int actionServerHandle, string goalUUID)
Lua parameters
actionServerHandle (int): the action server handle
goalUUID (string): the goal unique identifier
Lua return values
result (bool): true if a cancelation request has been accepted for this goal
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.actionServerActionIsExecuting

Description Check if the goal is executing
Lua synopsis bool result=simROS2.actionServerActionIsExecuting(int actionServerHandle, string goalUUID)
Lua parameters
actionServerHandle (int): the action server handle
goalUUID (string): the goal unique identifier
Lua return values
result (bool): true if the goal is in an executing state
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.actionServerActionSucceed

Description Indicate that a goal has succeeded. Only call this if the goal is executing and has reached the desired final state. This is a terminal state, no more methods should be called on a goal after this is called.
Lua synopsis simROS2.actionServerActionSucceed(int actionServerHandle, string goalUUID, table result)
Lua parameters
actionServerHandle (int): the action server handle
goalUUID (string): the goal unique identifier
result (table of ): the result message
Lua return values -
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.actionServerPublishFeedback

Description Send an update about the progress of this goal. This must be only called when the goal is executing. If execution of a goal is deferred then must be called first.
Lua synopsis simROS2.actionServerPublishFeedback(int actionServerHandle, string goalUUID, table feedback)
Lua parameters
actionServerHandle (int): the action server handle
goalUUID (string): the goal unique identifier
feedback (table of ): the feedback message
Lua return values -
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.actionServerTreatUInt8ArrayAsString

Description After calling this function, this action server will treat uint8 arrays as string. Using strings should be in general much faster that using int arrays in Lua.
Lua synopsis simROS2.actionServerTreatUInt8ArrayAsString(int actionServerHandle)
Lua parameters
actionServerHandle (int): the action server handle
Lua return values -
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.call

Description Call the service associated with this service client.
Lua synopsis table result=simROS2.call(int clientHandle, table request)
Lua parameters
clientHandle (int): the service client handle
request (table of ): the message to publish
Lua return values
result (table of ): the response message, if the call succeeded
See also simROS2.clientTreatUInt8ArrayAsString simROS2.createClient simROS2.createInterface simROS2.createService simROS2.getInterfaceConstants simROS2.serviceTreatUInt8ArrayAsString simROS2.shutdownClient simROS2.shutdownService simROS2.supportedInterfaces

simROS2.cancelLastGoal

Description Cancel last submitted goal on the specified action client.
Lua synopsis bool success=simROS2.cancelLastGoal(int actionClientHandle)
Lua parameters
actionClientHandle (int): the action client handle
Lua return values
success (bool): false if canceling the goal to the action server has failed
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.clientTreatUInt8ArrayAsString

Description After calling this function, this service client will treat uint8 arrays as string. Using strings should be in general much faster that using int arrays in Lua.
Lua synopsis simROS2.clientTreatUInt8ArrayAsString(int clientHandle)
Lua parameters
clientHandle (int): the service client handle
Lua return values -
See also simROS2.call simROS2.createClient simROS2.createInterface simROS2.createService simROS2.getInterfaceConstants simROS2.serviceTreatUInt8ArrayAsString simROS2.shutdownClient simROS2.shutdownService simROS2.supportedInterfaces

simROS2.createActionClient

Description Create a action client.
Lua synopsis int actionClientHandle=simROS2.createActionClient(string actionName, string actionType, string goalResponseCallback, string feedbackCallback, string resultCallback)
Lua parameters
actionName (string): action name, e.g.: '/fibonacci'
actionType (string): action type, e.g.: 'example_interfaces/action/Fibonacci'
goalResponseCallback (string): the goal response callback, will be called with arguments (goal_id,accepted) where accepted is a boolean value
feedbackCallback (string): the feedback callback, will be called with arguments (goal_id,feedback) where feedback is a table representing the Feedback message of the action type
resultCallback (string): the result callback, will be called with arguments (goal_id,code,result) where code is a value from simROS2.action_result_code, and result is a table representing the Result message of the action type
Lua return values
actionClientHandle (int): a handle to the ROS action client
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.createActionServer

Description Create an action server.
Lua synopsis int actionServerHandle=simROS2.createActionServer(string actionName, string actionType, string handleGoalCallback, string handleCancelCallback, string handleAcceptedCallback)
Lua parameters
actionName (string): action name, e.g.: '/fibonacci'
actionType (string): action type, e.g.: 'example_interfaces/action/Fibonacci'
handleGoalCallback (string): name of callback function, which will be called with arguments (goal_id, goal) where goal is a table representing the Goal message of the action type. the callback must return a valid simROS2.goal_response
handleCancelCallback (string): name of callback function, which will be called with arguments (goal_id, goal) where goal is a table representing the Goal message of the action type. the callback must return a valid simROS2.cancel_response
handleAcceptedCallback (string): name of callback function, which will be called with arguments (goal_id, goal) where goal is a table representing the Goal message of the action type. it will be called after the goal is accepted, and is responsible of executing the goal, but must return immediately.
Lua return values
actionServerHandle (int): a handle to the action server
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.createClient

Description Create a service client.
Lua synopsis int clientHandle=simROS2.createClient(string serviceName, string serviceType)
Lua parameters
serviceName (string): service name, e.g.: '/trigger'
serviceType (string): service type, e.g.: 'std_srvs/srv/Trigger'
Lua return values
clientHandle (int): a handle to the ROS service client
See also simROS2.call simROS2.clientTreatUInt8ArrayAsString simROS2.createInterface simROS2.createService simROS2.getInterfaceConstants simROS2.serviceTreatUInt8ArrayAsString simROS2.shutdownClient simROS2.shutdownService simROS2.supportedInterfaces

simROS2.createInterface

Description Construct an interface of the specified type, initialized with the default values.
Lua synopsis table result=simROS2.createInterface(string type)
Lua parameters
type (string): type, e.g.: 'geometry_msgs/msg/Twist'
Lua return values
result (table of ): the interface object
See also simROS2.createPublisher simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces simROS2.call simROS2.clientTreatUInt8ArrayAsString simROS2.createClient simROS2.createService simROS2.getInterfaceConstants simROS2.serviceTreatUInt8ArrayAsString simROS2.shutdownClient simROS2.shutdownService simROS2.supportedInterfaces simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.createPublisher

Description Create a topic publisher.
Lua synopsis int publisherHandle=simROS2.createPublisher(string topicName, string topicType, int queueSize=1, bool latch=false)
Lua parameters
topicName (string): topic name, e.g.: '/cmd_vel'
topicType (string): topic type, e.g.: 'geometry_msgs/msg/Twist'
queueSize (int, default: 1): (optional) queue size
latch (bool, default: false): (optional) latch topic
Lua return values
publisherHandle (int): a handle to the ROS publisher
See also simROS2.createInterface simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces

simROS2.createService

Description Create a service.
Lua synopsis int serviceHandle=simROS2.createService(string serviceName, string serviceType, string serviceCallback)
Lua parameters
serviceName (string): service name, e.g.: '/trigger'
serviceType (string): service type, e.g.: 'std_srvs/srv/Trigger'
serviceCallback (string): name of the callback function, which will be called with a single argument of type table containing the service request payload; it must return another table containing the response
Lua return values
serviceHandle (int): a handle to the ROS service
See also simROS2.call simROS2.clientTreatUInt8ArrayAsString simROS2.createClient simROS2.createInterface simROS2.getInterfaceConstants simROS2.serviceTreatUInt8ArrayAsString simROS2.shutdownClient simROS2.shutdownService simROS2.supportedInterfaces

simROS2.createSubscription

Description Create a subscription to a topic.
Lua synopsis int subscriptionHandle=simROS2.createSubscription(string topicName, string topicType, string topicCallback, int queueSize=1)
Lua parameters
topicName (string): topic name, e.g.: '/cmd_vel'
topicType (string): topic type, e.g.: 'geometry_msgs/msg/Twist'
topicCallback (string): name of the callback function, which will be called with a single argument of type table containing the message payload, e.g.: {linear={x=1.5, y=0.0, z=0.0}, angular={x=0.0, y=0.0, z=-2.3}}
queueSize (int, default: 1): (optional) queue size
Lua return values
subscriptionHandle (int): a handle to the ROS subscription
See also simROS2.createInterface simROS2.createPublisher simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces

simROS2.deleteParam

Description Delete a parameter in the ROS Parameter Server.
Lua synopsis simROS2.deleteParam(string name)
Lua parameters
name (string): name of the parameter
Lua return values -
See also simROS2.getParamBool simROS2.getParamDouble simROS2.getParamInt simROS2.getParamString simROS2.hasParam simROS2.searchParam simROS2.setParamBool simROS2.setParamDouble simROS2.setParamInt simROS2.setParamString

simROS2.getInterfaceConstants

Description Get an object with the constants defined in the specified interface.
Lua synopsis table result=simROS2.getInterfaceConstants(string type)
Lua parameters
type (string): type, e.g.: 'geometry_msgs/msg/Twist'
Lua return values
result (table of ): the constants object
See also simROS2.createInterface simROS2.createPublisher simROS2.createSubscription simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces simROS2.call simROS2.clientTreatUInt8ArrayAsString simROS2.createClient simROS2.createInterface simROS2.createService simROS2.serviceTreatUInt8ArrayAsString simROS2.shutdownClient simROS2.shutdownService simROS2.supportedInterfaces simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.getParamBool

Description Retrieve a boolean parameter from the ROS Parameter Server.
Lua synopsis bool exists, bool value=simROS2.getParamBool(string name, bool defaultValue=false)
Lua parameters
name (string): name of the parameter
defaultValue (bool, default: false): default value returned when parameter does not exist
Lua return values
exists (bool): true if the param exists otherwise false
value (bool): the value of the requested parameter
See also simROS2.deleteParam simROS2.getParamDouble simROS2.getParamInt simROS2.getParamString simROS2.hasParam simROS2.searchParam simROS2.setParamBool simROS2.setParamDouble simROS2.setParamInt simROS2.setParamString

simROS2.getParamDouble

Description Retrieve a double parameter from the ROS Parameter Server.
Lua synopsis bool exists, double value=simROS2.getParamDouble(string name, double defaultValue=0.0)
Lua parameters
name (string): name of the parameter
defaultValue (double, default: 0.0): default value returned when parameter does not exist
Lua return values
exists (bool): true if the param exists otherwise false
value (double): the value of the requested parameter
See also simROS2.deleteParam simROS2.getParamBool simROS2.getParamInt simROS2.getParamString simROS2.hasParam simROS2.searchParam simROS2.setParamBool simROS2.setParamDouble simROS2.setParamInt simROS2.setParamString

simROS2.getParamInt

Description Retrieve an integer parameter from the ROS Parameter Server.
Lua synopsis bool exists, int value=simROS2.getParamInt(string name, int defaultValue=0)
Lua parameters
name (string): name of the parameter
defaultValue (int, default: 0): default value returned when parameter does not exist
Lua return values
exists (bool): true if the param exists otherwise false
value (int): the value of the requested parameter
See also simROS2.deleteParam simROS2.getParamBool simROS2.getParamDouble simROS2.getParamString simROS2.hasParam simROS2.searchParam simROS2.setParamBool simROS2.setParamDouble simROS2.setParamInt simROS2.setParamString

simROS2.getParamString

Description Retrieve a string parameter from the ROS Parameter Server.
Lua synopsis bool exists, string value=simROS2.getParamString(string name, string defaultValue=)
Lua parameters
name (string): name of the parameter
defaultValue (string, default: ): default value returned when parameter does not exist
Lua return values
exists (bool): true if the param exists otherwise false
value (string): the value of the requested parameter
See also simROS2.deleteParam simROS2.getParamBool simROS2.getParamDouble simROS2.getParamInt simROS2.hasParam simROS2.searchParam simROS2.setParamBool simROS2.setParamDouble simROS2.setParamInt simROS2.setParamString

simROS2.getTime

Description Return the current time according to the specified clock.
Lua synopsis sim_ros2_time time=simROS2.getTime(int clock_type=sim_ros2_clock_ros)
Lua parameters
clock_type (int, default: sim_ros2_clock_ros): type of clock. see simROS2.clock_type.
Lua return values
time (sim_ros2_time): ROS time
See also

simROS2.hasParam

Description Check wether a parameter exists in the ROS Parameter Server.
Lua synopsis bool exists=simROS2.hasParam(string name)
Lua parameters
name (string): name of the parameter
Lua return values
exists (bool): true if the parameter exists, false otherwise
See also simROS2.deleteParam simROS2.getParamBool simROS2.getParamDouble simROS2.getParamInt simROS2.getParamString simROS2.searchParam simROS2.setParamBool simROS2.setParamDouble simROS2.setParamInt simROS2.setParamString

simROS2.imageTransportCreatePublisher

Description Create a publisher using ImageTransport.
Lua synopsis int publisherHandle=simROS2.imageTransportCreatePublisher(string topicName, int queueSize=1)
Lua parameters
topicName (string): topic name, e.g.: '/cmd_vel'
queueSize (int, default: 1): (optional) queue size
Lua return values
publisherHandle (int): a handle to the ROS publisher
See also simROS2.createInterface simROS2.createPublisher simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription

simROS2.imageTransportCreateSubscription

Description Create a subscription using ImageTransport.
Lua synopsis int subscriptionHandle=simROS2.imageTransportCreateSubscription(string topicName, string topicCallback, int queueSize=1)
Lua parameters
topicName (string): topic name, e.g.: '/cmd_vel'
topicCallback (string): name of the callback function, which will be called as: topicCallback(string data, number width, number height)
queueSize (int, default: 1): (optional) queue size
Lua return values
subscriptionHandle (int): a handle to the ROS subscription
See also simROS2.createInterface simROS2.createPublisher simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces simROS2.imageTransportCreatePublisher simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription

simROS2.imageTransportPublish

Description Publish a message on the topic associated with this publisher using ImageTransport.
Lua synopsis simROS2.imageTransportPublish(int publisherHandle, string data, int width, int height, string frame_id)
Lua parameters
publisherHandle (int): the publisher handle
data (string): the image data
width (int): image width
height (int): image height
frame_id (string): frame id
Lua return values -
See also simROS2.createInterface simROS2.createPublisher simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription

simROS2.imageTransportShutdownPublisher

Description Shutdown the publisher using ImageTransport.
Lua synopsis simROS2.imageTransportShutdownPublisher(int publisherHandle)
Lua parameters
publisherHandle (int): the publisher handle
Lua return values -
See also simROS2.createInterface simROS2.createPublisher simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownSubscription

simROS2.imageTransportShutdownSubscription

Description Shutdown the subscription using ImageTransport.
Lua synopsis simROS2.imageTransportShutdownSubscription(int subscriptionHandle)
Lua parameters
subscriptionHandle (int): the subscription handle
Lua return values -
See also simROS2.createInterface simROS2.createPublisher simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher

simROS2.publish

Description Publish a message on the topic associated with this publisher.
Lua synopsis simROS2.publish(int publisherHandle, table message)
Lua parameters
publisherHandle (int): the publisher handle
message (table of ): the message to publish
Lua return values -
See also simROS2.createInterface simROS2.createPublisher simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces

simROS2.publisherTreatUInt8ArrayAsString

Description After calling this function, this publisher will treat uint8 arrays as string. Using strings should be in general much faster that using int arrays in Lua.
Lua synopsis simROS2.publisherTreatUInt8ArrayAsString(int publisherHandle)
Lua parameters
publisherHandle (int): the publisher handle
Lua return values -
See also simROS2.createInterface simROS2.createPublisher simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces

simROS2.searchParam

Description Search a parameter in the ROS Parameter Server, looking in the closest namespace.
Lua synopsis bool found, string name=simROS2.searchParam(string name)
Lua parameters
name (string): name of the parameter
Lua return values
found (bool): true if the parameter has been found
name (string): name of the parameter which has been found
See also simROS2.deleteParam simROS2.getParamBool simROS2.getParamDouble simROS2.getParamInt simROS2.getParamString simROS2.hasParam simROS2.setParamBool simROS2.setParamDouble simROS2.setParamInt simROS2.setParamString

simROS2.sendGoal

Description Send a goal using the specified action client.
Lua synopsis bool success=simROS2.sendGoal(int actionClientHandle, table goal)
Lua parameters
actionClientHandle (int): the action client handle
goal (table of ): the goal to send
Lua return values
success (bool): false if sending the goal to the action server has failed
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.shutdownActionClient simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.sendTransform

Description Publish a TF transformation between frames.
Lua synopsis simROS2.sendTransform(table transform)
Lua parameters
transform (table of ): the transformation expressed as a geometry_msgs/TransformStamped message, i.e. {header={stamp=timeStamp, frame_id='...'}, child_frame_id='...', transform={translation={x=..., y=..., z=...}, rotation={x=..., y=..., z=..., w=...}}}
Lua return values -
See also simROS2.createInterface simROS2.createPublisher simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransforms simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces simROS2.sendTransforms

simROS2.sendTransforms

Description Publish several TF transformations between frames.
Lua synopsis simROS2.sendTransforms(table transforms)
Lua parameters
transforms (table of ): an array of geometry_msgs/TransformStamped messages
Lua return values -
See also simROS2.createInterface simROS2.createPublisher simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces simROS2.sendTransform

simROS2.serviceTreatUInt8ArrayAsString

Description After calling this function, this service will treat uint8 arrays as string. Using strings should be in general much faster that using int arrays in Lua.
Lua synopsis simROS2.serviceTreatUInt8ArrayAsString(int serviceHandle)
Lua parameters
serviceHandle (int): the service handle
Lua return values -
See also simROS2.call simROS2.clientTreatUInt8ArrayAsString simROS2.createClient simROS2.createInterface simROS2.createService simROS2.getInterfaceConstants simROS2.shutdownClient simROS2.shutdownService simROS2.supportedInterfaces

simROS2.setParamBool

Description Set a boolean parameter in the ROS Parameter Server.
Lua synopsis simROS2.setParamBool(string name, bool value)
Lua parameters
name (string): name of the parameter
value (bool): value of the parameter
Lua return values -
See also simROS2.deleteParam simROS2.getParamBool simROS2.getParamDouble simROS2.getParamInt simROS2.getParamString simROS2.hasParam simROS2.searchParam simROS2.setParamDouble simROS2.setParamInt simROS2.setParamString

simROS2.setParamDouble

Description Set a double parameter in the ROS Parameter Server.
Lua synopsis simROS2.setParamDouble(string name, double value)
Lua parameters
name (string): name of the parameter
value (double): value of the parameter
Lua return values -
See also simROS2.deleteParam simROS2.getParamBool simROS2.getParamDouble simROS2.getParamInt simROS2.getParamString simROS2.hasParam simROS2.searchParam simROS2.setParamBool simROS2.setParamInt simROS2.setParamString

simROS2.setParamInt

Description Set a integer parameter in the ROS Parameter Server.
Lua synopsis simROS2.setParamInt(string name, int value)
Lua parameters
name (string): name of the parameter
value (int): value of the parameter
Lua return values -
See also simROS2.deleteParam simROS2.getParamBool simROS2.getParamDouble simROS2.getParamInt simROS2.getParamString simROS2.hasParam simROS2.searchParam simROS2.setParamBool simROS2.setParamDouble simROS2.setParamString

simROS2.setParamString

Description Set a string parameter in the ROS Parameter Server.
Lua synopsis simROS2.setParamString(string name, string value)
Lua parameters
name (string): name of the parameter
value (string): value of the parameter
Lua return values -
See also simROS2.deleteParam simROS2.getParamBool simROS2.getParamDouble simROS2.getParamInt simROS2.getParamString simROS2.hasParam simROS2.searchParam simROS2.setParamBool simROS2.setParamDouble simROS2.setParamInt

simROS2.shutdownActionClient

Description Shutdown the action client.
Lua synopsis simROS2.shutdownActionClient(int actionClientHandle)
Lua parameters
actionClientHandle (int): the action client handle
Lua return values -
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionServer simROS2.supportedInterfaces

simROS2.shutdownActionServer

Description Shutdown the action server.
Lua synopsis simROS2.shutdownActionServer(int actionServerHandle)
Lua parameters
actionServerHandle (int): the action server handle
Lua return values -
See also simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.supportedInterfaces

simROS2.shutdownClient

Description Shutdown the service client.
Lua synopsis simROS2.shutdownClient(int clientHandle)
Lua parameters
clientHandle (int): the service client handle
Lua return values -
See also simROS2.call simROS2.clientTreatUInt8ArrayAsString simROS2.createClient simROS2.createInterface simROS2.createService simROS2.getInterfaceConstants simROS2.serviceTreatUInt8ArrayAsString simROS2.shutdownService simROS2.supportedInterfaces

simROS2.shutdownPublisher

Description Shutdown the specified publisher.
Lua synopsis simROS2.shutdownPublisher(int publisherHandle)
Lua parameters
publisherHandle (int): the publisher handle
Lua return values -
See also simROS2.createInterface simROS2.createPublisher simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces

simROS2.shutdownService

Description Shutdown the service.
Lua synopsis simROS2.shutdownService(int serviceHandle)
Lua parameters
serviceHandle (int): the service handle
Lua return values -
See also simROS2.call simROS2.clientTreatUInt8ArrayAsString simROS2.createClient simROS2.createInterface simROS2.createService simROS2.getInterfaceConstants simROS2.serviceTreatUInt8ArrayAsString simROS2.shutdownClient simROS2.supportedInterfaces

simROS2.shutdownSubscription

Description Shutdown the subscription.
Lua synopsis simROS2.shutdownSubscription(int subscriptionHandle)
Lua parameters
subscriptionHandle (int): the subscription handle
Lua return values -
See also simROS2.createInterface simROS2.createPublisher simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownPublisher simROS2.subscriptionTreatUInt8ArrayAsString simROS2.supportedInterfaces

simROS2.subscriptionTreatUInt8ArrayAsString

Description After calling this function, this subscription will treat uint8 arrays as string. Using strings should be in general much faster that using int arrays in Lua.
Lua synopsis simROS2.subscriptionTreatUInt8ArrayAsString(int subscriptionHandle)
Lua parameters
subscriptionHandle (int): the subscription handle
Lua return values -
See also simROS2.createInterface simROS2.createPublisher simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.supportedInterfaces

simROS2.supportedInterfaces

Description Retrieve a list of supported interfaces.
Lua synopsis table result=simROS2.supportedInterfaces()
Lua parameters -
Lua return values
result (table of string): the list of supported interfaces
See also simROS2.createInterface simROS2.createPublisher simROS2.createSubscription simROS2.getInterfaceConstants simROS2.imageTransportCreatePublisher simROS2.imageTransportCreateSubscription simROS2.imageTransportPublish simROS2.imageTransportShutdownPublisher simROS2.imageTransportShutdownSubscription simROS2.publish simROS2.publisherTreatUInt8ArrayAsString simROS2.sendTransform simROS2.sendTransforms simROS2.shutdownPublisher simROS2.shutdownSubscription simROS2.subscriptionTreatUInt8ArrayAsString simROS2.call simROS2.clientTreatUInt8ArrayAsString simROS2.createClient simROS2.createInterface simROS2.createService simROS2.getInterfaceConstants simROS2.serviceTreatUInt8ArrayAsString simROS2.shutdownClient simROS2.shutdownService simROS2.actionClientTreatUInt8ArrayAsString simROS2.actionServerActionAbort simROS2.actionServerActionCanceled simROS2.actionServerActionExecute simROS2.actionServerActionIsActive simROS2.actionServerActionIsCanceling simROS2.actionServerActionIsExecuting simROS2.actionServerActionSucceed simROS2.actionServerPublishFeedback simROS2.actionServerTreatUInt8ArrayAsString simROS2.cancelLastGoal simROS2.createActionClient simROS2.createActionServer simROS2.createInterface simROS2.getInterfaceConstants simROS2.sendGoal simROS2.shutdownActionClient simROS2.shutdownActionServer



Constants

Constants used in the various functions. Refer to each constant using enumName.constantName, i.e. simUI.curve_type.xy for xy constant in simUI.curve_type enum.

simROS2.clock_type

ros
system
steady

simROS2.action_result_code

succeeded
aborted
canceled
unknown

simROS2.goal_response

reject
accept_and_execute
accept_and_defer

simROS2.cancel_response

reject
accept


Data structures

Data structures are used to pass complex data around. Create data structures in Lua in the form of a hash table, e.g.: {line_size=3, add_to_legend=false, selectable=true}

sim_ros2_time

Description Time data structure, equivalent of builtin_interfaces/Time
Fields
sec (int): seconds
nanosec (int): nanoseconds
See also



Script functions

Script functions are used to call some lua code from the plugin side (tipically used for event handlers).

subscriptionCallback

Description Callback for ROS subscription.
Lua synopsis simROS2.subscriptionCallback(table message)
Lua parameters
message (table of ): the topic payload (i.e. the message)
Lua return values -
See also

imageTransportCallback

Description Callback for ROS ImageTransport subscription.
Lua synopsis simROS2.imageTransportCallback(string data, int width, int height)
Lua parameters
data (string): the image data
width (int): image width
height (int): image height
Lua return values -
See also

actionGoalResponseCallback

Description Callback for action client goal response.
Lua synopsis simROS2.actionGoalResponseCallback(string goalID, bool accepted)
Lua parameters
goalID (string): the goal id
accepted (bool): true if the goal was accepted by the action server
Lua return values -
See also