Skip to content

Instantly share code, notes, and snippets.

@RobinCPC
Last active November 26, 2022 15:24
Show Gist options
  • Save RobinCPC/edb4c03d69b46d60be86ac0303a24437 to your computer and use it in GitHub Desktop.
Save RobinCPC/edb4c03d69b46d60be86ac0303a24437 to your computer and use it in GitHub Desktop.
Record how to create Catkin Workspace and add urdf package

[ROS] Create Catkin Workspace and add urdf package

Assume you already install ros

  • Frist create package and add urdf
    $ mkdir catkin_ws_PMCurdf
    $ cd catkin_ws_PMCurdf/
    $ mkdir src
    $ cd src/
    $ catkin_init_workspace
    $ cd ..
    $ catkin_make
    $ source devel/setup.bash
    $ rospack list
    $ rospack find package:
    $ cd src
    $ catkin_create_pkg PMC6dof_urdf
    $ cd PMC6dof_urdf/
    $ rospack find PMC6dof_urdf
    # add urdf file and mesh file into urdf & mesh folder
    $ rospack find PMC6dof_urdf     # will show you location of folder
    $ roslaunch urdf_tutorial display.launch model:=`rospack find PMC6dof_urdf`/urdf/PMC_6dof.urdf gui:=true
    # will show up robot arm in rviz with fake FK control panel
  • reuse pack

Because my own pack is not default in rospack list, need to add every time you open a new terminal (may set a script in bash)

    $ cd workspace/catkin_ws_PMCurdf/
    $ source devel/setup.bash
    $ rospack find PMC6dof_urdf
    $ roslaunch urdf_tutorial display.launch  model:=`rospack find PMC6dof_urdf`/urdf/PMC_6dof.urdf gui:=true

note: if you want to reuse in different computers, need to rebuild the source before doing the above step.

	$ cd workspace/catkin_ws_PMCurdf/
	$ rm -r devel/ build/	# remove old compiled data.
	$ catkin_make 	# make sure `src/` is the same folder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment