Set Mavsys Configuration in Roslaunch File - ros

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.

Related

Waiting for service /gazebo/spawn_urdf_model

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

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/

Process leaked file descriptors jenkins ERROR on Jenkins

Can someone help me to solve an issue "process leaked file descriptors jenkins"?
I tried whit BUIL_ID = dontkillme but it doesnt work.
Thx
It would help to know more about what you're trying to run but this question came up as a result of troubleshooting an issue I was having so here's how I resolved it. I am using Windows so if you're using something else it may not work for you.
First of all you need to read and understand the Jenkins documentation on the issue: https://jenkins.io/redirect/troubleshooting/process-leaked-file-descriptors
I had to install Ant first since it was not installed.
https://ant.apache.org/bindownload.cgi
The Jenkins documentation gives you an example Ant script:
<exec executable="cscript.exe">
<env key="ANTRUN_TITLE" value="Title for Window" /> <!-- optional -->
<env key="ANTRUN_OUTPUT" value="output.log" /> <!-- optional -->
<arg value="//NoLogo" />
<arg value="antRunAsync.js" /> <!-- this script -->
<arg value="real executable" />
</exec>
You will change the "real executable" to be the executable you are wanting to run.
See that .js file in the 2nd arg value? You will need to create that. There's a link to this on the Jenkins documentation page too. Grab it here: https://wiki.jenkins.io/download/attachments/1835010/antRunAsync.js?version=1&modificationDate=1184046328000&api=v2
I didn't make any edits to the contents, just pasted it right in and saved it as antRunAsync.js
So now you take your Ant example script I posted above and throw that in a text editor, save as build.xml
From this point you should be able to test on the command line by typing ant and pressing enter. Your application should load in a different window.
If you haven't set up Ant in the Jenkins Global Tool Configuration do so now and point it to your Ant install (might have to uncheck the Install checkbox). In the Jenkins project add a build step Invoke Ant. Set that up how you like according to Ant documentation.
Hope this answer helps someone else who has stumbled across this problem and this question.

Resources