In Unit 3: Object Detection when I try to spawn the red cube from a fresh terminal I get the following:
user:~$ source /opt/ros/noetic/setup.bash
ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different distributions.
user:~$ rosrun gazebo_ros spawn_model -file grasp_box.urdf -urdf -x 0.5 -y 0.13 -z 0.1 -model grasp_box
[INFO] [1663845242.431040, 0.000000]: Loading model XML from file grasp_box.urdf
[FATAL] [1663845242.432597, 0.000000]: Error: specified file grasp_box.urdf does not exist
I created the URDF file as specified previously.
I found the lines of code where the error is triggered in the */opt/ros/noetic/lib/gazebo_ros/spawn_model* file:
# Load model XML from file
if self.args.file:
rospy.loginfo("Loading model XML from file %s" % self.args.file)
if not os.path.exists(self.args.file):
rospy.logfatal("Error: specified file %s does not exist", self.args.file)
return 1
And after that I tried to see if the file can be found through python. Indeed an error occurs. However it is present in an ls
command.
see here
user:~/catkin_ws$ python
Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.path.exists('grasp_box.urdf')
False
user:~/catkin_ws$ ls src/
CMakeLists.txt grasp_box.urdf load_params my_moveit_config ur3e_robot.urdf.xacro
>>>
A chmod +rwx grasp_box.urdf
won’t change anything.
Any help will be much appreciated.