ROS Action Command Line Tool: Accessing Fibonacci Sequence Node with Ease
ROS provides a command line tool called rosrun
that allows users to run nodes in their ROS system. In this blog post, we will discuss how to access a created Fibonacci ROS action code via the ROS action command line tool.
Read the previous blog post on "creating ROS action server and client node" where we have created a ROS action server for Fibonacci sequence generation and saved the code as a package named action
in the catkin_ws
workspace.
To access the Fibonacci ROS action code via the ROS action command line tool, we need to perform the following steps:
Step 1: Build the ROS package
cd catkin_ws
catkin_make
Step 2: Launch the ROS master
roscore
Step 3: Start the Fibonacci action server
rosrun action fibonacci_server.py
Now that the Fibonacci action server is running, we can use the ROS action command line tool to send goals to the server and receive the results.
Step 4: Send a goal to the action server
rostopic pub /fibonacci/goal fibonacci_msgs/FibonacciActionGoal "{header: {seq: 0, stamp: now, frame_id: ''}, goal_id: {stamp: now, id: 'fibonacci'}, goal: {order: 10}}" --once
This command publishes a goal message to the /fibonacci/goal
topic with an order of 10. The --once
flag is used to publish the message only once.
Step 5: Monitor the status of the goal
rostopic echo /fibonacci/status
Step 6: Check the result of the goal
rostopic echo /fibonacci/result
This command displays the result of the goal, which should be the generated Fibonacci sequence.
Using the ROS action command line tool allows us to quickly test and interact with ROS action servers without having to write custom client code. This is especially useful for testing and debugging during the development phase of a ROS project.
In conclusion, accessing the created Fibonacci sequence in ROS action node via the ROS action command line tool is a simple process that involves launching the action server and using the rostopic
command to send goals and monitor the status and results of the action. With this knowledge, developers can efficiently develop and test ROS action servers without the need for complex client code.