rosservice call not implemented

3 ビュー (過去 30 日間)
Luca Spanò Cuomo
Luca Spanò Cuomo 2019 年 8 月 5 日
コメント済み: Cam Salzberger 2020 年 1 月 2 日
Hi everyone. I am trying to use Matlab with MavRos inorder to command a drone in Gazebo. The drone is equipped with a virtual Pixhawk oard running PX4. I can retrieve information aout some sensors. My problem is I cannot call the rosservices. Matlab has Rosservice function. It implements 'list', info', 'type' and 'url' but not 'call', the most important to me. Can I bypass the problem? Thanks

回答 (1 件)

Cam Salzberger
Cam Salzberger 2019 年 8 月 7 日
Hello Luca,
The rosservice function is designed to give introspection information from the network about available services. For actual setting up of service clients and servers, you can use the rossvcclient and rossvcserver functionality. See here for a comprehensive example.
-Cam
  2 件のコメント
Mub
Mub 2019 年 12 月 27 日
Hi,
The docs don't mention how to call a service, they just mention the following:
  • Create a service server
  • Create a service client
For example a service that already exist is called /mavros/cmd/arming
What I normally do is
  • rospy.wait_for_service('/mavros/cmd/arming')
  • armService = rospy.ServiceProxy('/mavros/cmd/arming', mavros_msgs.srv.CommandBool)
  • armService(True)
Any idea on how to do it in MATLAB?
Cam Salzberger
Cam Salzberger 2020 年 1 月 2 日
See the last link I provide in my answer, when they call the "call" function. This is what performs the actual service call. In MATLAB, the call to services is synchronous, so there is no need to "wait for" it to complete.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeNetwork Connection and Exploration についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by