0

Maze Robot - lidars and motors

Lidars

First, let's change lidars' CAN Bus addresses. Each of 8 of them received a unique address automatically after power-on, but it is extremely likely that they are not correct for Maze robot. On the picture left lidars' device id numbers are designated with green letters and are 0 to 7. You will have to change CAN Bus addresses to get this configuration. In terminal use command "idc" to show all the addresses. If there is a lidar named "Lidar2m-0", change its address to 8. If there is none, there is nothing to do here. Any of the both possibilities will result with no sensor name "Lidar2m-0" in the list, which You can also get using "can" command.

Now, having address 0 free, we can assign the right sensor to it. Execute "li2" command and watch the sensors measuring distances. Put an object in front of RF sensor (0) and find its position in the list as the numbers in that column will change according the the objects distance. Let's say it is in the 4th column.

Run "idc" again and find 4th lidar from the top. That is the FR lidar, most probably with a wrong address. Change its address to 0. That completes this step and the FR lidar has address 0 assigned.

Run "can" again and You will find a gap in names, one between Lidar2m-0 and lidar Lidar2m-8 will be missing. That it the chosen lidar's old address. Let's say that is 6. Look at the picture and note that this is RB sensor. We should now do the same procedure for 6 (RB), as we did for 0 (FR). This step should be repeated till all the sensors are assigned correct addresses.

If this procedure seems to be complicated (and it is tedious, indeed), You can also disassemble the sensors and connect them in the right order.

Motors

Look at the picture above again: M1 designates 1st motor (connected to motor controller's output connector 1), M2 the second, and so on. Connect them in this order. Alternatively, You can connect the any way You like, but will have to change software setup. If You choose the latter option, find this part of the code in C:\Users\[Your login]\Documents\Arduino\libraries\mrm-robot\src\mrm-robot-maze.cpp:

motorGroup = new MotorGroupDifferential(mrm_mot4x3_6can, 3, mrm_mot4x3_6can, 2, mrm_mot4x3_6can, 1, mrm_mot4x3_6can, 0);
2nd parameter (3 in this case) is the number of output connector assigned to first motor, 4th second, 6th third, and 8th fourth. Note that output connectors have numbers 0 - 3 (in code) instead of 1 - 4 (PCB designations).

Any method chosen, You must confirm the result by running "mot" command, which must turn the motors on in the right sequence: first M1, then M2, M3, and M4.

Now directions of rotation: "can" must start each motor first CCW (counter-clockwise), then CW. Note which motors did not obey this rule. In that case follow the next procedure. If You want to change, for example, direction of first motor (0), include (for example after command listed above) command

mrm_mot4x3_6->directionChange(0); 

Run "mot" again to make sure that everything works correctly now.