program script syntax errors

Hi there,

The following script doesn't compile in orocos-ocl-1.8.2 / orocos-rtt-1.8.5

program reemh1_can_test_2
{
var array angles = array(0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1)
var array motors = array(11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0)
const int numMotors = motors.size() // (1)

for (int ii = 0; ii < 1; set ii = ii + 1) { // (2)
}
}

(1) Parse error at line 5: Syntactic error: End of statement expected.
Use a newline or ';' to separate statements.
(2) Parse error at line 9: Syntactic error: Closing brace expected (
or could not find out what this line means ).

What's the problem with the code ?!?

program script syntax errors

On Tue, Apr 20, 2010 at 13:06, Carles Lopez
<carles [dot] lopez [..] ...> wrote:
> Hi there,
>
> The following script doesn't compile in orocos-ocl-1.8.2 / orocos-rtt-1.8.5
>
> program reemh1_can_test_2
> {
>  var array angles = array(0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1)
>  var array motors = array(11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0)
>  const int numMotors = motors.size() // (1)

That's a hard one. Doesn't change when using 'var' instead of 'const'
? or is the motors.size() causing this (hardcode the number) ?

>
>  for (int ii = 0; ii < 1; set ii = ii + 1) { // (2)

Write var in front of ii :

  for( var int ii = 0; ii < 1; set ii = ii + 1 ) {

Peter

program script syntax errors

On Apr 20, 2010, at 11:46 , Peter Soetens wrote:

> On Tue, Apr 20, 2010 at 13:06, Carles Lopez
> <carles [dot] lopez [..] ...> wrote:
>> Hi there,
>>
>> The following script doesn't compile in orocos-ocl-1.8.2 / orocos-rtt-1.8.5
>>
>> program reemh1_can_test_2
>> {
>> var array angles = array(0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1)
>> var array motors = array(11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0)
>> const int numMotors = motors.size() // (1)
>
> That's a hard one. Doesn't change when using 'var' instead of 'const'
> ? or is the motors.size() causing this (hardcode the number) ?

Try removing the "()" from size ...
Stephen

program script syntax errors

Now it's working!

By the way, is it possible to wait for a period of time without
loading a component with, for example, a sleep function (as Timer in
some examples)?

On Tue, Apr 20, 2010 at 23:00, Stephen Roderick <snrkiwi [..] ...> wrote:
>
> On Apr 20, 2010, at 11:46 , Peter Soetens wrote:
>
>> On Tue, Apr 20, 2010 at 13:06, Carles Lopez
>> <carles [dot] lopez [..] ...> wrote:
>>> Hi there,
>>>
>>> The following script doesn't compile in orocos-ocl-1.8.2 / orocos-rtt-1.8.5
>>>
>>> program reemh1_can_test_2
>>> {
>>>  var array angles = array(0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1)
>>>  var array motors = array(11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0)
>>>  const int numMotors = motors.size() // (1)
>>
>> That's a hard one. Doesn't change when using 'var' instead of 'const'
>> ? or is the motors.size() causing this (hardcode the number) ?
>
> Try removing the "()" from size ...
> Stephen
>

program script syntax errors

=========================
var int numMotors = motors.size()

Syntactic error: End of statement expected. Use a newline or ';' to
separate statements.

=========================
var int numMotors = 8

(type 'ls' for context info)
:scripting.loadPrograms("/home/carles/Documents/reemh1.can.test.v1.0.ops")
Got :scripting.loadPrograms("/home/carles/Documents/reemh1.can.test.v1.0.ops")
= true

On Tue, Apr 20, 2010 at 17:46, Peter Soetens <peter [..] ...> wrote:
> On Tue, Apr 20, 2010 at 13:06, Carles Lopez
> <carles [dot] lopez [..] ...> wrote:
>> Hi there,
>>
>> The following script doesn't compile in orocos-ocl-1.8.2 / orocos-rtt-1.8.5
>>
>> program reemh1_can_test_2
>> {
>>  var array angles = array(0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1)
>>  var array motors = array(11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0)
>>  const int numMotors = motors.size() // (1)
>
> That's a hard one. Doesn't change when using 'var' instead of 'const'
> ? or is the motors.size() causing this (hardcode the number) ?
>
>>
>>  for (int ii = 0; ii < 1; set ii = ii + 1) { // (2)
>
> Write var in front of ii :
>

>  for( var int ii = 0; ii < 1; set ii = ii + 1 ) {
> 

>
> Peter
>