Error converting xacro to urdf ROS Moveit!
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.
Asked by sw14928 on 2019-06-13 07:59:40 UTC
Answers
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
?
Asked by gvdhoorn on 2019-06-13 08:27:18 UTC
Comments
Thanks for the advice, but when I do that your catkin_make step gives the error I have added to the question.
Asked by sw14928 on 2019-06-13 08:35:01 UTC
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.
Asked by gvdhoorn on 2019-06-13 08:53:04 UTC
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
Asked by sw14928 on 2019-06-13 08:56:54 UTC
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
Asked by sw14928 on 2019-06-13 09:12:52 UTC
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.
Asked by gvdhoorn on 2019-06-13 09:14:59 UTC
Comments