Sort Color Bricks Problem
Posted: 11 Jan 2011, 16:30
I want to write a NXC program to sort 4 color bricks (Blue, Green, Red and Yellow) by a Lego Color Sensor into relevant color baskets.
There are 4 empty color baskets (Blue, Green, Red and Yellow) to be fixed in a moving train which is controlled by M1.
The train moves, to and fro, to collect a color brick by the relevant color basket, after scanning by the Color Sensor.
M2 is used to allow a color brick to drop into a basket each time along the Outlet after brick scanning.
The four color baskets in the train are placed in the order of [G] [R] [Y], where , [G], [R], [Y] representing by Blue, Green, Red and Yellow
color baskets respectively.
The distance, between any two adjacent color baskets (or degree of motor M1 to be rotated from one color basket to the adjacent color
basket) is denoted by d.
The starting point is the red color basket facing the Outlet from which it drops.
The estimate chances are as follows:
Group 1: →[G] = d, →[R]= 2d, →[Y]=3d,
Group 2: [G]→ = -d, [G]→[R]= d, [G]→[Y]=2d,
Group 3: [R]→ = -2d, [R]→[G] = -d, [R]→[Y]=d,
Group 4: [Y]→ =-3d, [Y]→[G] = -2d, [Y]→[R]=-d.
How about the program?
Can you help give a hint or suggestion?
YH Chan
There are 4 empty color baskets (Blue, Green, Red and Yellow) to be fixed in a moving train which is controlled by M1.
The train moves, to and fro, to collect a color brick by the relevant color basket, after scanning by the Color Sensor.
M2 is used to allow a color brick to drop into a basket each time along the Outlet after brick scanning.
The four color baskets in the train are placed in the order of [G] [R] [Y], where , [G], [R], [Y] representing by Blue, Green, Red and Yellow
color baskets respectively.
The distance, between any two adjacent color baskets (or degree of motor M1 to be rotated from one color basket to the adjacent color
basket) is denoted by d.
The starting point is the red color basket facing the Outlet from which it drops.
The estimate chances are as follows:
Group 1: →[G] = d, →[R]= 2d, →[Y]=3d,
Group 2: [G]→ = -d, [G]→[R]= d, [G]→[Y]=2d,
Group 3: [R]→ = -2d, [R]→[G] = -d, [R]→[Y]=d,
Group 4: [Y]→ =-3d, [Y]→[G] = -2d, [Y]→[R]=-d.
How about the program?
Can you help give a hint or suggestion?
YH Chan