A pure java implementation of actionlib for rosjava.
- Easy developing and testing in any OS (Windows, Linux, Mac) without a ROS installation.
- Compatible and usable with ROS. Tested with ROS Indigo.
- Uses Log4j2 and SL4J
- Smaller public API, with all the needed functionality plus some extras.
- The API favours composition based designs and prevents inheriting the project classes. Where possible classes and methods are marked with the
final
modifier to prevent extension. - Includes separate ActionClientResult, ActionClientStatus and ActionClientFeedbackListener as well a complete ActionClientListener
- ActionClient can accept multiple simultaneous Client listeners of different types, that can also be removed
- The public methods and API includes only required elements. Only needed classes and methods are public.
- Refactored code, grouping together common elements
- The API favours composition based designs and prevents inheriting the project classes. Where possible classes and methods are marked with the
- Robust detection of started ActionServer in waitForActionServerToStart
- Targeted to be used as part of other Java / ROS Java applications via gradle or maven, similar to other java libraries
Other Changes:
ActionClient
only responds to messages for the same GoalId.ActionClient
will cancel aGoalId
after receiving it, to allow the server to remove it from theGoalStatusArray
ActionClient
can call aRunnable
once and only if and when connected to the ActionLib protocol.
- Java 11 or greater (OpenJDK should work).
- For usage with a ROS installation the following packages:
- are needed in runtime:
ros-$ROS_DISTRO-actionlib
ros-$ROS_DISTRO-genjava
- could be helpful for testing/development:
ros-$ROS_DISTRO-actionlib-tutorials
- are needed in runtime:
TODO
The project will be compiled and tested in any OS (Windows, Linux, Mac) without any requirement for a ROS installation. Instructions are provided hereafter for Windows and Linux.
-
Clone the project repository:
git clone https://github.com/SpyrosKou/rosjava_actionlib.git
-
Go into the cloned repository directory:
cd .\rosjava_actionlib\
-
Build the project.
.\gradlew.bat build
-
Running the Unit tests. The tests will run during the build, but the following command can run the tests on demand.
.\gradlew.bat test
-
Clone the project repository:
git clone https://github.com/SpyrosKou/rosjava_actionlib.git
-
Go into the cloned repository directory:
cd rosjava_actionlib/
-
Add execute permission to gradlew script:
sudo chmod +x gradlew
-
Build the project. Tests will be executed automatically.
./gradlew build
-
Running the Unit tests. The tests will run during the build, but the following command can run the tests on demand. ./gradlew test`
- TODO
When an ActionClient invokes a server it returns an ActionFuture.
See an example client at FutureBasedClient .
The FutureBasedClient usage is demonstrated in FutureBasedClientTest.
The test client will connect to the fibonacci server and send it a goal. It should then receive feedback from the server and a final response. The output should look something like this:
Loading node class: com.github.rosjava_actionlib.FibonacciActionLibClient
Waiting for action server to start...
Action server started.
Sending goal...
Sent goal with ID: /fibonacci_test_client-1-1453494018.17000000
Waiting for goal to complete...
Feedback from Fibonacci server: 0 1 1
Feedback from Fibonacci server: 0 1 1 2
Feedback from Fibonacci server: 0 1 1 2 3
Got Fibonacci result sequence: 0 1 1 2 3
Goal completed!
Sending a new goal...
Sent goal with ID: /fibonacci_test_client-2-1453494021.25000000
Cancelling this goal...
Feedback from Fibonacci server: 0 1 1
Got Fibonacci result sequence:
Goal cancelled succesfully.
Bye!
- TODO
The test server will start running and wait for clients to connect and send goal messages. Once the fibonacci client sends a goal, the server accepts it and sends a result. The output should look something like this:
Goal received.
Goal accepted.
Sending result...
You can launch a demo client and a fibonacci action server all at once using:
roslaunch rosjava_actionlib client_demo.launch --screen
You can also launch a demo server and a fibonacci action client all at once using:
roslaunch rosjava_actionlib server_demo.launch --screen
Use Ctrl+C to stop the execution once it's finished.
TODO