ROS2Interface Plugin API reference
This plugin provides an interface with the ROS2 API
simROS2.actionClientTreatUInt8ArrayAsString
simROS2.actionServerActionAbort
simROS2.actionServerActionCanceled
simROS2.actionServerActionExecute
simROS2.actionServerActionIsActive
simROS2.actionServerActionIsCanceling
simROS2.actionServerActionIsExecuting
simROS2.actionServerActionSucceed
simROS2.actionServerPublishFeedback
simROS2.actionServerTreatUInt8ArrayAsString
simROS2.call
simROS2.cancelLastGoal
simROS2.clientTreatUInt8ArrayAsString
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
simROS2.createInterface
simROS2.createPublisher
simROS2.createService
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
simROS2.getInterfaceConstants
simROS2.getParamBool
simROS2.getParamDouble
simROS2.getParamInt
simROS2.getParamString
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 |
|
| Lua return values |
time (sim_ros2_time): ROS time |
|
See also
|
|
simROS2.hasParam
simROS2.imageTransportCreatePublisher
simROS2.imageTransportCreateSubscription
simROS2.imageTransportPublish
simROS2.imageTransportShutdownPublisher
simROS2.imageTransportShutdownSubscription
simROS2.publish
simROS2.publisherTreatUInt8ArrayAsString
simROS2.searchParam
simROS2.sendGoal
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
simROS2.serviceTreatUInt8ArrayAsString
simROS2.setParamBool
simROS2.setParamDouble
simROS2.setParamInt
simROS2.setParamString
simROS2.shutdownActionClient
simROS2.shutdownActionServer
simROS2.shutdownClient
simROS2.shutdownPublisher
simROS2.shutdownService
simROS2.shutdownSubscription
simROS2.subscriptionTreatUInt8ArrayAsString
simROS2.supportedInterfaces
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
simROS2.action_result_code
|
succeeded
aborted
canceled
unknown
|
simROS2.goal_response
|
reject
accept_and_execute
accept_and_defer
|
simROS2.cancel_response
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
|
|
|