ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to send a complex request and save a complex response (service) in ROS?

asked 2017-05-24 13:50:58 -0500

mdcr gravatar image

updated 2017-11-15 09:12:56 -0500

jayess gravatar image

Hi I don´t have a high level in ROS so I would request your help. Last weeks I was trying to make a client for testing that package https://github.com/sniekum/dmp Alwais I had problems running it (the client) so I decided to run it by CMD

I used this commands to send the request to one of the service´s package:

rosservice call /learn_dmp_from_demo "{'demo': {'points': [{'positions': [1.05], 'velocities': [0]}, {'positions': [4.05], 'velocities': [0]}, {'positions': [6.05], 'velocities': [0]}, {'positions': [4.05], 'velocities': [0]}, {'positions': [6.55], 'velocities': [0]}, {'positions': [6.05], 'velocities': [0]}, {'positions': [5.05], 'velocities': [0]}, {'positions': [2.05], 'velocities': [0]}], 'times': [0, 0.15, 0.65, 1.3, 2.32, 3.5, 4.8, 5.9, 7]}, 'd_gains': [0.5], 'k_gains': [1.5], 'num_bases': 50}"

I got this response:

dmp_list: 
  - 
    k_gain: 1.5
    d_gain: 0.5
    weights: []
    f_domain: [0.0, 0.02542372881355932, 0.11016949152542373, 0.22033898305084745, 0.3932203389830508, 0.5932203389830508, 0.8135593220338982, 1.0]
    f_targets: [0.0, 3526.023021050232, -1212.684557129261, -707.1580492824511, 827.153942036789, -818.845524643713, -197.3391387004624, -4666.23882178427]
tau: 7.0

So It was succesfull. The question is, How can I send the request without command line? and store the response in a YAML file for using it later? I was reading about Ros Param Server and bag files and store YAML files, but I´m a little bit lost with it

Thanks a lot

edit retag flag offensive close merge delete

Comments

Writing a node which has the service client for learn_dmp_from_demo is the right direction. Maybe you can share what problem you were having when writing this service client.

DavidN gravatar image DavidN  ( 2017-05-27 06:04:50 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2017-11-15 08:08:44 -0500

Hi @mdcr!

To call a service without command line, I recommend you to go tough the Writing a Simple Service and Client (Python) tutorial.

If you prefer C++, there is a tutorial for that also.

This link will help you save the data in YAML format using Python.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2017-05-24 13:50:58 -0500

Seen: 1,003 times

Last updated: Nov 15 '17