Ask Your Question
0

How can i spawn pr2 on gazebo ?

asked 2021-06-15 08:10:03 -0500

samourai gravatar image

Hello I'm trying to do the pr2_simulator_tutorial and i'm blocked in the first tutorial (http://wiki.ros.org/pr2_simulator/Tut...).

I launched empty world as asked in the tutorials (and the world opened in gazebo) :

roslaunch pr2_gazebo pr2_empty_world.launch

but when i'm trying to spawn a PR2, it doesn't work and i'm getting the following message (I tried first in another terminal and because it was nos working i also tried in the same where i have writen the first roslaunch)

roslaunch pr2_gazebo pr2.launch
RLException: [pr2.launch] is neither a launch file in package [pr2_gazebo] nor is [pr2_gazebo] a launch file name
The traceback for the exception was written to the log file

I saw similar questions with answers and i tried to solve my problem but no solutions has worked until now

  • writing roslaunch pr2_gazebo pr2_empty_world.launch instead of the previous -> it doesn't change anything and i got the same message

Seemingly, it could have a link with a .zshrc file in which i should add setopt nomatch but i don't find it (even using locate)

Maybe the solution is really easy but i didn't find it. I hope someone could help me.

Thanks for reading

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-06-21 02:56:20 -0500

samourai gravatar image

I've got an answer so i will share it : In fact, we can't use pr2 with ros-noetic (it is not available yet) that's why i could'nt spawn the pr2 robot. I don't know if it will be possible and when but for the moment, we can't.

edit flag offensive delete link more

Comments

Hi, this piece of information should be more readily available. Where did you find out that pr2 is not available for noetic?

SamRodriguez gravatar image SamRodriguez  ( 2021-11-08 05:07:04 -0500 )edit
0

answered 2021-09-12 16:43:28 -0500

osilva gravatar image

updated 2021-09-13 07:34:57 -0500

Hi even though, ROS NOETIC is not currently offered, it's possible to build it from source, with a bit of work. Please refer to this tutorial: https://github.com/robogeekcanada/pr2...

Added the steps based on @gvdhoom feedback:

Install Dependencies for SDformat:

Reference: http://sdformat.org/tutorials?tut=ins...

$ sudo apt-get install ruby-dev build-essential libtinyxml-dev libboost-all-dev cmake mercurial pkg-config

$ sudo apt-get install libignition-math4-dev

Building SDformat:

Reference: http://sdformat.org/

MAKE SURE TO BE IN THE HOME DIRECTORY

$ cd

$ mkdir ~/sdf_source

$ cd ~/sdf_source/

$ git clone https://github.com/osrf/sdformat

$ cd sdformat

$ git checkout sdf6

$ mkdir build

$ cd build

$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr

$ make -j4

$ make install

If error, try $ sudo make install

Install ROS Convex Decomposition

Reference: http://wiki.ros.org/convex_decomposition

MAKE SURE TO BE IN THE HOME DIRECTORY

$ cd

$ mkdir convex_ws

$ cd convex_ws/

$ mkdir src

$ cd src/

$ git clone https://github.com/ros/convex_decomposition.git

$ cd ..

$ catkin_make

$ echo 'source ~/convex_ws/devel/setup.bash'>>~/.bashrc

$ source ~/.bashrc

Install ROS ivcon

Reference: http://wiki.ros.org/ivcon

MAKE SURE TO BE IN THE HOME DIRECTORY

$ cd

$ mkdir ivcon_ws

$ cd ivcon_ws/

$ mkdir src

$ cd src/

$ git clone https://github.com/ros/ivcon.git

$ cd ..

$ catkin_make

$ echo 'source ~/ivcon_ws/devel/setup.bash'>>~/.bashrc

$ source ~/.bashrc

Create workspace for PR2:

MAKE SURE TO BE IN THE HOME DIRECTORY

$ cd

$ mkdir pr2_ws

$ cd pr2_ws/

$ mkdir src

$ cd src/

$ git clone -b noetic-devel https://github.com/PR2/pr2_simulator.git

$ git clone https://github.com/PR2/pr2_mechanism.git

$ git clone https://github.com/PR2/pr2_common.git

$ git clone https://github.com/PR2/pr2_mechanism_msgs.git

$ cd ..

$ catkin_make

Compiling troubleshooting:

If error with sdformat, we will need to make changes to CMakeLists.txt file in pr2_gazebo_plugins/

Reference: https://github.com/PR2/pr2_simulator/...

Go to: pr2_gazebo_plugins/CMakeLists.txt

$ cd ~/pr2_ws/src/pr2_simulator/pr2_gazebo_plugins

$ gedit CMakeLists.txt

Remove red lines, add the green lines. Save and exit file, compile again,

$ cd ~/pr2_ws/

$ catkin_make

If compiling fails due to C++ version, modify CMakeLists.txt in ~/pr2_ws/src/

$ sudo gedit CMakeLists.txt

Add to CMakeLists.txt file as shown in picture below

set(CMAKE_CXX_STANDARD 17)

set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_CXX_EXTENSIONS OFF)

Compile again:

$ cd ~/pr2_ws

$ catkin_make

When compiling is successful, then complete installation by:

$ echo 'source ~/pr2_ws/devel/setup.bash'>>~/.bashrc

$ source ~/.bashrc

Testing PR2 Simulator is working:

Reference: http://wiki.ros.org/pr2_simulator/Tut...

T1:

$ roscore

T2

$ roslaunch gazebo_ros empty_world.launch

T3

$ roslaunch pr2_gazebo pr2.launch

HAPPY CODING!!

Hope it helps.

edit flag offensive delete link more

Comments

As always: please do not post link-only answers.

If (or actually: when) your repository gets taken down, is restructured, moved, or in any other way changes, the link will/may go stale, making your answer much less valuable.

Try to make answers stand-alone, such that even if your repository no longer exists, the information needed by the OP to use PR2 with Noetic is all still readable by future visitors.

gvdhoorn gravatar image gvdhoorn  ( 2021-09-13 02:01:45 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-06-15 06:52:32 -0500

Seen: 210 times

Last updated: Sep 13 '21