0

Line Robot - Hardware 2

1. Motors

First, check the motors. Issue command "mot" and make sure that the motors rotate in the sequence indicated by red numbers: first 1, then 2, ... Each of them must rotate first clockwise, then anticlockwise. It is important that You establish this pattern. Otherwise, the algorithm for driving the robot in the desired direction will not work.

If the sequence is not right, revisit the page that shows how to connect the motors. Alternatively, rearrange cables that connect motor controller and the motors, after noticing the error in sequence.

If any of the motors doesn't start clockwise, but anticlockwise, You will have to change the program. Use Arduino IDE or Visual Studio Code (even Notepad++ or some other editor will be OK) and open mrm-robot-line.cpp and find the lines similar to these, at the beginning of the program:
	mrm_mot4x3_6can->directionChange(0); // Uncomment to change 1st wheel's rotation direction
	mrm_mot4x3_6can->directionChange(1); // Uncomment to change 2nd wheel's rotation direction
	mrm_mot4x3_6can->directionChange(2); // Uncomment to change 3rd wheel's rotation direction
	mrm_mot4x3_6can->directionChange(3); // Uncomment to change 4th wheel's rotation direction
Comment lines that correspondent to the wheels that rotate in the wrong direction by putting "//" in the front of that line. For example, if motors 2 and 4 misbehave, the result will look like this:
	mrm_mot4x3_6can->directionChange(0); // Uncomment to change 1st wheel's rotation direction
	//mrm_mot4x3_6can->directionChange(1); // Uncomment to change 2nd wheel's rotation direction
	mrm_mot4x3_6can->directionChange(2); // Uncomment to change 3rd wheel's rotation direction
	//mrm_mot4x3_6can->directionChange(3); // Uncomment to change 4th wheel's rotation direction
Run "mot" again to verify that everything works fine.

Lidars

Lidars must be ordered according to green numbers. Number 1 should denote "Lidar4m-0", 2 "Lidar4m-1", etc. Issue "li2" command and but an obstacle in front of each sensor to verify. If they are not ordered properly, either use "idc" command to change addresses or reassemble the sensors, in the way described on this page. The former option is faster.

Color sensors

Rearrange color sensors so that "Col-0" is denoted by 1 and "Col-1" with 2. Again, use "idc" or reassemble the sensors if they are not in proper places.

Reflective sensor

Look at the sensor and You will find transistors' ordinal numbers printed on top, in small print, next to each transistor. Position the sensor in such a way that the transistor 1 is the rightmost. If You sensor has 8 transistors instead of 9, the leftmost transistor will be number 8, not 9, like in the picture.