NXC: import NXT-G blocks into NXC code?

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:

Re: NXC: import NXT-G blocks into NXC code?

Post by mightor »

No, ROBOTC is closed-source.

- 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)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: import NXT-G blocks into NXC code?

Post by mattallen37 »

Well, there goes that idea.
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: NXC: import NXT-G blocks into NXC code?

Post by HaWe »

Well, you seem to have ruled out programming errors, so are you looking for timing issues?
correct.
motor commands forward, reverse, stop, float for a single motor or for 2 motors quickly after each other (2-5 ms) (without encoder reading) are executed very well, but in that moment when I start polling the encoder values the system hangs or crashes (at encoder readings already every 50-100 ms, but I actually need even quicker encoder data reading at least every 20 ms for odometric navigation).

so if no direct block import is possible, and no reverse engeneering neither, I guess I will have to attach the Tetrix DC motors to the NXT motor ports by a port splitter and attach a NXT motor additionally to the same NXT port and at the same gear wheel in order to have the NXT encoder readings instead. I hope my NXT H-bridges won't bother... :(

And I'll need any a Lego/Tetrix axle adaptor due to it.
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: import NXT-G blocks into NXC code?

Post by mattallen37 »

If they work in ROBOTC, could you have a slave NXT (with ROBOTC) interface to the controllers, and have the master (using NXC) command it using RS485? You could have a bidirectional communication protocol that would allow you to pass speed and direction commands to the ROBOTC NXT, and it could then return the encoder values to the NXT running an NXC program. It would allow for you to program all the thinking in NXC, but still have a controller interface.

Don't connect the tetrix motors directly to the NXT motor ports! I don't know for sure, but I am guessing they can draw up to around 5ish amps. If you want to control them directly, use an external H-Bridge to handle the power (both the current and the voltage that the motors need).

For an adapter, perhaps you should look for a lego that could be modified to interface. I often use pneumatic tube pieces, super-glue, band-saw, drill-press...
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: NXC: import NXT-G blocks into NXC code?

Post by HaWe »

Matt
no, that's not possible because of 3 reasons:
1) I don't use RobotC
2) my master NXT is connected by BT to 3 slaves (not possible in RobotC)
3) each of the 4 NXTs has to run several utility programs written in NXC, e.g.:
the 1st NXT (master) for the Tetrix chassis driver motors has to run a odometry program and the BT motor and sensor multiplexer network server program for the 3 slaves.
Each slave has different tasks (mapping + navigation + pathfinding by astar/bug2, neural net object detection and pneumatic compressor control, 5DOF robot arm control +speech recognition) and there is no place for another NXT just for the Tetrix Mux

It only would be possible to use NXT-G on one of the BT slaves, but programming in pictures and knitting patterns is too weird for me, it's not my world and never was (except in the very beginning with my RCX like a line follower) :(

But it actually should be possible to have the RobotC functionality also in NXC although I remember that also the RobotC people had issues using Tetrix motor control and encoder readings simultaneously (not sure if they still have).

I think I'll use the NXT encoder motors for the chassis driver odometry with these adaptors http://inanimatereason.com/shop/viewite ... tem=SSIKIT (plus an extra motor on each side for a booster: the monster weighs about 10 kg!)
mattallen37
Posts: 1818
Joined: 02 Oct 2010, 02:19
Location: Michigan USA
Contact:

Re: NXC: import NXT-G blocks into NXC code?

Post by mattallen37 »

1) Couldn't you use it just enough to make an RS485 interface to the tetrix controllers?
2) BT has nothing to do with RS485. You can have a full set of BT slaves and well as the RS485 slaves.
3) It is hard to imagine that you can't run all of the processing code on three NXT's, instead of 4. Even 1 NXT is able to do a huge amount of processing if it is programmed right.

Let me explain a little better what I have in mind. Program one NXT with ROBOTC, to be an RS485 slave. Use another NXT programmed in NXC to interface with the RS485 slave (instead of directly to the controllers). Use this RS485 master NXT as the master of the BT slaves as well. All the NXTs would be programmed in NXC, except the controller interface NXT.

Also, I don't think those axle adapters are specifically for tetrix axles. You may want to confirm before you buy them.
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: NXC: import NXT-G blocks into NXC code?

Post by HaWe »

Thank you, but I have no experience at all with RS485 (I never used it so far), I don't use RobotC at all, and more than that, even if I did or had:
I have no idea how to connect a NXC brick to a RobotC brick via RS485 and exchange remote commands and transfer odometric data back and forth.

I'm in contact with the axle adaptor company and we're about to check if the sizes fit to each other.
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 0 guests