Waiting for service /gazebo/spawn_urdf_model - ros

I am following a tutorial to build a custom robot in Ros. I followed in detail this tutorial: https://www.youtube.com/watch?v=uvPFDQxfm2w&t=70s
I am trying to make my robot called "mrm" spawn in gazebo.
When I launch this spawn.launch file:
<?xml version="1.0" ?>
<launch>
<param name="robot_description" command="$(find xacro)/xacro --inorder '$(find mrm_description)/urdf/mrm.xacro'"/>
<arg name="x" default="0"/>
<arg name="y" default="0"/>
<arg name="z" default="0.5"/>
<node name="mybot_spawn" pkg="gazebo_ros" type="spawn_model" output="screen"
args="-param robot_description -urdf -model mrm -x $(arg x) -y $(arg y) -z $(arg z)"/>
</launch>
No error messages are appearing but everything is stuck: the robot doesn't appear and Gazebo is not open. I can only see this message in the terminal:
SUMMARY
========
PARAMETERS
* /robot_description: <?xml version="1....
* /rosdistro: noetic
* /rosversion: 1.15.15
NODES
/
mybot_spawn (gazebo_ros/spawn_model)
auto-starting new master
process[master]: started with pid [35299]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to e34362f0-8a2f-11ed-a9b7-ef7c5e0a5b08
process[rosout-1]: started with pid [35309]
started core service [/rosout]
process[mybot_spawn-2]: started with pid [35312]
[INFO] [1672617380.741138]: Loading model XML from ros parameter robot_description
[INFO] [1672617380.745654]: Waiting for service /gazebo/spawn_urdf_model
It appears it is searching for the model of the robot as reported by:
https://answers.ros.org/question/383910/generic-question-about-the-error-waiting-for-service-gazebospawn_urdf_model/
I found an old similar question:
Error: gazebo_ros_control plugin is waiting for model URDF in parameter
But I do not think it fits my case.
I tried to create a new simplified model and launched it in a different workspace where I am already working with Franka model in gazebo but when I launch my custom robot the same issue appears.
If someone has some hints about how to solve this problem I would be very grateful.
Lorenzo

Related

Set Mavsys Configuration in Roslaunch File

How do you set mavsys in the ros launch file? I want to update the mavros data rate on start up.
Normally l use this terminal command: rosrun mavros mavsys rate --all 10.
My launch file:
<launch>
<include file="$(find mavros)/launch/apm.launch" />
</launch>
Thank you for the help.

Creating a roslaunch file that includes nodes from several packages

In my Ros Workspace (ws), there are 3 packages in src folder. And in each package, there is a node (contained in scripts folder) which is written using python. I need to write a roslaunch file that runs all 3 nodes at once.
Folder structure
ws
-src
-pkg1
-scripts/node1.py
-pkg2
-scripts/node2.py
-pkg3
-scripts/node3.py
-launch *#I want to keep the launch file in here.*
Can someone help me or point me out on how to write the launch file combining multiple packages?
Roslaunch makes this fairly easy as it includes a tag for what package to launch a node from. Take the following example:
<launch>
<node pkg="pkg1" type="node1.py" name="node1">
<param name="some_param1" value="value1">
</node>
<node pkg="pkg2" type="node2.py" name="node2">
<param name="some_param2" value="value2">
</node>
</launch>
I think this could work for you. (assuming you are not using ROS2)
<?xml version="1.0"?>
<launch>
<node pkg="pkg1" type="node1.py" name="node1">
</node>
<node pkg="pkg2" type="node2.py" name="node2">
</node>
<node pkg="pkg3" type="node3.py" name="node3">
</node>
</launch>
If I remember correctly, the launch file can start any node, independent of packages. I usually create an additional package (and name it for example startup) and use it simply for my launch files.
This reference should have everything documented that you need. You'll find the details to launch a node here.

Why gmapping package is not run in multiple robot in real robot (not simulation)?

I have run this command from raspberry pi of the robot tb3_0 to run the /tb3_0/turtlebot3_core node
pi#raspberrypi:~ $ ROS_NAMESPACE=tb3_0 roslaunch turtlebot3_bringup turtlebot3_robot.launch
And then I run gmapping package for tb3_0 robot in the pc terminal
amirul#nmy-lab:~$ ROS_NAMESPACE=tb3_0 roslaunch turtlebot3_slam turtlebot3_gmapping.launch set_base_frame:=tb3_0/base_footprint set_odom_frame:=tb3_0/odom set_map_frame:=tb3_0/map
But the gmapping package show a warning message
[ WARN] [1635496431.864557793]: MessageFilter [target=odom ]: Dropped 100.00% of messages so far. Please turn the [ros.gmapping.message_notifier] rosconsole logger to DEBUG for more information.
What I think is I didnt publish the robot_state_publisher node to the /tb3_0/gmapping node. How can I run the robot_state_publisher node in the tb3_0 ROSNAMESPACE? Thank you!
This is the rqt_graph of the running node
It depends on how you're launching robot_state_publisher. If using a launch file you can use the ns attribute to apply a namespace to the node. However, if you want to publish a namespaced transform you should use the tf_prefix param. Take the following example
<node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher">
<param name="publish_frequency" value="50.0"/>
<param name="tf_prefix" value="tb3_0" />
</node>

What is the meaning of this line in the launch file (ROS)

what this line means? And could explain it? Thanks!
<arg unless="$(arg debug)" name="launch-prefix" value=" "/>
<arg if="$(arg debug)" name="launch-prefix" value="gdb -ex run --args"/>
If you pass the argument debug to your launch file roslaunch test.launch debug:=true within your launch file $(launch-prefix) will evaluate to gdb -ex run --args,
otherwise it gets a string with one space inside " ".
I'll break down these two lines and explain every part of it.
Where to find the sources of my answers?
A launch file in general will launch nodes thats defined in it. It includes other launch files to start a specific part of the system. If you need more information you can check out this source: http://wiki.ros.org/roslaunch/XML Here you find a decent explanation about all possibilities in launch files.
What is the <arg /> tag in ROS launch files for?
For a better reusablility of launch files you can react to command line parameters, which are passed from command line while running roslaunch.
For example:
example_launch_file.launch
<launch>
<arg name="test" />
<node name="[NODE_NAME]" pkg="[PACKAGE_NAME]" type="[EXECUTABLE_NAME]">
<param name="test_arg_in_node" value="$(arg test)" />
</node>
</launch>
This example launch file will take a test argument and passes this argument into parameters for the example node.
If you have created the launch file above, you are able to run roslaunch and pass the parameter. Run the following command:
roslaunch example_launch_file.launch test:=TestArgumentValue
Thus within the node a parameter named test_arg_in_node is valued with TestArgumentValue
First line
<arg unless="$(arg debug)" name="launch-prefix" value=" "/>
unless is the only attribute which is not mentioned above. This attribute declares the argument as conditioned. So if you pass debug as true or 1 the argument launch-prefix will be NOT set.
Otherwise if debug is false or 0, launch-prefix evaluates to " ".
My source for this part of the answer is this page http://wiki.ros.org/roslaunch/XML again and especially chapter 3. if and unless attributes
Second line
<arg if="$(arg debug)" name="launch-prefix" value="gdb -ex run --args"/>
if is opposite to unless which means that if $(arg debug) is true or 1, argument launch-prefix will BE set to "gdb -ex run --args".
Additional information
Both if and unless expecting one value of this set [true, 1, false, 0] all other values will lead to an error. This is mentioned on this page as well: http://wiki.ros.org/roslaunch/XML
This line gdb -ex run --args will bring up the c++ debugging tool gdb if you pass it to a node. In my view this is a topic of its own but in the following link you will get a good starting point:
http://wiki.ros.org/roslaunch/Tutorials/Roslaunch%20Nodes%20in%20Valgrind%20or%20GDB
https://www.gnu.org/software/gdb/

Reading a ditamap in ant xslt task

I'm trying to read ditamap file from my XSLT stylesheet processing using fn:doc() function. But ant fails because DTD public identifier cannot be resolved even if there is catalog file specified.
[ditamap: mKeyDefUi.ditamap]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd">
<map>
<keydef keys="UI_Action">
<topicmeta>
<keywords>
<keyword>処理</keyword>
</keywords>
</topicmeta>
</keydef>
<keydef keys="UI_ActionAfterPrinting">
<topicmeta>
<keywords>
<keyword>印刷終了時の設定</keyword>
</keywords>
</topicmeta>
</keydef>
...
</map>
[ant buld.xml main part]
<property name="key.map.url" value="file:/D:/SVN/acme-dev/VisualWorks/ja-JP/keydef-map/mKeyDefUi.ditamap"/>
<property name="dita.catalog.file" value="/D:/DITA-OT/dita-ot-2.5.2/catalog-dita.xml"/>
...
<!-- Main target -->
<target name="uicontrol.conv">
<echo message="topic.file.prop=${topic.file.prop}"/>
<antcall target="uicontrol.conv.impl">
<param name="prmTopicFileProp" value="${topic.file.prop}"/>
<param name="prmOutputDirUrl" value="${output.dir.url}"/>
<param name="prmKeyMapUrl" value="${key.map.url}"/>
<param name="prmLogFileUrl" value="${log.file.url}"/>
</antcall>
</target>
<target name="uicontrol.conv.impl">
<property name="dummy.input" value="${basedir}/dummy-in.xml"/>
<property name="dummy.output" value="${basedir}/dummy-out.xml"/>
<property name="xsl.file" value="${basedir}/xsl/convUicontrol.xsl"/>
<xslt processor="trax" in="${dummy.input}" out="${dummy.output}" style="${xsl.file}" force="true">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
<param name="PRM_TOPIC_FILE_PROP" expression="${prmTopicFileProp}"/>
<param name="PRM_OUTPUT_DIR_URL" expression="${prmOutputDirUrl}"/>
<param name="PRM_KEY_MAP_URL" expression="${prmKeyMapUrl}"/>
<param name="PRM_LOG_FILE_URL" expression="${prmLogFileUrl}"/>
<xmlcatalog>
<catalogpath>
<pathelement location="${dita.catalog.file}"/>
</catalogpath>
</xmlcatalog>
</xslt>
</target>
[The ant log]
Executing:
"c:\program files\oxygen xml editor 19\jre/bin/java" -Xmx256m -classpath "C:\Program Files\Oxygen XML Editor 19\tools\ant/lib/ant-launcher.jar" "-Dant.home=C:\Program Files\Oxygen XML Editor 19\tools\ant" org.apache.tools.ant.launch.Launcher -lib "D:\My_Documents\Java\SaxonPE9-8-0-3J\saxon9pe.jar" -lib "D:\My_Documents\Java\xml-commons-resolver-1.2\resolver.jar" -lib "D:\My_Documents\Java\xml-commons-external-1.4.01\xml-apis.jar" -lib "D:\My_Documents\Java\xml-commons-external-1.4.01\xml-apis-ext.jar" -f "build.xml" "-Dwebhelp.trial.license=no" -v -d
Apache Ant(TM) version 1.9.8 compiled on December 25 2016
Buildfile: D:\SVN\acme\key\uicontrol-conv\build.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.8 in: c:\program files\oxygen xml editor 19\jre
Detected OS: Windows 8.1
...
uicontrol.conv.impl:
Setting project property: dummy.input -> D:\SVN\acme\key\uicontrol-conv/dummy-in.xml
Setting project property: dummy.output -> D:\SVN\acme\key\uicontrol-conv/dummy-out.xml
Setting project property: xsl.file -> D:\SVN\acme\key\uicontrol-conv/xsl/convUicontrol.xsl
[xslt] Using class org.apache.tools.ant.taskdefs.optional.TraXLiaison
[xslt] In file D:\SVN\acme\key\uicontrol-conv\dummy-in.xml time: 1504138459522
[xslt] Out file D:\SVN\acme\key\uicontrol-conv\dummy-out.xml time: 0
[xslt] Style file D:\SVN\acme\key\uicontrol-conv/xsl/convUicontrol.xsl time: 1504138455268
[xslt] Processing D:\SVN\acme\key\uicontrol-conv\dummy-in.xml to D:\SVN\acme\key\uicontrol-conv\dummy-out.xml
[xslt] Loading stylesheet D:\SVN\acme\key\uicontrol-conv\xsl\convUicontrol.xsl
java.lang.NoSuchFieldException: _isNotSecureProcessing
resolve: 'util_string.xsl' with base: 'file:/D:/SVN/acme/key/uicontrol-conv/xsl/convUicontrol.xsl'
Class org.apache.tools.ant.types.resolver.ApacheCatalogResolver loaded from parent loader (parentFirst)
Apache resolver library found, xml-commons resolver will be used
Using catalogpath 'D:\DITA-OT\dita-ot-2.5.2\catalog-dita.xml'
Parsing D:\DITA-OT\dita-ot-2.5.2\catalog-dita.xml
resolve: 'file:/D:/SVN/acme-dev/VisualWorks/ja-JP/keydef-map/mKeyDefUi.ditamap' with base: 'file:/D:/SVN/acme/key/uicontrol-conv/xsl/convUicontrol.xsl'
resolveEntity: '-//OASIS//DTD DITA Map//EN': 'file:/D:/SVN/acme-dev/VisualWorks/ja-JP/keydef-map/map.dtd'
No matching catalog entry found, parser will use: 'file:/D:/SVN/acme-dev/VisualWorks/ja-JP/keydef-map/map.dtd'
[xslt] D:\SVN\acme\key\uicontrol-conv\xsl\convUicontrol.xsl:17:4: Fatal Error! I/O error reported by XML parser processing file:/D:/SVN/acme-dev/VisualWorks/ja-JP/keydef-map/mKeyDefUi.ditamap: D:\SVN\acme-dev\VisualWorks\ja-JP\keydef-map\map.dtd (Specified file does not found.) Cause: java.io.FileNotFoundException: D:\SVN\acme-dev\VisualWorks\ja-JP\keydef-map\map.dtd (Specified file does not found.)
[xslt] Failed to process D:\SVN\acme\key\uicontrol-conv\dummy-in.xml
[antcall] Exiting D:\SVN\acme\key\uicontrol-conv\build.xml.
BUILD FAILED
D:\SVN\acme\key\uicontrol-conv\build.xml:20: The following error occurred while executing this line:
D:\SVN\acme\key\uicontrol-conv\build.xml:32: Fatal error during transformation using D:\SVN\acme\key\uicontrol-conv\xsl\convUicontrol.xsl: I/O error reported by XML parser processing file:/D:/SVN/acme-dev/VisualWorks/ja-JP/keydef-map/mKeyDefUi.ditamap: D:\SVN\acme-dev\VisualWorks\ja-JP\keydef-map\map.dtd (Specified file does not found.); SystemID: file:/D:/SVN/acme/key/uicontrol-conv/xsl/convUicontrol.xsl; Line#: 17; Column#: 4
The xslt task loaded the newest DITA-OT catalog file. But public identifier '-//OASIS//DTD DITA Map//EN' was not resolved.
What is wrong with my build.xml?
You should also try to add a classpath reference to the Xerces library "xercesImpl.jar".
Also this error line in your console output:
java.lang.NoSuchFieldException: _isNotSecureProcessing
would seem to indicate that there is an attempt to use the Xalan TransformerFactoryImpl.

Resources