PierreExeter / jaco-gym

An OpenAI Gym environment for the Jaco2 robotic arm by Kinova. The environment is implemented both for the real arm and the Gazebo simulator.
GNU General Public License v3.0
8 stars 2 forks source link

Gazebo crashed when simulation #1

Closed superggb closed 3 years ago

superggb commented 3 years ago

Hi PierreExeter, It's very helpful of this repository to combine kinova and gym for some people like me who needs train arm with RL. Thanks a lot! However, when I train agent in gazebo, it always come out with the crash with ' [gazebo-2] process has died...' randomly. So I cannot train too many epochs successfully. For example, it may crashed when 500 epoch or when 3000 epoch. How do you solve this problem?

My env is : ubuntu 16.04 + ros kinetic +gazebo 7 && ubuntu18 + ros melodic +gazebo 9 (both suffered this problem)

PierreExeter commented 3 years ago

Hi superggb, I'm glad you appreciate my contribution, thanks.

Regarding your issue, I remember that a similar error occurred to me after 10,000 epochs. I think it comes from the ROS packages from Kinova. Gazebo seems to be struggling when many actions are sent quickly to the action server. Here's what you can try:

  1. reduce the simulation speed in the launch file You can change max_step_size, real_time_update_rate or real_time_factor and see if it helps with your problem.

  2. try this other repository where I also implemented some environments for the Jaco.

I'm planning to work on these environments in the future. For the moment it's a work-in-progress, that's why they may not work properly.

Hope this helps.

superggb commented 3 years ago

Thanks a lot for your reply! After I adjust the simulation speed factors it becomes more stable thought crash happens occasionally. I'll try your other repository later.

ollieyzhang commented 3 years ago

Hi PierreExeter, Thanks for sharing this useful combination of kinova and gym. It really helps me for validating RL algorithms.

I just downloaded all things according to your instruction and it went well. But when I tried to launch kinova arm in Gazebo, It failed to load model and show me this error.

[ERROR] [1603785814.897270380]: Parser found 1 elements but 3 expected while parsing vector [-0.10117000000000001] [ERROR] [1603785814.897352575]: Malformed parent origin element for joint [j2n6s300_joint_5] [ERROR] [1603785814.897367053]: joint xml is not initialized correctly [gazebo-1] process has died [pid 2501, exit code 255, cmd /opt/ros/kinetic/lib/gazebo_ros/gzserver -u -e ode /home/yan/ros_catkin_ws/src/kinova-ros/kinova_gazebo/worlds/jaco.world name:=gazebo log:=/home/yan/.ros/log/c71b93c4-1824-11eb-86ab-40b076a3ee78/gazebo-1.log]. log file: /home/yan/.ros/log/c71b93c4-1824-11eb-86ab-40b076a3ee78/gazebo-1.log [robot_state_publisher-4] process has died [pid 2508, exit code 255, cmd /opt/ros/kinetic/lib/robot_state_publisher/robot_state_publisher /joint_states:=/j2n6s300/joint_states name:=robot_state_publisher log:=/home/yan/.ros/log/c71b93c4-1824-11eb-86ab-40b076a3ee78/robot_state_publisher-4.log]. log file: /home/yan/.ros/log/c71b93c4-1824-11eb-86ab-40b076a3ee78/robot_state_publisher-4.log

Have you ever encountered this problem before? Do you have any idea about this problem? I have searched for the solution for days, but found nothing.....

I am currently using: Ubuntu 16.04 , ROS-Kinetic, Gazebo7, Python3.5

And the full executing messages are(in case it is useful):

yan@DaVin:~$ roslaunch kinova_gazebo robot_launch_noRender_noSphere.launch kinova_robotType:=j2n6s300 ... logging to /home/yan/.ros/log/c71b93c4-1824-11eb-86ab-40b076a3ee78/roslaunch-DaVin-1958.log Checking log directory for disk usage. This may take awhile. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

/opt/ros/kinetic/lib/python2.7/dist-packages/roslaunch/loader.py:409: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. data = yaml.load(text) started roslaunch server http://DaVin:41955/

SUMMARY

PARAMETERS

NODES /j2n6s300/ j2n6s300_trajectory_controller (controller_manager/spawner) / gazebo (gazebo_ros/gzserver) robot_state_publisher (robot_state_publisher/robot_state_publisher) urdf_spawner (gazebo_ros/spawn_model)

ROS_MASTER_URI=http://localhost:11311

process[gazebo-1]: started with pid [1980] process[urdf_spawner-2]: started with pid [1984] process[j2n6s300/j2n6s300_trajectory_controller-3]: started with pid [1986] process[robot_state_publisher-4]: started with pid [1987] [ERROR] [1603785737.627180117]: Parser found 1 elements but 3 expected while parsing vector [-0.10117000000000001] [ERROR] [1603785737.627245019]: Malformed parent origin element for joint [j2n6s300_joint_5] [ERROR] [1603785737.627255619]: joint xml is not initialized correctly [gazebo-1] process has died [pid 1980, exit code 255, cmd /opt/ros/kinetic/lib/gazebo_ros/gzserver -u -e ode /home/yan/ros_catkin_ws/src/kinova-ros/kinova_gazebo/worlds/jaco.world name:=gazebo log:=/home/yan/.ros/log/c71b93c4-1824-11eb-86ab-40b076a3ee78/gazebo-1.log]. log file: /home/yan/.ros/log/c71b93c4-1824-11eb-86ab-40b076a3ee78/gazebo-1.log [robot_state_publisher-4] process has died [pid 1987, exit code 255, cmd /opt/ros/kinetic/lib/robot_state_publisher/robot_state_publisher /joint_states:=/j2n6s300/joint_states name:=robot_state_publisher log:=/home/yan/.ros/log/c71b93c4-1824-11eb-86ab-40b076a3ee78/robot_state_publisher-4.log]. log file: /home/yan/.ros/log/c71b93c4-1824-11eb-86ab-40b076a3ee78/robot_state_publisher-4.log SpawnModel script started [INFO] [1603785737.949901, 0.000000]: Controller Spawner: Waiting for service controller_manager/load_controller [INFO] [1603785738.048754, 0.000000]: Loading model XML from ros parameter [INFO] [1603785738.052809, 0.000000]: Waiting for service /gazebo/spawn_urdf_model [INFO] [1603785738.054148, 0.000000]: Calling service /gazebo/spawn_urdf_model [INFO] [1603785748.074921, 24.936000]: Spawn status: SpawnModel: Entity pushed to spawn queue, but spawn service timed out waiting for entity to appear in simulation under the name j2n6s300 [INFO] [1603785748.075266, 24.936000]: Waiting for service /gazebo/set_model_configuration [INFO] [1603785748.077012, 24.938000]: temporary hack to fix the -J joint position option (issue #93), sleeping for 1 second to avoid race condition. [INFO] [1603785749.078452, 25.938000]: Calling service /gazebo/set_model_configuration [INFO] [1603785749.080857, 25.940000]: Set model configuration status: SetModelConfiguration: model does not exist [urdf_spawner-2] process has finished cleanly log file: /home/yan/.ros/log/c71b93c4-1824-11eb-86ab-40b076a3ee78/urdf_spawner-2.log [WARN] [1603785768.085730, 44.928000]: Controller Spawner couldn't find the expected controller_manager ROS interface. [j2n6s300/j2n6s300_trajectory_controller-3] process has finished cleanly log file: /home/yan/.ros/log/c71b93c4-1824-11eb-86ab-40b076a3ee78/j2n6s300-j2n6s300_trajectory_controller-3.log all processes on machine have died, roslaunch will exit

PierreExeter commented 3 years ago

Hi Davincispencil,

Unfortunately I haven't seen this error before... My guess is that there's a ROS package missing but I'm not sure which one. I should create a dockerfile with everything installed but I don't have time at the moment. I have ROS Melodic on my system and I cannot currently test on Kinetic.

Did you try to install the kinova-ros package separately? Do you get the same error? You may find some useful information in the logs in /home/yan/.ros/log/. You can also try to downgrade PyYAML as there's a deprecation warning with your version.

Let me know if any of this works.

ollieyzhang commented 3 years ago

Hi PierreExeter, Thanks for advice. I have tried everything that I can do, but it seems that there is still some problems unfortunately.

PierreExeter commented 3 years ago

Sorry about that, I'm aware that it's not running smoothly but I don't have time to troubleshoot it at the moment.