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

Damon's profile - activity

2022-12-02 09:45:42 -0500 received badge  Taxonomist
2018-08-24 06:23:35 -0500 marked best answer Problem in adding two Schunk arms plus a simple shape (e.g. cylinder) into .urdf.xacro

Dear Friends, First of all, I apologize if my question may look trivial. I am new with ROS. Here is the problem: The aim is to have two Schunk arms mounted on a simple box. We have a robot.urdf.xacro file. This file "includes" the model of the arm:

<xacro:include filename="$(find schunk_description)/urdf/lwa4d/lwa4d.urdf.xacro" />

And uses it twice to have two arms:

<!-- arm -->
<xacro:schunk_lwa4d name="arm" parent="world" has_podest="true">
 <origin xyz="0 0 0.026" rpy="0 0 0" />
</xacro:schunk_lwa4d>

 <!-- arm2 -->
<xacro:schunk_lwa4d name="arm2" parent="world" has_podest="true">
 <origin xyz="0.5 0.5 0.526" rpy="0 0 0" />
</xacro:schunk_lwa4d>

And then when I spawn the xacro file in launch file, 2 arms are loaded in Gazebo. Till here seems fine! But adding a simple shape to this set was/is a pain for me. I define a ros package, called myschunk_gazebo. Then I try to include one simple .xacro file including only a box (or cylinder) in myschunk_gazebo/models and I call the file simple_shape.xacro. I know that ROS can locate the package. I check it with rospack:

ros@ros:~/Documents/Damon_CPP/ROS_Workspace/devel$ rospack find myschunk_gazebo
/home/ros/Documents/Damon_CPP/ROS_Workspace/src/myschunk_gazebo

But from here the problem starts! Well, as I know, even this simple shape is called a "robot". So I write simple_shape.xacro. like:

<?xml version="1.0"?>
<robot name="myfirst">
  <link name="base_link">
    <visual>
      <geometry>
    <cylinder length="0.6" radius="0.2"/>
      </geometry>
    </visual>
  </link>
</robot>

When I launch the file, only the empty space is loaded in gazebo. And between many messages, I thought this might be useful to be put in here:

Failed to find root link: Two root links found: [base_link] and [world]

I guess I know what is going on. We should have only one <robot>, which I have in my urdf.xacro file that I spawn in my launch file. But what I do when I include simple_shape.xacro is that I have two <robot> s. And hence, two root links.

I remove the lines related to robot and change simple_shape.xacro to:

<?xml version="1.0"?>
  <link name="base_link">
    <visual>
      <geometry>
    <cylinder length="0.6" radius="0.2"/>
      </geometry>
    </visual>
  </link>

I also include base_link in my robot.urdf.xacro file:

<link name="base_link"/>

And loads only empty space. I don't think the inclusion of the file should be a problem. But I highly doubt if I use the shape in robot.urdf.xacro properly, or my codes for generating the shape are correct.

It would be so nice if a friend can clarify for me what is going on. Thanks. :)

2017-11-12 01:02:54 -0500 received badge  Stellar Question (source)
2017-10-24 01:47:48 -0500 marked best answer Problem in creating .urdf files

Hello everyone. I want to create .urdf file from the file lwa.urdf.xacro. My OS is Ubuntu 14.04 and ROS distribution is indigo.

In the folder: opt/ros/indigo/stacks/schunk_description/urdf/lwa

There are 3 files:

  • lwa.gazebo.xacro
  • lwa.transmission.xacro
  • lwa.urdf.xacro

In terminal, I direct to this directory and command:

ros@ros:~$ rosrun xacro xacro.py lwa.urdf.xacro > lwa.urdf

ros@ros:/opt/ros/indigo/stacks/schunk_modular_robotics/schunk_description/urdf/lwa$ rosrun xacro xacro.py lwa.urdf.xacro > lwa.urdf
bash: lwa.urdf: Permission denied

I know that my question might be somehow silly. I am sorry but it probably refers to my lack of proper knowledge, esp. with Linux. I just guess it must have something to do with permissions. I would appreciate if someone help me or share his/her experience in creating .urdf files with me.

Thanks a lot,

Damon

P.S. Why do I need .urdf file? Gazebo works with .xacro files smoothly and I already can load the robot in gazebo or send the commands to it. The point is that I want to use Moveit! Moveit has an "assistant" which helps you make Moveit recognize your robot. When I load xacro file of PR2 robot in Moveit, the assistant works fine and seemingly creates a .urdf file for itself. But this doesn't work when I load xacro file of schunk. And the reason is that Moveit tries to build .urdf file and fails. This makes me feel if I want moveit work, I should first be able to create .urdf files.


Edit:

First of all, thanks for your time and attention. :) xacro has been introduced to replace urdf. Basically we should be able to create urdf from xacro. My schunk package (schunk_description) is in: opt/ros/indigo/stacks/schunk_modular_robotics

I thought if the problem is permissions, what if I try to make a copy of the package somewhere else and try again. So I copied the package to /Documents. And:

ros@ros:~$ cd Documents

ros@ros:~/Documents$ cd schunk_modular_robotics/schunk_description/urdf/lwa

ros@ros:~/Documents/schunk_modular_robotics/schunk_description/urdf/lwa$ rosrun xacro xacro.py lwa.urdf.xacro > lwa.urdf

This created an empty .urdf file. Here is the contents:

<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- |    This document was autogenerated by xacro from lwa.urdf.xacro                 | -->
<!-- |    EDITING THIS FILE BY HAND IS NOT RECOMMENDED                                 | -->
<!-- =================================================================================== -->
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
</robot>

Moveit used to use .urdf file. But recently, they say the user can also browse to .xacro file as well. I think this is exactly what Moveit tries to do automatically, and probably the urdf file is also created. But since it is empty, Moveit fails. Here is when I try to browse the lwa.urdf.xacro file in Moveit:

An error message shown by setup assistant in a small window: "URDF/COLLADA file is not a valid robot model."

And when I look at the terminal, I see this:

[rospack] Error: no package given
[librospack ...
(more)
2017-04-21 06:37:52 -0500 received badge  Great Question (source)
2016-07-11 13:55:19 -0500 received badge  Favorite Question (source)
2016-06-17 04:15:20 -0500 marked best answer Gazebo controller spawner warning

Hi everyone. I have a problem and I hope you can help me. :)

I have a robot: Two Schunk lwa4d arms mounted on a box.

I can load this robot in gazebo.

I can load this robot in moveit + rviz and plan path for it.

But the problem is making connection between these two. So far, I am unable of doing so. I know that in both sides, gazebo and moveit, i need to have some modifications. But my major suspicion is a warning message that I receive when launching my robot in gazebo, where it warns:

[WARN] [WallTime: 1438070984.731293] [4.961000] Controller Spawner couldn't find the expected controller_manager ROS interface.

[WARN] [WallTime: 1438070984.740924] [4.954000] Controller Spawner couldn't find the expected controller_manager ROS interface.

I know it has something to do with controller_manager. In my launch file, I have:

<!-- controllers -->
<rosparam file="$(find schunk_lwa4d)/config/TwoArm/TwoArm_arm_controller_v2.yaml" command="load"/>
<rosparam file="$(find schunk_lwa4d)/config/joint_state_controller.yaml" command="load"/>
<!-- start_controllers -->
<node name="joint_state_controller_spawner" pkg="controller_manager" type="spawner" args="joint_state_controller" respawn="false" />
<node name="arm_controller_spawner" pkg="controller_manager" type="spawner" args="arm_controller" />

What I know for now is that each warning is related to one control spawning. My file, joint_state_controller.yaml is very small:

joint_state_controller:
type: joint_state_controller/JointStateController
publish_rate: 50

ROS is able to locate it. So the problem shouldn't be finding the file. But in spawning it using controller spawner, something is going wrong.

I tried to copy-paste the other file, TwoArm_arm_controller_v2.yaml, here too. But I couldn't format it in a good way to be easily readable. But the basic structure is something like:

## joint_names
joint_names: [arm1_1_joint, arm1_2_joint, arm1_3_joint, arm1_4_joint, arm1_5_joint, arm1_6_joint, arm1_7_joint, arm2_1_joint, arm2_2_joint, arm2_3_joint, arm2_4_joint, arm2_5_joint, arm2_6_joint, arm2_7_joint]
## joint trajectory controller
arm_controller:
  type: position_controllers/JointTrajectoryController
  joints:
    - arm1_1_joint
    ...
    - arm1_7_joint
    - arm2_1_joint
    ...
    - arm2_7_joint

  constraints:
    goal_time: 0.6
    stopped_velocity_tolerance: 0.05
    arm1_1_joint: {trajectory: 0.1, goal: 0.1}
    ...
    arm2_7_joint: {trajectory: 0.1, goal: 0.1}
  stop_trajectory_duration: 0.5
  state_publish_rate:  25
  action_monitor_rate: 10

What I could find by now is that there may be two reasons for this warning:

  • controller manager not running.
  • not launching the spawned script in the same namespace as the controller manager.

But honestly, I don't know how to move forward from this point. I know that controller_manager has been installed:

ros@ros:~/Documents/Damon_CPP/ROS_Workspace/devel$ rospack find controller_manager

/opt/ros/indigo/share/controller_manager

Unfortunately I don't know how to remove the warnings. I have the feeling that if Moveit can't communicate with gazebo, this warning can be a reason. Any help is highly appreciated. :)

UPDATE:

After launching my robot in gazebo, I tried this command:

ros@ros:~$ rosrun controller_manager controller_manager list

Nothing appears. The terminal goes frozen. I asked the same thing from my friend whose robot (2 U10 arms on a box) is loaded and controlled properly by moveit. Here is his result:

merosy@MeRoSy-1:~$ rosrun controller_manager controller_manager list joint_state_controller - hardware_interface::JointStateInterface ( running )

arm_controller - hardware_interface::PositionJointInterface ( running )

Seemingly my controller_manager is not working properly. Any suggestion ... (more)