This PR contains changes to solve errors when running turtlebot3_dqn on ROS2 Foxy.
Ubuntu Focal, on which ROS2 Foxy is supported, uses Tensorflow2.0 or above. When running dqn_agent on ROS2 Foxy, I experienced the following error: AttributeError: module 'keras.utils.generic_utils' has no attribute 'populate_dict_with_module_objects'
Apparently, the Keras package has a compatibility problem as reported here: https://github.com/keras-team/keras/issues/14632 In their discussion, it was suggested to use the Keras submodule of Tensorflow2.X instead of the separate Keras package. This PR applied this suggested approach.
Because the submodule is available since Tensorflow2.0, it also checks the major version of Tensorflow and uses the separate Keras package when running with Tensorflow1.X. This version check was also applied to the line of model.compile( ... because the argument lr for RMSprop is deprecated and learning_rate is prefered to be used.
Additionally, dqn_gazebo.py was changed. It finds the path to goal_box model from the installed directories of turtlebot3_gazebo.
For summary, this PR contains:
version check of Tensorflow to use Keras submodule for Tensorflow2.X
version check of Tensorflow to use learning_rate argument of RMSprop for Tensorflow2.X
updated dqn_gazebo.py to the path to goal_box from the shared libraries.
I understand the Foxy version of turtlebot3_dqn is not officially supported yet. If these changes are not appropriate, please close this PR.
Hi ROBOTIS,
This PR contains changes to solve errors when running turtlebot3_dqn on ROS2 Foxy.
Ubuntu Focal, on which ROS2 Foxy is supported, uses Tensorflow2.0 or above. When running
dqn_agent
on ROS2 Foxy, I experienced the following error:AttributeError: module 'keras.utils.generic_utils' has no attribute 'populate_dict_with_module_objects'
Apparently, the Keras package has a compatibility problem as reported here: https://github.com/keras-team/keras/issues/14632 In their discussion, it was suggested to use the Keras submodule of Tensorflow2.X instead of the separate Keras package. This PR applied this suggested approach.Because the submodule is available since Tensorflow2.0, it also checks the major version of Tensorflow and uses the separate Keras package when running with Tensorflow1.X. This version check was also applied to the line of
model.compile( ...
because the argumentlr
forRMSprop
is deprecated andlearning_rate
is prefered to be used.Additionally,
dqn_gazebo.py
was changed. It finds the path togoal_box
model from the installed directories ofturtlebot3_gazebo
.For summary, this PR contains:
learning_rate
argument ofRMSprop
for Tensorflow2.Xdqn_gazebo.py
to the path togoal_box
from the shared libraries.I understand the Foxy version of turtlebot3_dqn is not officially supported yet. If these changes are not appropriate, please close this PR.
Thank you