This repo implements a Tensorflow 2 integration in ROS. Explanations are given in the following blog post.
This repo contains two ROS packages:
ros_tensorflow
ros_tensorflow_msgs
- Install the dependencies:
pip3 install -r requirements.txt
- Clone this repo to your catkin workspace
- Build the workspace:
catkin_make
- Run the node:
rosrun ros_tensorflow node.py
- Predictions are performed at regular time interval in a loop
- Train the Tensorflow model (use tab completion):
rostopic pub /train/goal ros_tensorflow_msgs/TrainActionGoal "header:
seq: 0
stamp:
secs: 0
nsecs: 0
frame_id: ''
goal_id:
stamp:
secs: 0
nsecs: 0
id: ''
goal:
epochs: 10"
- Abort training (use tab completion):
rostopic pub /train/cancel actionlib_msgs/GoalID "stamp:
secs: 0
nsecs: 0
id: ''"
- Run predicitons from a service call (use tab completion):
rosservice call /predict "data: [0.,0.,0.,0.,0.,0.,0.,0.,0.,0.]"