Skip to content

Troubleshooting

In this section, we provide general troubleshooting steps to help you diagnose and resolve common issues you may encounter while working with ROS2, Gazebo, and robotic simulations.


Table of Contents

  1. ROS2 Nodes Not Communicating
  2. Unable to Find Packages or Nodes
  3. Gazebo Simulation Issues
  4. Gripper Not Closing Properly
  5. Blocks Not Being Picked Up
  6. Simulation Lag or Crashes
  7. Permission Denied Errors
  8. Build Failures with colcon build
  9. Issues with git and SSH
  10. General Debugging Tips
  11. Network Configuration Issues on Virtual Machines
  12. Environment Variable Conflicts
  13. Incorrect File Paths
  14. Python Import Errors
  15. Unexpected Robot Behavior
  16. Visualization Issues in RViz

ROS2 Nodes Not Communicating

  • Ensure that all necessary nodes are running. Use ros2 node list to check active nodes.
  • Verify that you have sourced the correct setup.bash files for your workspaces.
  • Check for mismatched ROS Domain IDs if working on multiple machines or virtual machines.
  • Restart the ROS2 daemon:

    ros2 daemon stop
    ros2 daemon start
    

Unable to Find Packages or Nodes

  • Ensure that your workspace has been built using colcon build.
  • Source the workspace after building:

    source install/setup.bash
    
  • Check that the package is correctly listed in your workspace's src directory.


Gazebo Simulation Issues

  • If Gazebo fails to launch, check for missing dependencies or plugins.
  • Verify that the URDF or SDF files have correct paths and syntax.
  • Check the console output for error messages related to Gazebo or Ignition services.

Gripper Not Closing Properly

  • Ensure the gripper control commands are correctly implemented in your script.
  • Verify that the gripper model is properly loaded in Gazebo and that the joint names match those in your code.
  • Check for any conflicting controllers that may be overriding gripper commands.

Blocks Not Being Picked Up

  • Ensure that the gripper is properly aligned with the block before attempting to grasp.
  • Check the collision properties of both the gripper and the blocks to ensure they can interact.
  • Verify that the gripper is closing sufficiently to grasp the block.
  • Consider slowing down the robot's movement when approaching and grasping the block to improve accuracy.

Simulation Lag or Crashes

  • Reduce the number of active nodes or simplify the simulation environment.
  • Adjust physics parameters in Gazebo to reduce computational load.
  • Ensure your computer meets the minimum system requirements for running Gazebo and ROS2.

Permission Denied Errors

  • Check file permissions for scripts and executables. Use chmod +x script.py to make a script executable.
  • Ensure you have the necessary permissions to access files and directories.

Build Failures with colcon build

  • Review the error messages for specific issues.
  • Ensure all dependencies are installed using rosdep:

    rosdep install --from-paths src --ignore-src -r -y
    
  • Clean the workspace and rebuild:

    rm -rf build/ install/ log/
    colcon build
    

Issues with git and SSH

  • Verify that your SSH keys are correctly configured and added to your GitLab account.
  • Test your SSH connection:

    ssh -T git@gitlab.oit.duke.edu
    
  • Ensure you are using the correct repository URL (SSH, not HTTPS).


General Debugging Tips

  • Use rqt to visualize the ROS2 graph and monitor topics, nodes, and services.
  • Insert logging statements in your code using node.get_logger().info("message") to track execution flow.
  • Consult the ROS2 documentation and forums for additional support.
  • Break down complex tasks into smaller, testable components.
  • Regularly save backups of your work to prevent data loss.

Network Configuration Issues on Virtual Machines

  • If using multiple VMs, ensure they are correctly networked.
  • Adjust ROS Domain IDs to prevent interference between different ROS2 networks.
  • Use ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST to limit node discovery to the local machine.

Environment Variable Conflicts

  • Check for conflicting environment variables by printing them:

    printenv | grep ROS
    
  • Ensure you are not sourcing multiple ROS2 distributions simultaneously.


Incorrect File Paths

  • Verify that all file paths in your scripts and configuration files are correct.
  • Use absolute paths to avoid ambiguity.
  • Check for typos or incorrect directory names.

Python Import Errors

  • Ensure all necessary Python packages are installed.
  • Check that your Python scripts are in the correct directory and are properly referenced in setup.py.
  • Rebuild your workspace with --symlink-install to pick up changes without a full rebuild.

Unexpected Robot Behavior

  • Confirm that the robot's initial state matches the assumptions in your script.
  • Verify that joint limits and safety parameters are correctly set.
  • Use simulation step-by-step execution or slow down the simulation speed to observe behavior.

Visualization Issues in RViz

  • Ensure that all required topics are being published and subscribed correctly.
  • Check that the TF tree is correctly broadcasting transformations.
  • Reload or reset RViz configurations if displays are not updating.