My blocks in paralleled events
-
- Posts: 44
- Joined: 04 May 2012, 20:20
My blocks in paralleled events
I have a my block that homes a motor to a switch. The Block has 5 Data Hub inputs, Motor Port (number 1-3), Direction(Logic), To Switch Power(Number 1-100), Switch Port(number 1-4), Off switch Power(number 1-100). I have two paralleled tasked called up in the beginning of my program to run motors B and C to their home position but only one motor runs at a time. I have been trouble shooting for some time now and found that if I make a copy of the my block using the original with motor B and the copy with Motor C and with this the two motors home together. Is there something going on that if a my block is in use that you can not use it until it is finished. Think I need a way to create a custom instruction block. I have attached my Home to switch if anyone want to take a peak.
- Attachments
-
- Home to switch v2.rbtx
- (859.64 KiB) Downloaded 459 times
-
- Posts: 290
- Joined: 03 Oct 2011, 00:06
- Location: Gallifrey
- Contact:
Re: My blocks in paralleled events
It couldn't run both motors at the same time because that would require a re-entrant function, which not even the most advanced LEGO software supports yet. Without re-entrant functions, functions (or "MyBlocks" in NXT-G) can only be called one at a time, and any other tasks that try to use them have to wait their turn. However, with re-entrant functions, functions can be called by any number of tasks concurrently. So, yes, you will have to have two different copies of the block.
A.K.A. NeXT-Generation.
"A kingdom of heaven for RobotC now has recursion!"
"A kingdom of heaven for RobotC now has recursion!"
-
- Posts: 44
- Joined: 04 May 2012, 20:20
Re: My blocks in paralleled events
Then I need to make a custom instruction like the motor, switch, and logic blocks. I have only skipped over this possibly in other places. Is it Robolab that is use to do this? Big $$$ for a hobbiest.
-
- Posts: 290
- Joined: 03 Oct 2011, 00:06
- Location: Gallifrey
- Contact:
Re: My blocks in paralleled events
No, not RoboLab, LabView. And yes, it's kind of exspensive. But, for what you want to do, your better off just making two MyBlocks that do the exact same thing, but with different names, like "HomeToSwitch_A" and "HomeToSwitch_B" or something like that. Unless your going to be making lots of actual NXT-G blocks, it's probably not worth it to you to get LabView. But, it's your decision. If you want, you can get a 30-day free trial of LabView for MindStorms from here.
A.K.A. NeXT-Generation.
"A kingdom of heaven for RobotC now has recursion!"
"A kingdom of heaven for RobotC now has recursion!"
-
- Posts: 44
- Joined: 04 May 2012, 20:20
Re: My blocks in paralleled events
Thinking it would just be fun to do.
-
- Posts: 6
- Joined: 05 Dec 2010, 01:12
Re: My blocks in paralleled events
You are correct the NXT-G has the limitation that you cannot run two copies of the same MyBlock in parallel. You have already found the simplest way to deal with this; just create a copy of the original MyBlock with a new name. Then use the two different MyBlocks on parallel beams.
Terry Griffin
Terry Griffin
-
- Posts: 44
- Joined: 04 May 2012, 20:20
Re: My blocks in paralleled events
Can anyone point to a good tutorial for creating a custom NXT-G Block. I would like to experiment. I dream in code sometimes. My Programming background is using Rockwell automation. I have work with automation for 13 years on PLC's using the Contrologixs and integrated Motion control. I would like to see if I could create some block to use user units, maybe some absolute movement instead of always incremental, Home routines, and other motion control function I use in my every day job. I have only own this kit for 2 months and have started our first after school group with 4th and 5th graders. Hopefully this fall start a FLL team.
-
- Posts: 290
- Joined: 03 Oct 2011, 00:06
- Location: Gallifrey
- Contact:
Re: My blocks in paralleled events
A Google search comes up with a couple things:
The short tutorial put out by NI: ftp://ftp.ni.com/evaluation/mindstorms/ ... Blocks.pdf
and Michael Gasperi's book, LabVIEW for LEGO MindStorms: http://books.google.com/books?id=GV0SgD ... xt&f=false
The short tutorial put out by NI: ftp://ftp.ni.com/evaluation/mindstorms/ ... Blocks.pdf
and Michael Gasperi's book, LabVIEW for LEGO MindStorms: http://books.google.com/books?id=GV0SgD ... xt&f=false
A.K.A. NeXT-Generation.
"A kingdom of heaven for RobotC now has recursion!"
"A kingdom of heaven for RobotC now has recursion!"
-
- Posts: 44
- Joined: 04 May 2012, 20:20
Re: My blocks in paralleled events
I have found that PDF as well. I'm going down a painfull path trying to get past Step 1
Update:
Good Thing there is a 30 trail. Have had little to no luck so far. 7.1 error during the install. Wants the NI drivers CD. ??? skipped it and the software has no Lego NXT references anywhere. When I try to download the NXT toolkit the links bring me to the LV2010 down-loader. Looks like I may have to come back to this most up to date version. Also reading the comments at the bottom of the NI download page I'm not the first one to have these troubles.
Seem I installed LV2010, LV2011, Countless add-ons. Now I read that I must use V7.1. I found that now downloading to give that a go.In LabVIEW, select Tools»NXT Module»New NXT Block Wizard.
Update:
Good Thing there is a 30 trail. Have had little to no luck so far. 7.1 error during the install. Wants the NI drivers CD. ??? skipped it and the software has no Lego NXT references anywhere. When I try to download the NXT toolkit the links bring me to the LV2010 down-loader. Looks like I may have to come back to this most up to date version. Also reading the comments at the bottom of the NI download page I'm not the first one to have these troubles.
-
- Posts: 44
- Joined: 04 May 2012, 20:20
Re: My blocks in paralleled events
Wow Found It...... When you goto the link to download the Toolkit at the top is LV2010 but half way down the page is a chart with all the other add-on for earlier software. I now Have the
Now onto the next step..step 1 option "In LabVIEW, select Tools»NXT Module»New NXT Block Wizard."
Who is online
Users browsing this forum: No registered users and 2 guests