Objectives

In this assignment, you will create one ROS node that interacts with a ROS service and a ROS action server. This will allow you to compare the difference between ROS services and actions. Both provided packages (see below) calculate the Fibonacci sequence to a desired order. Your node should:

  • Setup a proxy connected to the service provided by the example_service package in the course folder (see below)
  • Setup a client connected to the action provided by the example_action_server package in the course folder (see below)
  • In the same node, request the following Fibonacci sequence from BOTH the service and the action (so 4 total requests):
    • Order 3 (three elements long)
    • Order 15 (15 elements long)
  • Record the time it takes to:
    • Return from the request to calculate the sequence
    • Receive the answer

Also create a launch file that starts:

  • Your node
  • The example service
  • The example action server
  • rqt_console (if you output results to the console, adjust as needed for other output methods)

Finally, update the HW10 launcher script.

Given ROS Packages

ROS Service

Included in the course folder in your repository is the example_service package. This package contains a node, example_service_node.py, a custom service type, Fibonacci.srv, and a launch file, fibonacci.launch. You can start the service using the launch file.

Once you start the service you can see it advertised using:

$ rosservice list

Find details about the service using:

$ rosservice info <service_name>

Learn about the service type (given by the above command) using:

$ rossrv show <package>/<srv>

Call the service using:

$ rosservice call <service_name> <number>

It should return the Fibonacci sequence to the length of the number you provide.

ROS Action

Also included in the course folder in your repository is the example_action_server package. This package contains two nodes:

  • example_action_server_node.py provides the action server you communicate with in this assignment.
  • example_client.py provides a command-line interface to experiment with this action server. Note you will have to create your own client in your node. After starting the action server, you can run this node using
    $ rosrun example_action_server example_client.py

    It will display the 10 element Fibonacci sequence. You can change the number of elements by editing the file at line 26.

The package also contains a launch file that can be used to start the action server and the action type used by the server.

Tips

  • Using loginfo or similar to send a message to rqt_console will display a timestamp that can be used to measure the timing required for this assignment.
  • ROS also provides a library for getting and measuring time http://wiki.ros.org/rospy/Overview/Time
  • For this assignment, the entire node can be run in the main function of your Python script if you desire.
  • Experiment with the command line tools first, then write your node.

Submission Instructions

Complete the Qualtrics survey with:

  1. Your git information (4 points)
    1. Your repo URL
    2. The tag that corresponds to this submission
  2. The names of the package and node you created (2 point)
  3. The exact command that starts your submission (2 point)
  4. How long did it take to receive the result from example_service for each input you gave? (2 points)
  5. How long did it take to receive the result from the example_action_server for each input you gave? What was the time difference between sending the goal and running the next line of code? (4 points)
  6. In general, what sorts of requests would you make with a service versus with an action? (6 points)

Rubric

20 points: Answers to above questions
4 points: Launcher script updated
8 points: Service proxy and call
8 points Action client component