What is the meaning of this line in the launch file (ROS) - 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/

Related

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.

Running an OS command using apache-ant to IIS config

I'm trying to create an ANT script which amongst other things will configure IIS.
To do this, trying to harness the appcmd tool. However getting a strange error. The appcmd command runs fine outside of the ant script, but fails within.
I'm using the exec task to kick it all off :
<exec dir="C:\\Windows\\System32\\inetsrv\\"
executable="C:\\Windows\\System32\\inetsrv\\appcmd.exe" output="d:\out.txt">
<arg value="appcmd set config /section:isapiCgiRestriction /+"
[path='${appian_home}\\jakarta\\ISAPI\\isapi_redirect.dll',
description='Jakarta',allowed='True']"" />
</exec>
The output trapped via ANT is :
Object 'APPCMD SET CONFIG /SECTION:ISAPICGIRESTRICTION /+?
[PATH='D:\PTMP2\APPIAN17\\JAKARTA\\ISAPI\\ISAPI_REDIRECT.DLL',
DESCRIPTION='JAKARTA',ALLOWED='TRUE']' is not supported.
Run 'appcmd.exe /?' to display supported objects.
However when I run
If I c&p that command to the dos prompt it will happily run :
C:\Windows\System32\inetsrv>appcmd set config /section:isapiCgiRestriction
/+"[path='d:\ptmp2\appian17\\jakarta5\\ISAPI\\isapi_redirect.dll',descripti
on='Jakarta',allowed='True']"
Applied configuration changes to section
"system.webServer/security/isapiCgiRestriction" for
"MACHINE/WEBROOT/APPHOST" at configuration commit path "M
ACHINE/WEBROOT/APPHOST"
Needs to escaped single quote as well.
Also changed path separate to /
Use below:
<exec executable="cmd.exe" dir="C:/Windows/System32/inetsrv" failonerror="true">
<arg line="/c appcmd set config /section:isapiCgiRestriction /+"[path=&apos;${appian_home}/jakarta/ISAPI/isapi_redirect.dll&apos;,description=&apos;Jakarta&apos;,allowed=&apos;True&apos;]""/>
</exec>

JMeter overriding properties with spaces in non GUI mode with ANT

I need to pass parameter values to jmeter properties like this:
#echo off
cd E:\apache-jmeter-2.11\bin
jmeter.bat -n
-t E:\OMS.P01-AccountCreation.jmx
-l E:\result.csv
-j E:\jmeter.log
-Jthreadgroup.count=1
-JPRIMARY_STREET_NUMBER=1234
-JPRIMARY_STREET_NAME=DONALDTRUMP AVENUE
But this will fail as the name 'DONALDTRUMP AVENUE' has an space. It will try to read 'AVENUE' as a different parameter. Is there any way to make it read as a whole value? thanks
EDIT
It works if I add "" to enclose it. However, when I try the same thing with ANT, it throws the same error. Does anyone knows how can I solve it?
EDIT 2
I tried again with command line instead of ant. I think I found the problem. I cant add too many parameters (I'm adding like 22 parameters) I'm not sure if there is a parameter limit or if there is a length limit for the whole command line.
I don't know how you're passing properties to Ant but normally smart people don't have any problems with spaces in property values. Are you aware that:
Ant doesn't know anything regarding -J command line argument
Ant knows nothing about JMeter properties
So if you need to pass to JMeter something you can change via Ant command-line you need to do something like:
In build.xml
<target name="jmeter">
<jmeter
jmeterhome="/path/to/your/jmeter"
testplan ="OMS.P01-AccountCreation.jmx"
resultlog="result.jtl">
<property name="jmeter.save.saveservice.output_format" value="xml"/>
<property name="jmeter.save.saveservice.assertion_results" value="all"/>
<property name="jmeter.save.saveservice.bytes" value="true"/>
<property name="threadgroup.count" value="${threadgroup.count}"/>
<property name="PRIMARY_STREET_NUMBER" value="${PRIMARY_STREET_NUMBER}"/>
<property name="JPRIMARY_STREET_NAME" value="${PRIMARY_STREET_NAME}"/>
</jmeter>
</target>
When launching JMeter test via Ant:
ant -Dthreadgroup.count=1 -DPRIMARY_STREET_NUMBER=1234 -DPRIMARY_STREET_NAME="DONALDTRUMP AVENUE"
References:
Command prompt (Cmd. exe) command-line string limitation
Five Ways To Launch a JMeter Test without Using the JMeter GUI

Ant inline exec arguments

I have tasks running in Ant, which I'm quite new to, as part of a CI chain of build events. I used a tutorial to create the file for testing/linting/etc a PHP application.
The first important directives in the build.xml are:
<property name="phpmd" value="phpmd"/>
<property name="phpunit" value="phpunit"/>
This works fine as is, assuming that phpmd/phpunit are on the path, and using phpunit as a further example, is run under the following target:
<target name="phpunit" unless="phpunit.done" depends="prepare" description="Run unit tests with PHPUnit">
<exec executable="${phpunit}" resultproperty="result.phpunit" taskname="phpunit">
<arg value="--configuration"/>
<arg path="${basedir}/phpunit.xml"/>
</exec>
<property name="phpunit.done" value="true"/>
</target>
All this works well as is- but I want to use docker from now on, which I had hoped would simply mean changing <property name="phpunit" value="phpunit"/> to <property name="phpunit" value="docker-compose run php phpunit"/>, but this instead gives me the following error:
Execute failed: java.io.IOException: Cannot run program "docker-compose run -w /var/www/src php phpunit" (in directory "/var/lib/jenkins/jobs/Blah blah blah/workspace/src"): error=2, No such file or directory
I know that you would usually add additional <arg/> nodes to targets- but is it not possible at all to provide the full command with inline arguments on the initial <property>?
Ant is obviously complaining because, along with those inline arguments, that executable doesn't exist. Will I have to use arg nodes and update every single target?
Using docker-compose alone works fine, but I need the args for the correct container and working directory to be used- preferably inline, otherwise I have to insert many arg nodes.
In the end I just created a property for phpunit arguments and then added it by using the <args line="${phpunitArgs}">.
Definitely not ideal, but at least it does what it is supposed to. I certainly prefer using Gulp! XML feels like a bad choice for a build system.

Open quote is expected for attribute "executable" associated with an element type "exec"

I am trying to execute a cmd through my ant script. I am getting the following error:
build.xml:24: Open quote is expected for attribute "executable"
associated with an element type "exec".
These are lines 22 through 27. As you can see the line it is failing on - line 24 is the space above the exec cmd. I can't see where I forgot a quote and they look like the regular quotes to me. I checked the archives and I couldn't find anything similar.
<chmod file="/blddir/tools/gmake" perm="777"/>
<echo message="Starting"/>
<exec dir="/blddir/tools/" executable="gmake" vmlauncher="false" failonerror="true">
<arg line="-s"/>
</exec>
The error message means your build script is not valid, because of missing open quote for attribute executable in the exec task, please recheck for something like :
<exec dir="/blddir/tools/" executable=gmake" vmlauncher="false" failonerror="true">
<arg line="-s"/>
</exec>
or
<exec dir="/blddir/tools/" executable=gmake vmlauncher="false" failonerror="true">
<arg line="-s"/>
</exec>
whereas the snippet you posted seems alright !?
Some editor - f.e. Eclipse Ant editor - should point to the syntax error
I hit the same issue and it turned out that I copied the quotes into an editor from a website and the double quotation marks in the file were not the correct ones, they were the slated ones instead of the straight ones.
Opening the build.xml file in the NetBeans editor showed the problem clearly

Resources