wishlist for NXC

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: wishlist for NXC

Post by mattallen37 »

afanofosc wrote:I will work to incorporate the new absolute position regulation changes from Nicolas into my enhanced NBC/NXC firmware. I am also working on getting my firmware SVN repository up on sourceforge. Hopefully I can get it up there this month.

John Hansen
Thanks a bunch.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
schodet
Posts: 139
Joined: 29 Sep 2010, 11:21
Contact:

Re: wishlist for NXC

Post by schodet »

afanofosc wrote:I will work to incorporate the new absolute position regulation changes from Nicolas into my enhanced NBC/NXC firmware. I am also working on getting my firmware SVN repository up on sourceforge. Hopefully I can get it up there this month.
Nice :)

In this case, for backward compatibility, I suppose it is still better to keep the 100 ms regulation interval by default. I did not handle the TurnRatio != 0 case yet, I think it is buggy (TurnRatio value should be divided by 100ms/regulation time). I have to add fractional value support for TurnRatio like I did for Speed.

EDIT: I started to patch bricxcc to add new fields, this is really a draft (missing doc for example), but it may help: http://ni.fr.eu.org/~nico/nxc/bricxcc-absreg.patch
LEGO things http://ni.fr.eu.org/lego/ - NXT Improved Firmware (GCC) http://nxt-firmware.ni.fr.eu.org/ - Other robots http://apbteam.org
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: wishlist for NXC

Post by muntoo »

I had the same "fakedio.h" * wish as doc-helmut since forever (which was way before yesterday, but sometime after time came into existence).

Insanity:
* :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: :twisted: :lol: **
** Please count the number of smilies used in this post, and divide by 2.
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: wishlist for NXC

Post by muntoo »

atan2 says:
atan2 wrote:Returns:
Arc tangent of y/x, in the interval [-pi,+pi] radians.
atan2d says:
atan2d wrote:Returns:
Arc tangent of y/x, in the interval [-90,+90] degrees.
Notice anything? Hint:

Code: Select all

pi radians  !=  90 degrees
Not ringing a bell? What about this:

Code: Select all

pi radians  !=  pi/2 radians
My question is... why are they different? Shouldn't the atan2d() say +/-180 degrees? Or is the output really between 90 and -90? Should I start using my own atan2d() function?

Code: Select all

inline float myatan2d(float y, float x)
{
    return(atan2(y, x) * DEGREES_PER_RADIAN);
}

-----


And another thing... ( :) )

Could we have these built in:

Code: Select all

// #define degToRad(x) (x * RADIANS_PER_DEGREE)
// #define radToDeg(x) (x *  DEGREES_PER_RADIAN)

inline float degToRad(float x)
{
    return(x * RADIANS_PER_DEGREE);
}

inline float radToDeg(float x)
{
    return(x * DEGREES_PER_RADIAN);
}
I don't like thinking about [simple or complicated] conversions, especially if I have about ten of them on one line:
My 1yHz* Brain wrote: 00101010 10011010 01101110
[Translation:]
Now, if I'm converting x degrees to y radians, do I do y = x * RADIANS_PER_DEGREE, since it will be rad = deg * (rad / deg), or should I do it the other way around?

-- Later --
01000111 01001111 01001111 01000111 01001100 01000101 01001011 01001111
[Translation:]

Code: Select all

float z = x == 3 * DEGREES_PER_RADIAN ? y == 4 * RADIANS_PER_DEGREE ? 5*x/RADIANS_PER_DEGREE : y+42*RADIANS_PER_DEGREE : 101 == LOL ? LOL : 42;
* yoctohertz
Last edited by muntoo on 19 Feb 2011, 03:41, edited 1 time in total.
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: wishlist for NXC

Post by mattallen37 »

I am sure it is just a mistake, as there are many in the help files.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC

Post by HaWe »

muntoo, please stop faking and bastardizing the sources of quotes - it's weird and confusing !
My 1yHz* Brain wrote:00101010 10011010 01101110
[Translation:]
Now, if I'm converting x degrees to y radians, do I do y = x * RADIANS_PER_DEGREE, since it will be rad = deg * (rad / deg), or should I do it the other way around?

-- Later --
01000111 01001111 01001111 01000111 01001100 01000101 01001011 01001111
[Translation:]...

Code: Select all

...
float Rad_Per_Deg= 3.14159265 / 180
float Deg_Per_Rad= 180 / 3.14159265

for atan you may get only values of the interval ] −π/2 ; +π/2 [ (π/2 = 90°)
Image
by atan2 you may use all 4 quadrants for x, y of the coordinate system (except discontinuities at +/- π/2)
Image
(CMIIW)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: wishlist for NXC

Post by mattallen37 »

I would like higher I2C speed to be supported (but optional) in NXC. There are a few things the NXT could do much better if it was able to run the I2C bus at 100kHz or so. Ideally, you could allow the speed to be selected (maybe 4 speed options). Perhaps even an infinite number of speeds, allowing for the highest speed the external hardware supports.

A quote from Andy
gloomyandy wrote:Hi,
So I've been tweaking the i2c code in the leJOS firmware. With that I can run reliably at 125KHz (as opposed to the standard 9.6KHz). This seems to work with all of the non Lego i2c devices I have (half a dozen or so in all). I can even combine most of them on a single bus (using a port splitter). Any faster than this though and things seem to fall apart...


Andy
No rush getting it implemented (if at all), but it would be cool.
Matt
http://mattallen37.wordpress.com/

I'm all for gun control... that's why I use both hands when shooting ;)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC

Post by HaWe »

Dear Santa-John,
I firmly hope you're not stuck in the chimney anywhere, so please forgive me when I respectfully dare to kindly remind you of my Christmas present...of last year...? :roll:
I hope you still remember what I am referring to .... ? :?
If I'm not much mistaken, it might be rather far back in the Book of Christmas Wishes ... from last Christmas ... and it starts with a "T ".... :oops:

Kind regards,
*cough*

D.H.
:mrgreen:

(!! INPUT !! - Johnny_7 needs action...)
Attachments
Johnny_7 needs action for input... :(
Johnny_7 needs action for input... :(
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC

Post by HaWe »

John,
though everybody might do it "his way", what do you think about simplifying the confusion about raw sensor modes by defining in NXC API something like

Code: Select all

SENSOR_ANALOG_RAW
which does with SetSensor() like

Code: Select all

SetSensor(_port, SENSOR_ANALOG_RAW)
the same as

Code: Select all

SetSensorType(_port, SENSOR_TYPE_TOUCH);
SetSensorMode(_port, SENSOR_MODE_RAW);
Wait(20);
- if possible not by a macro but by an inline function, so that also variables like function returned values may be passed to it.

Having once configured the sensor this way, the standard reading

Code: Select all

SensorValue(_port)
should always give the same result as SensorRaw(_port).
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: wishlist for NXC

Post by muntoo »

I can't include more than a few files. (They all have include guards, except the ones with * after their name.)

-----

To be exact, I'm including multiple files inside "MM_v0_3.nxc". "MM.nxc" * #includes "MM_v0_3.nxc". "MM-Demo.nxc" * #includes "MM.nxc" *.

The first two files of "MM_v0_3.nxc" cause no trouble.
The last three do cause trouble. Removing the includes doesn't cause any trouble. (After you copy some of the MM_get_LONG/MM_set_LONG functions before removing the #include, of course.)

-----

Leaving this at the end of "MM_v0_3.nxc" causes another compile error:

Code: Select all

/*
Reasons to use:
 //...
To do:
 // ...
// Blah blah blah
*/
. Remove it, and the three "bad include files", and I finally get a successful compile.

-----

EDIT: Alternatively, you can add a line break after /*<br />*/ to prevent compile errors

Code: Select all

/*
Reasons to use:
 //...
To do:
 // ...
// Blah blah blah
*/

Attachments
v0_3.zip
(13.28 KiB) Downloaded 264 times
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest