Till ROS 6.1 (including) the following code worked:
Code: Select all
{
:global a ""
:foreach le in=[/log print as-value] do={
:set a "$a$[:tostr [:pick $le 3]]\r\n"
}
:put $a
}
Is this a bug or log should be retrieved otherwise?
{
:global a ""
:foreach le in=[/log print as-value] do={
:set a "$a$[:tostr [:pick $le 3]]\r\n"
}
:put $a
}
Great! Thanks! Then it's fixed in 6.4on 6.4rc1 I get log entry topics. If that is what you require, then this will work this way in 6.4
{
:global a ""
:foreach le in=[/log print as-value] do={
:set a ($a . [:tostr [($le->"time")]] . "\r\n")
}
:put $a
}
It is wiser to use the name of element to get the value since order of the elements may change.Thanks! But looks like this code fragment doesn't work...Correct script would be:
ros code
{ :global a "" :foreach le in=[/log print as-value] do={ :set a ($a . [:tostr [$le->"time"]] . "\r\n") } :put $a }It is wiser to use the name of element to get the value since order of the elements may change.
[demo@demo.mt.lv] > { {... :global a "" {... :foreach le in=[/log print as-value] do={ {{... :set a ($a . [:tostr [$le->"time"]] . "\r\n") syntax error (line 4 column 30)
:set a ($a . [:tostr [($le->"time")]] . "\r\n")
Thanks for helping to improve my script Send email about reboot.ros code
:set a ($a . [:tostr [($le->"time")]] . "\r\n")