Re: Webots Array Passing Error in Java

Olivier Michel <[email protected]> Mon, 23 Feb 2004 12:04:23 +0100
Newsgroups gmane.comp.cybernetics.webot.contest
Organization Cyberbotics Ltd.
Message-ID <[email protected]>
> (snap)
> > which is caused by the line of code
> >
> > servo_set_position(joint[LEFT_SHOULDER_1],counter[0]);
> >
> > Has anyone else encountered this problem and is there a soln to it
> > other than not
> > passing array as arguments in your own methods or doing :
> >
> > int increment;
> > servo_set_position(joint[LEFT_SHOULDER_1],increment);
> >
> > with the code above
> 1) Possibly the joint[ ] array values have been corrupted and contain 
> values other than the values returned by the robot_get_device( ) function.
>  
> 2) Possibly the values in your counter[ ] array contains data such as 
> Float.NaN, Float.POSTIVE_INFINITY, or Float.NEGATIVE_INFINITY which 
> may cause Webots to throw an exception.
>  
> 3) The servo_set_position(int, float)  function should be called with 
> the second argument as a float value and not as an integer as shown in 
> your code above.
> The Java compiler should be reporting a warning that the argument 
> types do not match.  
>  
> I use the following call to set the servo positions in my controller 
> with no problems.
> int i;
> int[] joint;
> float[] futurePosition;
> for (i=0; i<21; i++) {
>    servo_set_position( joint[i], futurePosition[i] );
> }

As Mike mentioned, it is probably caused by a wrong argument passed to 
servo_set_position. In such a case Webots shouldn't crash but rather 
warn you about that wrong argument. I appreciate if you can provide me 
with feedback about it so that I could eventually fix it in Webots.

-Olivier


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/pU_rlB/TM
---------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/webots-contest/

<*> To unsubscribe from this group, send an email to:
     [email protected]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/