UniversalRobots / Universal_Robots_ROS2_Gazebo_Simulation

BSD 3-Clause "New" or "Revised" License
69 stars 29 forks source link

Sometimes gazebo_ros2_control doesn't work #78

Open ozgur-kurt opened 6 months ago

ozgur-kurt commented 6 months ago

When I arranged src packages for different 3D Model instead of only UR robot. Sometimes gazebo_ros2_control is loaded and worked, some of time gazebo_ros2_control doesnt spawn and not work. It probably works unstable for loading the heavy 3D Model. What do you think about adding delay inside ur_sim_control.launch.py and ur_sim_moveit.launch.py ?

[INFO] [move_group-1]: process started with pid [123764] [INFO] [rviz2-2]: process started with pid [123766] [INFO] [servo_node_main-3]: process started with pid [123768] [INFO] [robot_state_publisher-4]: process started with pid [123770] [INFO] [spawner-5]: process started with pid [123772] [INFO] [spawner-6]: process started with pid [123774] [INFO] [gzserver-7]: process started with pid [123776] [INFO] [gzclient-8]: process started with pid [123778] [INFO] [spawn_entity.py-9]: process started with pid [123782] [robot_state_publisher-4] [INFO] [1715871119.685552372] [robot_state_publisher]: got segment base [robot_state_publisher-4] [INFO] [1715871119.685662482] [robot_state_publisher]: got segment base_link [robot_state_publisher-4] [INFO] [1715871119.685675017] [robot_state_publisher]: got segment base_link_inertia [robot_state_publisher-4] [INFO] [1715871119.685679826] [robot_state_publisher]: got segment camera_link [robot_state_publisher-4] [INFO] [1715871119.685689078] [robot_state_publisher]: got segment cell [robot_state_publisher-4] [INFO] [1715871119.685697683] [robot_state_publisher]: got segment flange [robot_state_publisher-4] [INFO] [1715871119.685702116] [robot_state_publisher]: got segment forearm_link [robot_state_publisher-4] [INFO] [1715871119.685706514] [robot_state_publisher]: got segment ft_frame [robot_state_publisher-4] [INFO] [1715871119.685710657] [robot_state_publisher]: got segment shoulder_link [robot_state_publisher-4] [INFO] [1715871119.685714858] [robot_state_publisher]: got segment tool0 [robot_state_publisher-4] [INFO] [1715871119.685719114] [robot_state_publisher]: got segment upper_arm_link [robot_state_publisher-4] [INFO] [1715871119.685723565] [robot_state_publisher]: got segment world [robot_state_publisher-4] [INFO] [1715871119.685727842] [robot_state_publisher]: got segment wrist_1_link [robot_state_publisher-4] [INFO] [1715871119.685731925] [robot_state_publisher]: got segment wrist_2_link [robot_state_publisher-4] [INFO] [1715871119.685736187] [robot_state_publisher]: got segment wrist_3_link [move_group-1] [INFO] [1715871119.699676872] [moveit_rdf_loader.rdf_loader]: Loaded robot model in 0 seconds [move_group-1] [INFO] [1715871119.699731215] [moveit_robot_model.robot_model]: Loading robot model 'ur'... [move_group-1] [INFO] [1715871119.699741641] [moveit_robot_model.robot_model]: No root/virtual joint specified in SRDF. Assuming fixed jointAssuming fixed joint [move_group-1] [WARN] [1715871119.796543625] [moveit_robot_model.robot_model]: Link cell has visual geometry but no collision geometry. Collision geometry will be left empty. Fix your URDF file by explicitly specifying collision geometry. [move_group-1] [WARN] [1715871119.797443643] [moveit_robot_model.robot_model]: Link comau has visual geometry but no collision geometry. Collision geometry will be left empty. Fix your URDF file by explicitly specifying collision geometry. [move_group-1] [WARN] [1715871119.797978652] [moveit_robot_model.robot_model]: Group 'camera' must have at least one valid joint [move_group-1] [WARN] [1715871119.798302963] [moveit_robot_model.robot_model]: Failed to add group 'camera' [servo_node_main-3] [WARN] [1715871119.841634489] [moveit_robot_model.robot_model]: Link cell has visual geometry but no collision geometry. Collision geometry will be left empty. Fix your URDF file by explicitly specifying collision geometry. [servo_node_main-3] [WARN] [1715871119.841788778] [moveit_robot_model.robot_model]: Group 'camera' must have at least one valid joint [servo_node_main-3] [WARN] [1715871119.841795550] [moveit_robot_model.robot_model]: Failed to add group 'camera' [servo_node_main-3] [WARN] [1715871119.845223229] [moveit_ros.robot_model_loader]: No kinematics plugins defined. Fill and load kinematics.yaml! [move_group-1] [INFO] [1715871120.059075056] [moveit_ros.planning_scene_monitor.planning_scene_monitor]: Publishing maintained planning scene on 'monitored_planning_scene' [move_group-1] [INFO] [1715871120.059197390] [moveit.ros_planning_interface.moveit_cpp]: Listening to 'joint_states' for joint states [move_group-1] [INFO] [1715871120.059733864] [moveit_ros.current_state_monitor]: Listening to joint states on topic 'joint_states' [move_group-1] [INFO] [1715871120.060046243] [moveit_ros.planning_scene_monitor.planning_scene_monitor]: Listening to '/attached_collision_object' for attached collision objects [move_group-1] [INFO] [1715871120.060056458] [moveit_ros.planning_scene_monitor.planning_scene_monitor]: Starting planning scene monitor [move_group-1] [INFO] [1715871120.060302889] [moveit_ros.planning_scene_monitor.planning_scene_monitor]: Listening to '/planning_scene' [move_group-1] [INFO] [1715871120.060312194] [moveit_ros.planning_scene_monitor.planning_scene_monitor]: Starting world geometry update monitor for collision objects, attached objects, octomap updates. [move_group-1] [INFO] [1715871120.060565244] [moveit_ros.planning_scene_monitor.planning_scene_monitor]: Listening to 'collision_object' [move_group-1] [INFO] [1715871120.060858817] [moveit_ros.planning_scene_monitor.planning_scene_monitor]: Listening to 'planning_scene_world' for planning scene world geometry [move_group-1] [WARN] [1715871120.061022674] [moveit.ros.occupancy_map_monitor.middleware_handle]: Resolution not specified for Octomap. Assuming resolution = 0.1 instead [move_group-1] [ERROR] [1715871120.061036422] [moveit.ros.occupancy_map_monitor.middleware_handle]: No 3D sensor plugin(s) defined for octomap updates [spawn_entity.py-9] [INFO] [1715871120.066031426] [spawn_ur]: Spawn Entity started [spawn_entity.py-9] [INFO] [1715871120.066293950] [spawn_ur]: Loading entity published on topic robot_description [spawn_entity.py-9] /opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/qos.py:307: UserWarning: DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL is deprecated. Use DurabilityPolicy.TRANSIENT_LOCAL instead. [spawn_entity.py-9] warnings.warn( [spawn_entity.py-9] [INFO] [1715871120.067861486] [spawn_ur]: Waiting for entity xml on robot_description [spawn_entity.py-9] [INFO] [1715871120.078953207] [spawn_ur]: Waiting for service /spawn_entity, timeout = 30 [spawn_entity.py-9] [INFO] [1715871120.079222580] [spawn_ur]: Waiting for service /spawn_entity [servo_node_main-3] [INFO] [1715871120.083904369] [moveit_ros.current_state_monitor]: Listening to joint states on topic '/joint_states' [servo_node_main-3] [INFO] [1715871120.086693454] [moveit_ros.planning_scene_monitor.planning_scene_monitor]: Listening to '/attached_collision_object' for attached collision objects [servo_node_main-3] [INFO] [1715871120.086709289] [moveit_ros.planning_scene_monitor.planning_scene_monitor]: Starting planning scene monitor [servo_node_main-3] [INFO] [1715871120.087394436] [moveit_ros.planning_scene_monitor.planning_scene_monitor]: Listening to '/planning_scene' [servo_node_main-3] [INFO] [1715871120.087653976] [moveit_ros.planning_scene_monitor.planning_scene_monitor]: Publishing maintained planning scene on '/servo_node/publish_planning_scene' [servo_node_main-3] [WARN] [1715871120.092220183] [moveit_servo.servo_calcs]: No kinematics solver instantiated for group 'ur_manipulator'. Will use inverse Jacobian for servo calculations instead. [servo_node_main-3] [WARN] [1715871120.092237433] [moveit_servo.collision_check]: Collision check rate is low, increase it in yaml file if CPU allows [move_group-1] [INFO] [1715871120.469873486] [moveit.ros_planning_interface.moveit_cpp]: Loading planning pipeline 'pilz_industrial_motion_planner' [move_group-1] [INFO] [1715871120.471352581] [moveit.pilz_industrial_motion_planner.joint_limits_aggregator]: Reading limits from namespace robot_description_planning [move_group-1] [INFO] [1715871120.473983873] [moveit.pilz_industrial_motion_planner]: Available plugins: pilz_industrial_motion_planner/PlanningContextLoaderCIRC pilz_industrial_motion_planner/PlanningContextLoaderLIN pilz_industrial_motion_planner/PlanningContextLoaderPTP [move_group-1] [INFO] [1715871120.473998258] [moveit.pilz_industrial_motion_planner]: About to load: pilz_industrial_motion_planner/PlanningContextLoaderCIRC [move_group-1] [INFO] [1715871120.474756740] [moveit.pilz_industrial_motion_planner]: Registered Algorithm [CIRC] [move_group-1] [INFO] [1715871120.474765963] [moveit.pilz_industrial_motion_planner]: About to load: pilz_industrial_motion_planner/PlanningContextLoaderLIN [move_group-1] [INFO] [1715871120.475218334] [moveit.pilz_industrial_motion_planner]: Registered Algorithm [LIN] [move_group-1] [INFO] [1715871120.475225470] [moveit.pilz_industrial_motion_planner]: About to load: pilz_industrial_motion_planner/PlanningContextLoaderPTP [move_group-1] [INFO] [1715871120.475678649] [moveit.pilz_industrial_motion_planner]: Registered Algorithm [PTP] [move_group-1] [INFO] [1715871120.475687356] [moveit.ros_planning.planning_pipeline]: Using planning interface 'Pilz Industrial Motion Planner' [move_group-1] [INFO] [1715871120.476950803] [moveit_ros.fix_workspace_bounds]: Param 'pilz_industrial_motion_planner.default_workspace_bounds' was not set. Using default value: 10.000000 [move_group-1] [INFO] [1715871120.476965722] [moveit_ros.fix_start_state_bounds]: Param 'pilz_industrial_motion_planner.start_state_max_bounds_error' was not set. Using default value: 0.050000 [move_group-1] [INFO] [1715871120.476998444] [moveit_ros.fix_start_state_bounds]: Param 'pilz_industrial_motion_planner.start_state_max_dt' was not set. Using default value: 0.500000 [move_group-1] [INFO] [1715871120.477007932] [moveit_ros.fix_start_state_collision]: Param 'pilz_industrial_motion_planner.start_state_max_dt' was not set. Using default value: 0.500000 [move_group-1] [INFO] [1715871120.477011069] [moveit_ros.fix_start_state_collision]: Param 'pilz_industrial_motion_planner.jiggle_fraction' was not set. Using default value: 0.020000 [move_group-1] [INFO] [1715871120.477014621] [moveit_ros.fix_start_state_collision]: Param 'pilz_industrial_motion_planner.max_sampling_attempts' was not set. Using default value: 100 [move_group-1] [INFO] [1715871120.477022677] [moveit.ros_planning.planning_pipeline]: Using planning request adapter 'Fix Workspace Bounds' [move_group-1] [INFO] [1715871120.477025399] [moveit.ros_planning.planning_pipeline]: Using planning request adapter 'Fix Start State Bounds' [move_group-1] [INFO] [1715871120.477027645] [moveit.ros_planning.planning_pipeline]: Using planning request adapter 'Fix Start State In Collision' [move_group-1] [INFO] [1715871120.477029902] [moveit.ros_planning.planning_pipeline]: Using planning request adapter 'Fix Start State Path Constraints' [move_group-1] [INFO] [1715871120.487631753] [moveit.plugins.moveit_simple_controller_manager]: Added FollowJointTrajectory controller for scaled_joint_trajectory_controller [move_group-1] [INFO] [1715871120.488556404] [moveit.plugins.moveit_simple_controller_manager]: Added FollowJointTrajectory controller for joint_trajectory_controller [move_group-1] [INFO] [1715871120.488652983] [moveit.plugins.moveit_simple_controller_manager]: Returned 2 controllers in list [move_group-1] [INFO] [1715871120.488667451] [moveit.plugins.moveit_simple_controller_manager]: Returned 2 controllers in list [move_group-1] [INFO] [1715871120.488869447] [moveit_ros.trajectory_execution_manager]: Trajectory execution is not managing controllers [move_group-1] [INFO] [1715871120.488880442] [move_group.move_group]: MoveGroup debug mode is ON [move_group-1] [INFO] [1715871120.496408670] [move_group.move_group]: [move_group-1] [move_group-1] **** [move_group-1] MoveGroup using: [move_group-1] - ApplyPlanningSceneService [move_group-1] - ClearOctomapService [move_group-1] - CartesianPathService [move_group-1] - ExecuteTrajectoryAction [move_group-1] - GetPlanningSceneService [move_group-1] - KinematicsService [move_group-1] - MoveAction [move_group-1] - MotionPlanService [move_group-1] - QueryPlannersService [move_group-1] * - StateValidationService [move_group-1] **** [move_group-1] [move_group-1] [INFO] [1715871120.496437346] [moveit_move_group_capabilities_base.move_group_context]: MoveGroup context using planning plugin pilz_industrial_motion_planner/CommandPlanner [move_group-1] [INFO] [1715871120.496443752] [moveit_move_group_capabilities_base.move_group_context]: MoveGroup context initialization complete [move_group-1] Loading 'move_group/ApplyPlanningSceneService'... [move_group-1] Loading 'move_group/ClearOctomapService'... [move_group-1] Loading 'move_group/MoveGroupCartesianPathService'... [move_group-1] Loading 'move_group/MoveGroupExecuteTrajectoryAction'... [move_group-1] Loading 'move_group/MoveGroupGetPlanningSceneService'... [move_group-1] Loading 'move_group/MoveGroupKinematicsService'... [move_group-1] Loading 'move_group/MoveGroupMoveAction'... [move_group-1] Loading 'move_group/MoveGroupPlanService'... [move_group-1] Loading 'move_group/MoveGroupQueryPlannersService'... [move_group-1] Loading 'move_group/MoveGroupStateValidationService'... [move_group-1] [move_group-1] You can start planning now! [move_group-1] [rviz2-2] [INFO] [1715871120.913908794] [rviz2]: Stereo is NOT SUPPORTED [rviz2-2] [INFO] [1715871120.913966997] [rviz2]: OpenGl version: 4.6 (GLSL 4.6) [rviz2-2] [INFO] [1715871120.926865532] [rviz2]: Stereo is NOT SUPPORTED [rviz2-2] Warning: class_loader.impl: SEVERE WARNING!!! A namespace collision has occurred with plugin factory for class rviz_default_plugins::displays::InteractiveMarkerDisplay. New factory will OVERWRITE existing one. This situation occurs when libraries containing plugins are directly linked against an executable (the one running right now generating this message). Please separate plugins out into their own library or just don't link against the library and use either class_loader::ClassLoader/MultiLibraryClassLoader to open. [rviz2-2] at line 253 in /opt/ros/humble/include/class_loader/class_loader/class_loader_core.hpp [spawner-5] [INFO] [1715871121.992655608] [spawner_joint_state_broadcaster]: Waiting for '/controller_manager' node to exist [spawner-6] [INFO] [1715871122.061492281] [spawner_joint_trajectory_controller]: Waiting for '/controller_manager' node to exist [spawn_entity.py-9] [INFO] [1715871122.084614481] [spawn_ur]: Calling service /spawn_entity [spawn_entity.py-9] [INFO] [1715871122.308717468] [spawn_ur]: Spawn status: SpawnEntity: Successfully spawned entity [ur] [INFO] [spawn_entity.py-9]: process has finished cleanly [pid 123782] [spawner-5] [INFO] [1715871124.000190217] [spawner_joint_state_broadcaster]: Waiting for '/controller_manager' node to exist [rviz2-2] [ERROR] [1715871124.007834450] [moveit_ros_visualization.motion_planning_frame]: Action server: /recognize_objects not available [rviz2-2] [INFO] [1715871124.016868794] [moveit_ros_visualization.motion_planning_frame]: MoveGroup namespace changed: / -> . Reloading params. [spawner-6] [INFO] [1715871124.068937104] [spawner_joint_trajectory_controller]: Waiting for '/controller_manager' node to exist [rviz2-2] Error: Joint 'basler_camera' declared as part of group 'camera' is not known to the URDF [rviz2-2] at line 168 in ./src/model.cpp [rviz2-2] Warning: Group 'camera' is empty. [rviz2-2] at line 245 in ./src/model.cpp [rviz2-2] [INFO] [1715871124.072605292] [moveit_rdf_loader.rdf_loader]: Loaded robot model in 0.00252864 seconds [rviz2-2] [INFO] [1715871124.072647974] [moveit_robot_model.robot_model]: Loading robot model 'ur'... [rviz2-2] [INFO] [1715871124.072658141] [moveit_robot_model.robot_model]: No root/virtual joint specified in SRDF. Assuming fixed joint [rviz2-2] [INFO] [1715871124.311860162] [moveit_ros.planning_scene_monitor.planning_scene_monitor]: Starting planning scene monitor [spawner-5] [INFO] [1715871126.007322427] [spawner_joint_state_broadcaster]: Waiting for '/controller_manager' node to exist [spawner-6] [INFO] [1715871126.076062084] [spawner_joint_trajectory_controller]: Waiting for '/controller_manager' node to exist [rviz2-2] [spawner-5] [INFO] [1715871128.014371017] [spawner_joint_state_broadcaster]: Waiting for '/controller_manager' node to exist [rviz2-2] [INFO] [1715871128.032025039] [interactive_marker_display_105792153429424]: Sending request for interactive markers [rviz2-2] [INFO] [1715871128.074757025] [interactive_marker_display_105792153429424]: Service response received for initialization [spawner-6] [INFO] [1715871128.082827837] [spawner_joint_trajectory_controller]: Waiting for '/controller_manager' node to exist [spawner-5] [ERROR] [1715871130.021422289] [spawner_joint_state_broadcaster]: Controller manager not available [spawner-6] [ERROR] [1715871130.089398457] [spawner_joint_trajectory_controller]: Controller manager not available [ERROR] [spawner-5]: process has died [pid 123772, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner joint_state_broadcaster --controller-manager /controller_manager --ros-args']. [ERROR] [spawner-6]: process has died [pid 123774, exit code 1, cmd '/opt/ros/humble/lib/controller_manager/spawner joint_trajectory_controller -c /controller_manager --ros-args'].

fmauch commented 6 months ago

I'm afraid I cannot quite follow. Is what you are saying, that starting up gazebo can take a long time when "heavy" 3d models (I assume by "heavy" you mean geometrically complex / large mesh files?) and then the controller spawners and moveit startup crash due to the controller manager not being present?

ozgur-kurt commented 6 months ago

Yes, exactly right. Sorry for my explanation. After opening Rviz-Moveit, complex/large cad file needs take a time to show up compared to only UR robot cad file. As far as I am concerned, gazebo sometimes doesn't spawn controller because of complex/large mesh file. How did I come to this conclusion ? Because gazebo everytime spawns controller since only UR robot cad file imported.

fmauch commented 6 months ago

RViz should not be the culprit here, it just waits for the joint_state_publisher to be running, which seems to fail in your output.

A quick workaround that you could test would be to add --controller-manager-timeout 200 to all three spawner arguments. This should make everything wait long enough. Could you check whether that helps with your issue?

ozgur-kurt commented 6 months ago

Sorry for beginner question. It should be like that for just one spawn?

    gazebo_spawn_robot = Node(
        package="gazebo_ros",
        executable="spawn_entity.py",
        name="spawn_ur",
        arguments=["-entity", "ur", "-topic", "robot_description","--controller-manager-timeout","200"],
        output="screen",
    )
fmauch commented 6 months ago

No, the timeout has to be added to the spawners:

https://github.com/UniversalRobots/Universal_Robots_ROS2_Gazebo_Simulation/blob/26d3d4f10ea2e57bc98338aa65a0a9014ab89fd5/ur_simulation_gazebo/launch/ur_sim_control.launch.py#L125 https://github.com/UniversalRobots/Universal_Robots_ROS2_Gazebo_Simulation/blob/26d3d4f10ea2e57bc98338aa65a0a9014ab89fd5/ur_simulation_gazebo/launch/ur_sim_control.launch.py#L141 https://github.com/UniversalRobots/Universal_Robots_ROS2_Gazebo_Simulation/blob/26d3d4f10ea2e57bc98338aa65a0a9014ab89fd5/ur_simulation_gazebo/launch/ur_sim_control.launch.py#L147

ozgur-kurt commented 5 months ago

Unfourtanely, it doesn't work. Unstable launch, sometimes spawned sometimes not.

fmauch commented 5 months ago

In that case I would need to ask to to provide a working example that we can use for debugging this.