Instead of running a package using command line, I made a launch file
Commande line:
rosrun image_view image_saver image:=/the-rgb-image-topic
Launch file:
<launch>
<node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="ROS_HOME">
<remap from="image" to="/camera/rgb/image_raw"/>
</node>
</launch>
Now I want to do the same for this:
rosrun image_view image_saver image:=/camera/depth/image _encoding:=16UC1
How can I add the argument to the launch file..
I think I should start it like that
<launch>
<node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="ROS_HOME">
<remap from="image" to="/camera/rgb/image_raw"/>
<node name="extract" pkg="image_view" type="extract_images" respawn="false" output="screen" cwd="ROS_HOME">
<remap from="image" to="/camera/depth/image"/>
</node>
</launch>
To pass arbitrary arguments to nodes in launch-files, you can use the args attribute of the node tag:
<node name="image_saver" pkg="image_view" type="image_saver" args="_encoding:=16UC1" ...>
However, in this specific case there is a better way: _encoding is not just some arbitrary argument but it is a parameter that is handled by the ROS Parameter Server. While it will probably work, using the args attribute, the nicer way is to use the param tag:
<node name="image_saver" pkg="image_view" type="image_saver">
<remap from="image" to="/camera/depth/image" />
<param name="encoding" value="16UC1" type="string" />
</node>
Related
I think I'm missing something as I can't seem to figure out how to have it write to a log file in json format using NLog setup in configuration file. The straight rolling file works fine, but not the json. The json target only outputs the message (not in json).
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets async="true">
<target xsi:type="File" name="rollingFile" fileName="${basedir}/logs/${shortdate}.log" archiveFileName="${basedir}/logs/{shortdate}_Archive{###}.log" archiveAboveSize="1000000" archiveNumbering="Sequence" layout="${longdate} ${uppercase:${level}} ${callsite} ${message}" />
<target xsi:type="File"
name="rollingFileJson"
fileName="${basedir}/logs/${shortdate}.json"
archiveFileName="${basedir}/logs/{shortdate}_Archive{###}.json"
archiveAboveSize="1000000"
archiveNumbering="Sequence"
layout="${json-encode} ${message}">
</target>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="rollingFile" />
<logger name="*" minlevel="Trace" writeTo="rollingFileJson" />
</rules>
</nlog>
As of the release of NLog 4.0.0 it is possible to use a layout that renders events as structured JSON documents.
Example taken from NLog project site:
<target name="jsonFile" xsi:type="File" fileName="${logFileNamePrefix}.json">
<layout xsi:type="JsonLayout">
<attribute name="time" layout="${longdate}" />
<attribute name="level" layout="${level:upperCase=true}"/>
<attribute name="message" layout="${message}" />
</layout>
</target>
Edit:
You can also create it in code.
Here is the link to the specific part of documentation.
And here the copied example:
var jsonLayout = new JsonLayout
{
Attributes =
{
new JsonAttribute("type", "${exception:format=Type}"),
new JsonAttribute("message", "${exception:format=Message}"),
new JsonAttribute("innerException", new JsonLayout
{
Attributes =
{
new JsonAttribute("type", "${exception:format=:innerFormat=Type:MaxInnerExceptionLevel=1:InnerExceptionSeparator=}"),
new JsonAttribute("message", "${exception:format=:innerFormat=Message:MaxInnerExceptionLevel=1:InnerExceptionSeparator=}"),
}
},
//don't escape layout
false)
}
};
For more info read the docs.
As per NLog documentation: json-encode will only escape output of another layout using JSON rules. It will not "convert" the output to JSON. You'll have to do that yourself.
'{ "date":"${longdate}","level":"${level}","message":${message}}'
Take a look at this question for more details.
I have made a small REST based webservice in Flask by reading http://blog.miguelgrinberg.com/post/designing-a-restful-api-with-python-and-flask and now I wanted to fuzz the JSON using Peach framework. I know it's uses a pit file(XML) for fuzzing but my small brain is not able to make the pit file that can serve my purpose. I googled a lot for peach pit file but all goes in vain.
I need a pit file or anyone can tell how to create a pit file for fuzzing payload.
There is a nice tutorial about peach available there.
Several elements need to be defined:
a data model describing the format of the data you want to send.
a state model describing the behavior of the fuzzer.
an agent runnning and monitoring the applications under fuzzing.
a test bringing all definitions together.
Here is an example of a Peach Pit file from the tutorial.
<Peach xmlns="http://peachfuzzer.com/2012/Peach" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://peachfuzzer.com/2012/Peach ../peach.xsd">
<DataModel name="DataHTER">
<String value="HTER " mutable="false" token="true"/>
<String value=""/>
<String value="\r\n" mutable="false" token="true"/>
</DataModel>
<StateModel name="StateHTER" initialState="Initial">
<State name="Initial">
<Action type="input" ><DataModel ref="DataResponse"/></Action>
<Action type="output"><DataModel ref="DataHTER"/></Action>
<Action type="input" ><DataModel ref="DataResponse"/></Action>
</State>
</StateModel>
<DataModel name="DataResponse">
<String value=""/>
</DataModel>
<Agent name="RemoteAgent" location="tcp://127.0.0.1:9001">
<!-- Run and attach windbg to a vulnerable server. -->
<Monitor class="WindowsDebugger">
<Param name="CommandLine" value="C:\Documents and Settings\Administrator\Desktop\vulnserver\vulnserver.exe"/>
<Param name="WinDbgPath" value="C:\Program Files\Debugging Tools for Windows (x86)" />
</Monitor>
</Agent>
<Test name="TestHTER">
<Agent ref="RemoteAgent"/>
<StateModel ref="StateHTER"/>
<Publisher class="TcpClient">
<Param name="Host" value="127.0.0.1"/>
<Param name="Port" value="9999"/>
</Publisher>
<Logger class="File">
<Param name="Path" value="Logs"/>
</Logger>
</Test>
If you want to use a JSON data model, you can follow the recommendation of one of the peach architect.
1)Define a data model corresponding to the JSON.
JSON Object
{
"name":"John Smith",
"address":{
"address1":"555 Main St.",
"city":"Seattle"
}
}
Data model
<DataModel>
<String name="name" value="John Smith" />
<Block name="address">
<String name="address1" value="555 Main St." />
<String name="city" value="Seattle" />
</Block>
</DataModel>
You then have to write your own custom publisher in C#. Here is a tutorial for this.
I would like to use a custom <iq> stanza with tsung (to test ejabberd).
Suppose my <iq> looks like this:
<iq type="get">
<query Xmlns="jabberd:test:sample">
<search term="l"></search>
</query>
</iq>
How would I add that into a tsung configuration like:
<transaction name="online">
<request>
<jabber type="chat" ack="no_ack" size="16" destination="online"</jabber>
</request>
</transaction>
<thinktime value="300"></thinktime>`
Take a look at Section 6.6.3.11. raw XML here. You can specify custom XML stanzas using raw type jabber requests.
So your request above would look like this(make sure you escape your XML):
<jabber type="raw" ack="no_ack"
data="<iq type="get"
><query Xmlns="jabberd:test:sample">
<search term="l"></search>
</query>
</iq>">
</jabber>
This is a column XX from a mySQL table . I need to change a value for one of the xml tags.
If i want to change the value to true in
<entry value="false" key="SaveColorSC"/>
how do i do that..
The table is called staff and column is called xx.??
<!DOCTYPE preferences SYSTEM "http://java.sun.com/dtd/preferences.dtd">
<preferences EXTERNAL_XML_VERSION="1.0">
<root type="user">
<map/>
<node name="xxx">
<map/>
<node name="user">
<map/>
<node name="admin">
<map>
<entry value="DICOM" key="ImportDestination"/>
...
<entry value="false" key="SaveColorSC"/>
<entry value="-256" key="GSPSColor"/>
<entry value="-16711936" key="SelectedAnnotationColor"/>
<entry value="1" key="MeasurementType"/>
<entry value="false" key="ChangeMeasurementTypeAfterCanc
el"/>
Please help !
Thanks a lot !!
I have a Flex AIR project that compiles and runs in Flex Builder 4.6. I'm trying to create an Ant script that will build the project. On these lines I get these errors:
_process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
_process.addEventListener(ProgressEvent.STANDARD_INPUT_PROGRESS, inputProgressListener);
_process.addEventListener(NativeProcessExitEvent.EXIT, onNativeProcessExit);
I'm getting this error:
[mxmlc] MyClass.as(190): col: 44 Error: Access of possibly undefined property STANDARD_OUTPUT_DATA through a reference with static type Class.
[mxmlc] _process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
[mxmlc] ^
[mxmlc] MyClass.as(191): col: 44 Error: Access of possibly undefined property STANDARD_INPUT_PROGRESS through a reference with static type Class.
[mxmlc] _process.addEventListener(ProgressEvent.STANDARD_INPUT_PROGRESS, inputProgressListener);
From what I can tell, these are defined in frameworks/libs/air/airglobal.swc. I think I'm including that with the compiler.external-library-path element below.
The compile target of my build.xml ant script looks like this:
<target name="compile" depends="init">
<mxmlc file="${MAIN_SOURCE_FILE}" output="${DEPLOY_DIR}/${APP_NAME}.swf"
services="${APP_ROOT}/services/flex/services-config.xml">
<swf-version>13</swf-version>
<locale>en_US</locale>
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<source-path path-element="${APP_ROOT}/../MyLib/src"/>
<source-path path-element="${APP_ROOT}/src"/>
<compiler.external-library-path dir="${FLEX_HOME}/frameworks" append="true">
<include name="libs/air" />
</compiler.external-library-path>
<compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
<include name="libs" />
<include name="../bundles/{locale}" />
</compiler.library-path>
<compiler.library-path dir="${APP_ROOT}" append="true">
<include name="libs" />
<include name="libs/player" />
</compiler.library-path>
<define name="CONFIG::debugging" value="false"/>
<compiler.debug>false</compiler.debug>
</mxmlc>
I think you want to change the <load-config> to be one of these:
<load-config filename="${FLEX_HOME}/frameworks/air-config.xml"/>
or
<load-config filename="${FLEX_HOME}/frameworks/airmobile-config.xml"/>