diff --git a/Object_Sorting/README.md b/Object_Sorting/README.md index e74585f..f349aec 100644 --- a/Object_Sorting/README.md +++ b/Object_Sorting/README.md @@ -12,12 +12,13 @@ But the program should work with all robots that have one driven wheel per side. #### Camera -The camera used for this program is the **Pixy2** for Lego Mindstorms. To work with the camera, you have to teach it the object you want to sort. For this, you need PixyMon on your PC. How to get PixyMon, teach an object and everything else you need to know is listed on the [PixyCam Website](https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:pixy_lego_quick_start). +The camera used for this program is the **Pixy2** for Lego Mindstorms. To work with the camera, you have to teach it the object you want to sort. For this, you need PixyMon on your PC. Additionally you need to set up the Pixy2 and "install" the module `pixycamev3`. You can download the needed file form the specific PixyCam GitHub but it is also inculded into our repository. +If you want to get detailed instructions on either of these points, look in the [Quick Start Guide](https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:pixy_lego_quick_start) on the PixyCam Website. * **Camera**: Connected to input port **1** -* Taught **Signature 1**: orange cube, leave in sorting area -* Taught **Signature 2**: green cube, sort out +* Taught **Signature 1**: green cube, leave in sorting area +* Taught **Signature 2**: orange cube, sort out The camera should be mounted on top of the robot and directed downwards for good results in detection. @@ -42,13 +43,13 @@ The sorted objects are simple cubes made of paper. You can find the tutorial for ## Program -The purpose of the program is to sort different objects. In detail, this means that the robot should push all green cubes out of the sorting area and leave all orange cubes inside. +The purpose of the program is to sort different objects. In detail, this means that the robot should push all orange cubes out of the sorting area and leave all green cubes inside. The main part of the program is the class "Object_Sorter". Due to the fact that the robot gets a lot of inputs and does not need to check everything at the same time, the class contains five different state methods. The robot will switch automatically between the states when certain events happen. You can identify the current state by looking at the LEDs on the EV3-brick. * **Search**: Both LEDs are black * **Get**: Only the left LED is green -* **Sort**: Both LEDs are green -* **Avoid**: Both LEDs are orange +* **Sort**: Both LEDs are orange +* **Avoid**: Both LEDs are green * **Edge**: Both LEDs are red The different methods of the class are explained in detail below. @@ -81,23 +82,23 @@ The target of the method is to search for new cubes to sort. The robot spins aro **Robot has a cube in his arms**: When the Ultrasonic Sensor detects an object in front of it, this means there is already a cube in its arms, and it switches to state "[Sort](#method-sort)". -**Camera detects orange cube**: If the camera finds an orange cube, it changes to the state "[Avoid](#method-avoid)". +**Camera detects green cube**: If the camera finds an green cube, it changes to the state "[Avoid](#method-avoid)". -**Camera detects green cube**: If the camera finds a green cube, it changes to the state "[Get](#method-get)". +**Camera detects orange cube**: If the camera finds a orange cube, it changes to the state "[Get](#method-get)". **Robot spun without finding something**: When the robot has turned for 2 full rounds (720°) and has not detected one of the four things above, it will drive a bit forward. If it reaches the outline, it changes to the state "[Edge](#method-edge)". Otherwise, it starts the state "[Search](#method-search)" again at the new spot. ### Method: Get -The purpose of the method is to drive towards the green cube and "catch" it in its arms. +The purpose of the method is to drive towards the orange cube and "catch" it in its arms. To make that happen, the method checks the current position of the cube and corrects the driving direction if necessary. Due to the fact that there are several reasons why the camera does not consistently recognize the cube, the robot has a routine to find the cube again (driving backwards, turning left). If the routine does not work, the program changes back to state "[Search](#method-search)". Otherwise, the ultrasonic sensor detects the cube in the arms, and the program changes to state "[Sort](#method-sort)", or the robot moves over the line, and it switches to state "[Edge](#method-edge)". ### Method: Sort -The task of the method is to drive the cube to the outline of the sorting area and avoid the orange cubes on the way. -If the camera detects an orange cube, the program switches to the state "[Avoid](#method-avoid)", whereas if it doesn't, the robot continues straight ahead until the outline is reached and the program changes to the state "[Edge](#method-edge)". +The task of the method is to drive the cube to the outline of the sorting area and avoid the green cubes on the way. +If the camera detects an green cube, the program switches to the state "[Avoid](#method-avoid)", whereas if it doesn't, the robot continues straight ahead until the outline is reached and the program changes to the state "[Edge](#method-edge)". ### Method: Avoid -The detected orange cube should be avoided by the robot. Therefore, the camera looks for the orange cube again and gets its position. If it is out of reach of the robot, the drive path will not change, but if the cube is on the way, the robot corrects its driving direction. After that, the program switches back to the state before. ("[Search](#method-search)" or "[Sort](#method-sort)") +The detected green cube should be avoided by the robot. Therefore, the camera looks for the green cube again and gets its position. If it is out of reach of the robot, the drive path will not change, but if the cube is on the way, the robot corrects its driving direction. After that, the program switches back to the state before. ("[Search](#method-search)" or "[Sort](#method-sort)") ### Method: Edge The robot has reached the outline. It drives backward and turns 100° to the right. The program switches back to the state "[Search](#method-search)" afterward.