ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Error converting xacro to urdf ROS Moveit!

asked 2019-06-13 07:59:40 -0500

sw14928 gravatar image

updated 2019-06-13 08:43:20 -0500

gvdhoorn gravatar image

I am trying to convert an xacro file to a urdf so I can use it in Moveit! My process is as follows:

First I make a workspace: ws_moveit.

Then I download the necessary robot files including the xacro and place them in the source folder of ws_moveit

Then I attempt to run:

rosrun xacro xacro.py kr150_2.xacro > kr150_2.urdf

To receive the following error:

No such file or directory: kr150_2.xacro

This directory definitely exists. When I instruct the terminal exactly where they are and write:

rosrun xacro xacro.py /home/sam/ws_moveit/src/kuka_experimental/kuka_kr150_support/kr150_2.xacro > /home/sam/ws_moveit/src/kuka_experimental/kuka_kr150_support/kr150_2.urdf

I receive the following error:

No such file or directory: /home/sam/ws_moveit/src/kuka_experimental/kuka_kr150_support/kr150_2.macro.xacro

when this definitely exists.

Can anyone help?

Cheers, Sam

When I type catkin_make I get error:

The build space at '/home/sam/ws_moveit/build' was previously built by 'catkin build'. Please remove the build space or pick a different build space.
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-06-13 08:27:18 -0500

gvdhoorn gravatar image

updated 2019-06-13 09:00:59 -0500

Before you can use xacro to convert the .xacro, you must build the workspace, as the .xacro refers to ROS package resources that can only be found when you have an active workspace.

So the steps would become (adjust where necessary of course):

mkdir -p ~/ws_moveit/src
cd ~/ws_moveit/src
# copy / clone / download the files here
cd ~/ws_moveit

At this point you'll need to make sure you install all required dependencies for the packages you just copied/cloned/downloaded. See the answer to #q252478 for an example workflow.

Then build the workspace:

source /opt/ros/melodic/setup.bash
# or catkin build if you've used that before
catkin_make
source ~/ws_moveit/devel/setup.bash

at this point only your workspace is activated and you can try converting the .xacro again.


Edit:

The build space at '/home/sam/ws_moveit/build' was previously built by 'catkin build'. Please remove the build space or pick a different build space.

Obviously if you used catkin build before then please keep using that. There is no requirement to use catkin_make per se.

As long as your workspace gets built, that's the important part.


Edit 2:

Then I attempt to run:

rosrun xacro xacro.py kr150_2.xacro > kr150_2.urdf

To receive the following error:

No such file or directory: kr150_2.xacro

Are you running this in the root of kuka_kr150_support, or in kuka_kr150_support/urdf?

Only the latter contains that file.

I'm assuming you are referring to these files.

Can you verify that you have those files in kuka_kr150_support/urdf?

edit flag offensive delete link more

Comments

Thanks for the advice, but when I do that your catkin_make step gives the error I have added to the question.

sw14928 gravatar image sw14928  ( 2019-06-13 08:35:01 -0500 )edit

PS: I'm actually not sure why you want to convert the .xacro to a .urdf, as almost all consumers of .urdf can process .xacro or the conversion step is part of loading the files to the parameter server.

gvdhoorn gravatar image gvdhoorn  ( 2019-06-13 08:53:04 -0500 )edit

Thanks again, I did not realise build was the same as make. The workspace was successfully created, but I am still receiving the same error

sw14928 gravatar image sw14928  ( 2019-06-13 08:56:54 -0500 )edit

Fantastic! Thanks ever so much for your help. It works!! I was running in the former, when I switched to the latter it worked! Best regards, Sam

sw14928 gravatar image sw14928  ( 2019-06-13 09:12:52 -0500 )edit
1

Could you please mark the question as answered by ticking the checkmark (✓) to the left of the answer if you feel it has been answered? Thanks.

gvdhoorn gravatar image gvdhoorn  ( 2019-06-13 09:14:59 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-06-13 07:59:40 -0500

Seen: 816 times

Last updated: Jun 13 '19