Main Content

サービスとアクション

サービスとアクションに関する要求の送信、タスクの実行およびフィードバックの取得

ROS のサービスとアクションにより、ユーザーはタスクを実行できます。サービスでは、要求と応答の通信を使用して情報を収集し、ROS ネットワークでコールバック関数をトリガーします。アクションを使用すると、タスクやゴールをトリガーし、これらのタスクの操作中にフィードバックを受信できます。

関数

すべて展開する

rosactionRetrieve information about ROS actions
rosactionclientCreate ROS action client
cancelAllGoalsCancel all goals on action server
cancelGoalCancel last goal sent by client
sendGoalSend goal message to action server
sendGoalAndWaitSend goal message and wait for result
waitForServerWait for action server to start
callCall the ROS service server and receive a response
rosserviceRetrieve information about services in ROS network
rossvcclientConnect to ROS service server
rossvcserverCreate ROS service server

ブロック

Call ServiceCall service in ROS network

トピック

Call and Provide ROS Services

ROS supports two main communication mechanisms: topics and services. Topics have publishers and subscribers and are used for sending and receiving messages (see ROS のパブリッシャーおよびサブスクライバーとのデータ交換). Services, on the other hand, implement a tighter coupling by allowing request-response communication. A service client sends a request message to a service server and waits for a response. The server will use the data in the request to construct a response message and sends it back to the client. Each service has a type that determines the structure of the request and response messages. Services also have a name that is unique in the ROS network.

ROS Actions Overview

ROS action workflow and communication protocols

Move a Turtlebot Robot Using ROS Actions

This example shows how to use the /turtlebot_move action with a Turtlebot robot. The /turtlebot_move action takes a location in the robot environment and attempts to move the robot to that location.