Page 1 of 3

Trig functions in NXT-G

Posted: 30 Sep 2010, 11:05
by mightor
Are there any blocks for the standard trig functions in NXT-G 2.0? There used to be one for NXT-G that used fixed point math but it was sssssllllloooooowwww, up to 0.1 second per function (sin, cos, tan, asin, acos, atan), which is unacceptable for me.

Are the normal trig functions even part of the standard firmware or can they only be found in the enhanced firmware?

Regards,
Xander

Re: Trig functions in NXT-G

Posted: 30 Sep 2010, 13:25
by hassenplug
mightor wrote:Are there any blocks for the standard trig functions in NXT-G 2.0? There used to be one for NXT-G that used fixed point math but it was sssssllllloooooowwww, up to 0.1 second per function (sin, cos, tan, asin, acos, atan), which is unacceptable for me.

Are the normal trig functions even part of the standard firmware or can they only be found in the enhanced firmware?
I think I remember seeing a block over on NXTa-woops. darn. Guess we're going to have to recreate that index of NXT-G blocks.

I'm out of practice on building blocks, but it would be great content for Mindboards.

Steve

Re: Trig functions in NXT-G

Posted: 30 Sep 2010, 13:31
by philoo
What trig blocs did you use? Claude Baumann's ones seem reasonably fast (though using integer and NXT 1 FW):
Sin/Cos and Atan / Atan2

Re: Trig functions in NXT-G

Posted: 30 Sep 2010, 14:29
by afanofosc
mightor wrote:Are the normal trig functions even part of the standard firmware or can they only be found in the enhanced firmware?
The latest version of the standard firmware has a section of code that has been commented out using #if 0 ... #endif which contained an implementation of the standard trig functions (sin, cos, tan). The NXT-G compiler probably would have needed to be changed to support new opcodes and that may be why they decided not to add them to the firmware. Radian and degree versions of trig functions are available in abundance in the enhanced NBC/NXC firmware but there isn't any way to use them in NXT-G.

John Hansen

Re: Trig functions in NXT-G

Posted: 30 Sep 2010, 17:55
by mightor
philoo wrote:What trig blocs did you use? Claude Baumann's ones seem reasonably fast (though using integer and NXT 1 FW):
Sin/Cos and Atan / Atan2
Philo,

Ah so it;s not 100ms, but 14ms per operation, that's still quite slow for what I want to do with it. I was hoping to be able to use native calls through NXT-G blocks. I guess I'll have to use something else.

- Xander

Re: Trig functions in NXT-G

Posted: 01 Oct 2010, 02:17
by hassenplug
mightor wrote:Ah so it;s not 100ms, but 14ms per operation, that's still quite slow for what I want to do with it. I was hoping to be able to use native calls through NXT-G blocks. I guess I'll have to use something else.
Oh, come on. I did my Omni stuff with NXT-G...

Steve

Re: Trig functions in NXT-G

Posted: 01 Oct 2010, 03:18
by megamindstorm
if you want I have a folder on my computer with every single block from nxtasy's repo organized by type (advanced, sensor, ect) so if anyone wants a block before the new blocks get posted I have them at easy acess.

Re: Trig functions in NXT-G

Posted: 01 Oct 2010, 06:29
by mightor
hassenplug wrote:
mightor wrote:Oh, come on. I did my Omni stuff with NXT-G...
I want to do more than just control the wheels, I need time to do other stuff, too :)

- Xander

Re: Trig functions in NXT-G

Posted: 01 Oct 2010, 07:08
by linmix
hassenplug wrote: I think I remember seeing a block over on NXTa-woops. darn. Guess we're going to have to recreate that index of NXT-G blocks.
I was in the process of creating a back-up on th Lroboticas wiki. It is very incomplete, but it may be a start:
http://lrobotikas.net/wiki/index.php?ti ... para_NXT-G

Re: Trig functions in NXT-G

Posted: 01 Oct 2010, 07:29
by mpscholz
Xander,

Is there a particular reason why you want to limit yourself to using NXT-G ?
NXT-G might not always be the best choice for advanced use cases.