Trig functions in NXT-G

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Trig functions in NXT-G

Post by mightor » 30 Sep 2010, 11:05

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
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)

hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: Trig functions in NXT-G

Post by hassenplug » 30 Sep 2010, 13:25

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
---> Link to lots of MINDSTORMS stuff under my picture --->

philoo
Posts: 76
Joined: 29 Sep 2010, 09:04
Location: Paris, France
Contact:

Re: Trig functions in NXT-G

Post by philoo » 30 Sep 2010, 13:31

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

afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Trig functions in NXT-G

Post by afanofosc » 30 Sep 2010, 14:29

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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/

mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: Trig functions in NXT-G

Post by mightor » 30 Sep 2010, 17:55

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
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)

hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

Re: Trig functions in NXT-G

Post by hassenplug » 01 Oct 2010, 02:17

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
---> Link to lots of MINDSTORMS stuff under my picture --->

megamindstorm
Posts: 16
Joined: 01 Oct 2010, 03:07

Re: Trig functions in NXT-G

Post by megamindstorm » 01 Oct 2010, 03:18

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.
In A World Filled With Seemingly Endless Limitations....
-toshiba a long long time ago

mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: Trig functions in NXT-G

Post by mightor » 01 Oct 2010, 06:29

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
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)

linmix
Posts: 19
Joined: 29 Sep 2010, 09:17

Re: Trig functions in NXT-G

Post by linmix » 01 Oct 2010, 07:08

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

mpscholz
Posts: 17
Joined: 29 Sep 2010, 09:32

Re: Trig functions in NXT-G

Post by mpscholz » 01 Oct 2010, 07:29

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests