When doing roslaunch <pkg> <file>.launch I want all nodes that are launched inside that file to only start if they're not running yet.
How do I do this?
If it's not possible, is it at least possible to do this for each node separately?
If someone has an idea it would be great if you added that code to my example .launch snippet below.
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<node pkg="rviz" type="rviz" name="rviz" />
</launch>
Unfortunately, this is not possible as discussed here.
roslaunch and rosrun will always run the node with the desired name which results in the fact, that the roscore will kill living nodes with the same name.
You can use the anon tag to run multiple instances with always varying names as explained here.
The only exception to this behavior is the roscore.xml and its nodes as explained here.
The only current workaround, from my point of view, is writing a script which checks via rosnode list if the desired node is already running and depending on the outcome, run your node or not.
Using <arg> tag in launch files that are connected through <include> tag, you can set up variables in top launch file and send to other included launch files. Then, using <if> and <unless>, you can start a node or leave it. You can find it's documentation in ROS_Wiki.
In multiple independent launch files, things are a little different since you don't have link between launch files. You can use environment variables to replicate the results .
you can check with the if tag and an eval statement:
if="$(eval not [s for s in eval('_' + '_import_' + '_(\'rosnode\')').get_node_names() if 'NODE_NAME' in s])"
i.e.:
<launch>
<node pkg="rviz" type="rviz" name="rviz"
if="$(eval not [s for s in eval('_' + '_import_' + '_(\'rosnode\')').get_node_names() if 'rviz' in s])"/>
</launch>
Related
I've used the performance analysis tool in Saxon (https://www.saxonica.com/documentation11/index.html#!using-xsl/performanceanalysis) to analyze stylesheets, and it's quite useful. I'd like to do the analysis from within eXist-db rather than the command line. For one, the performance could be different. But mainly because some stylesheets open documents in exist-db, and I can't run these from the command line. Is there a way to configure Saxon to output the profile.html document when it's run via eXist-db?
I was hoping there would be an attribute in conf.xml , or attributes that could be sent via transform:transform(), but I don't see any options related to the performance analysis tool.
I can't be certain this will work, but it's worth a try.
The $attributes parameter of Exist-db's transform() method allows you to set Saxon configuration properties. The available properties are listed at https://www.saxonica.com/documentation11/index.html#!configuration/config-features . You could try setting the properties TRACE_LISTENER_CLASS (to "net.sf.saxon.trace.TimingTraceListener") and TRACE_LISTENER_OUTPUT_FILE (to the required "profile.html" output file).
Incidentally, note that the performance is going to be different when you run with a trace listener. The profile generated using -TP is useful because it tells you which templates and functions are accounting for the most time and therefore need attention; the absolute numbers are not important or accurate. The hot spots will almost certainly be the same whether you are running within eXist or from the command line.
I can confirm this did work. Here's the XQL I used:
let $params :=
<parameters>
</parameters>
let $attributes :=
<attributes>
<attr name="http://saxon.sf.net/feature/traceListenerClass" value="net.sf.saxon.trace.TimingTraceListener"/>
<attr name="http://saxon.sf.net/feature/traceListenerOutputFile" value="/tmp/profile.html"/>
</attributes>
let $serialization := 'method=html5 media-type=text/html indent=no'
return transform:transform($xml, $xsl, $params, $attributes, $serialization)
if __name__ == '__main__':
rospy.init_node('ardrone_action_server')
ArdroneAS()
rospy.spin()
I have initialized the node with rospy but should I name the node identical with the name in python script?
Below is the launch file:
<launch>
<node name="ardrone_as" pkg="ardrone_as" type="action_server.py" output="screen">
</node>
Only the node name is showing in the launch file when running. Why is that?
This is the common behavior of setting the node name in a launch files. It remaps (overrides) the node name which is defined in code. You can find the specification of this at chapter 5 of the ROS node documentation:
__name is a special reserved keyword for "the name of the node." It lets you remap the node name without having to know its
actual name. It can only be used if the program that is being launched
contains one node.
We upgraded from Jenkins 1.609 to 2.106. When we do a release we want to start a job build number with 1 (Number of builds since the start of the project). We were doing this using a ant script to update the config.xml file, but it does not work in Jenkins 2. The XML file layout has changed some since v 1.0.
While I am think that I no longer want to do a 'replace' (because there is nothing to replace, and I have tried multiple variations of this), I am not sure of the syntax and arguments that I want to use here, to place a value '1' here. I think that I should be using Insert, but with what arguments.
This is the ant code...
<target name="replace.builds.all.time">
<copy file="${BuildConfigPath}" tofile="${BuildConfigPath}.bak" overwrite="true" force="true" />
<xmltask source="${BuildConfigPath}" dest="${BuildConfigPath}">
<replace path="/project/buildWrappers/org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder/versionNumberString/text()" withText="${VersionNumberString}"/>
<replace path="/project/buildWrappers/org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder/oBuildsAllTime/text()" withText="${BuildsAllTime}"/>
</xmltask>
</target>
The second 'replace' line, is where the problem is.
The 1.0 config.xml code looked like this. You can see that oBuildsAllTime had an actual value...
<buildWrappers>
<org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder plugin="versionnumber#1.4.1">
<versionNumberString>${VERSION_NUMBER}</versionNumberString>
<projectStartDate>1969-12-31 05:00:00.0 UTC</projectStartDate>
<environmentVariableName>VERSION_NUMBER</environmentVariableName>
<oBuildsToday>-1</oBuildsToday>
<oBuildsThisMonth>-1</oBuildsThisMonth>
<oBuildsThisYear>-1</oBuildsThisYear>
<oBuildsAllTime>-1</oBuildsAllTime>
<skipFailedBuilds>false</skipFailedBuilds>
<useAsBuildDisplayName>true</useAsBuildDisplayName>
</org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder>
<EnvInjectPasswordWrapper plugin="envinject#1.92.1">
<injectGlobalPasswords>true</injectGlobalPasswords>
<maskPasswordParameters>false</maskPasswordParameters>
<passwordEntries/>
</EnvInjectPasswordWrapper>
</buildWrappers>
The 2.0 config.xml is different in that there is no value for 0BuildsAllTime...
<buildWrappers>
<hudson.plugins.timestamper.TimestamperBuildWrapper plugin="timestamper#1.8.9"/>
<org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder plugin="versionnumber#1.9">
<versionNumberString>10.1.09.${BUILDS_ALL_TIME}</versionNumberString>
<projectStartDate>1969-12-31 05:00:00.0 UTC</projectStartDate>
<environmentVariableName>VERSION_NUMBER</environmentVariableName>
<environmentPrefixVariable/>
<oBuildsToday/>
<oBuildsThisWeek/>
<oBuildsThisMonth/>
<oBuildsThisYear/>
<oBuildsAllTime/>
<worstResultForIncrement>SUCCESS</worstResultForIncrement>
<skipFailedBuilds>false</skipFailedBuilds>
<useAsBuildDisplayName>true</useAsBuildDisplayName>
</org.jvnet.hudson.tools.versionnumber.VersionNumberBuilder>
</buildWrappers>
I want to be able to insert the new build number into the config.xml file, using ant code.
I am writing an Ant script where I want to forcefully sync the client workspace from depot. Below is the code snippet that I am using, but I am not able to figure it out , how to use the flag -f in the xml. Can some please help me?
<target name="sync_head_sql" description="Sync the workspace with head sql">
<taskdef name="p4sync" classname="com.perforce.p4java.ant.tasks.SyncTask" classpathref="p4_classpath"/>
<p4sync
files="//pay_import2/pay/wup2-parent/WU_DEV_ABCD_JBOSS62_V2_594_3/data- engine/conf/..."
user="abcd"
port="xx.xx.xx.xx:1669"
client="wp-nagiosmon">
</p4sync>
</target>
The code mentioned above is able to sync the code successfully, but wants to know about the option of force sync. If i want to add in the above code, then how to do that? Where should i use the -f flag?
Thanks,
Faraz
You can add the force flag into your p4sync tag like this:
<p4sync
files="//pay_import2/pay/wup2-parent/WU_DEV_ABCD_JBOSS62_V2_594_3/data- engine/conf/..."
force="true"
user="abcd"
port="xx.xx.xx.xx:1669"
client="wp-nagiosmon">
I'm try to develop a cruise control step which will process database migration scripts and apply them.
I'd like to be able to get hold of a list of the modifications from the SourceControl (to see if any new database changes need to be applied).
Any ideas how I can achieve this? I know that this information is written into the log xml but I was wondering if there is an easy mechanism to get a reference to this from with an Ant builder.
I have investigated writing a custom CC Listener or Builder plugin but neither supply this in the interface.
We have "svn update" as one of the steps in ant builder, and later we use output redirected to the file (ant property also could be used):
<exec executable="svn" dir=".">
<arg line="up"/>
<redirector output="svnup.log" alwayslog="true" append="true"/>
</exec>
<property name="svnup.log" value="svnup.log"/>
this creates file named "svnup.log" in the build folder with output of "svn up" command.
I think I'm going to try to write a custom plugin implementing Publisher
#Override
public void publish(Element cruisecontrolLog) throws CruiseControlException { XMLLogHelper xmlHelper = new XMLLogHelper(cruisecontrolLog);
Set<Modification> modifications = xmlHelper.getModifications();
for (Modification modification : modifications) {
handleModification(modification);
}
}
Or another idea is to use the timestamp flag in the sscm ant task combined with the cclastbuildtimestamp property supplied to the ant builder to produce a list of files changed since last build.