0
$\begingroup$

I've tried to launch my saved world file. However it kept showing

Resource not found: The following package was not found in : ros1_wiki ROS path [0]=/opt/ros/noetic/share/ros ROS path [1]=/home/rvl224/brian2lee/gazebo/forklift_test/src ROS path [2]=/opt/ros/noetic/share The traceback for the exception was written to the log file

I can launched all the urdf model in the launch file an empty world, but the walls and sdf models in the saved world can't. I've catkin make and run . devel/setup.bash before I roslaunch the launch file. Down below is my launch file and the file location of "test.world" (the saved world file)

/home/rvl224/brian2lee/gazebo/forklift_test/src/ros1_wiki/world/test.world

<?xml version="1.0"?>
<launch>

    <param name="robot_description" command="xacro '$(find forklift)/urdf/forklift.urdf.xacro'"/>
    <param name="pallet_description" command="xacro '$(find forklift)/urdf/pallet.urdf.xacro'"/>

    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"/>
    <node name="joint_state_publisher_gui" pkg="joint_state_publisher_gui" type="joint_state_publisher_gui"/>
    
    <include file="$(find gazebo_ros)/launch/empty_world.launch">
        <arg name="world_name" value="$(find ros1_wiki)/world/test.world"/>
        <arg name="paused" value="false"/>
        <arg name="use_sim_time" value="true"/>
        <arg name="gui" value="true"/>
        <arg name="headless" value="false"/>
        <arg name="debug" value="false"/>
    </include>

    <node name="spawning_forklift" pkg="gazebo_ros" type="spawn_model"
          args="-urdf -model forklift -param robot_description -x -2 -y 0 -z 0 -Y 0"/>

    <node name="spawning_pallet" pkg="gazebo_ros" type="spawn_model"
          args="-urdf -model pallet -param pallet_description -x 0 -y 0 -z 0"/>

</launch>

edit: The CmakeList under ros1_wiki

# toplevel CMakeLists.txt for a catkin workspace
# catkin/cmake/toplevel.cmake

cmake_minimum_required(VERSION 3.0.2)

project(Project)

set(CATKIN_TOPLEVEL TRUE)

# search for catkin within the workspace
set(_cmd "catkin_find_pkg" "catkin" "${CMAKE_SOURCE_DIR}")
execute_process(COMMAND ${_cmd}
  RESULT_VARIABLE _res
  OUTPUT_VARIABLE _out
  ERROR_VARIABLE _err
  OUTPUT_STRIP_TRAILING_WHITESPACE
  ERROR_STRIP_TRAILING_WHITESPACE
)
if(NOT _res EQUAL 0 AND NOT _res EQUAL 2)
  # searching fot catkin resulted in an error
  string(REPLACE ";" " " _cmd_str "${_cmd}")
  message(FATAL_ERROR "Search for 'catkin' in workspace failed (${_cmd_str}): ${_err}")
endif()

# include catkin from workspace or via find_package()
if(_res EQUAL 0)
  set(catkin_EXTRAS_DIR "${CMAKE_SOURCE_DIR}/${_out}/cmake")
  # include all.cmake without add_subdirectory to let it operate in same scope
  include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE)
  add_subdirectory("${_out}")

else()
  # use either CMAKE_PREFIX_PATH explicitly passed to CMake as a command line argument
  # or CMAKE_PREFIX_PATH from the environment
  if(NOT DEFINED CMAKE_PREFIX_PATH)
    if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")
      if(NOT WIN32)
        string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
      else()
        set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
      endif()
    endif()
  endif()

  # list of catkin workspaces
  set(catkin_search_path "")
  foreach(path ${CMAKE_PREFIX_PATH})
    if(EXISTS "${path}/.catkin")
      list(FIND catkin_search_path ${path} _index)
      if(_index EQUAL -1)
        list(APPEND catkin_search_path ${path})
      endif()
    endif()
  endforeach()

  # search for catkin in all workspaces
  set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE)
  find_package(catkin QUIET
    NO_POLICY_SCOPE
    PATHS ${catkin_search_path}
    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
  unset(CATKIN_TOPLEVEL_FIND_PACKAGE)

  if(NOT catkin_FOUND)
    message(FATAL_ERROR "find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.")
  endif()
endif()

catkin_workspace()
$\endgroup$

1 Answer 1

0
$\begingroup$

Can you upload your CMakeLists.txt from folder ros1_wiki? Maybe the name of the package is not correct. Also, did you make a catkin_make?

$\endgroup$
3
  • $\begingroup$ I added the cmakelist content above. Yes I did make a catkin_make. If I tried to run the launch file without the <arg name="world_name" value="$(find ros1_wiki)/world/test.world"/> it'll run normally (Just without the walls and sdf file saved in the .world file which I wanted, only the urdf models in launch file). And I double checked and straight up pasted the package name from folder name, so I don't think that will be the issue. $\endgroup$
    – brian2lee
    Feb 1 at 19:32
  • $\begingroup$ Can you change the line 6 in the CMake to project(ros1_wiki) and try again? $\endgroup$
    – rdelgadov
    Feb 1 at 19:48
  • $\begingroup$ no it does not work, still the same error (sry not replying cuz kinda busy for the past week) $\endgroup$
    – brian2lee
    Feb 7 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.