Skip to content

Commit 2f9ff49

Browse files
committed
Merge pull request ev3dev#129 from bmegli/master
Setting port modes, xv11test -raw mode, examples in C/C#/Java
2 parents a8f734b + dcab7dd commit 2f9ff49

1 file changed

Lines changed: 41 additions & 2 deletions

File tree

docs/tutorials/using-xv11-lidar.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,58 @@ For the details, follow video tutorial:
3232
## Motor Connector
3333

3434
The part with resistors is optional. It allows EV3 to autodetect the motor but in ev3dev you can load the driver manually.
35-
If you decide not to solder the resistors you only have to make two connections (PWM0 and PWM1).
35+
If you decide not to solder the resistors you only have to make two connections (PWM0-PWR and PWM1-Ground).
3636

3737
{% include screenshot.html source="/images/xv11-tutorial/lidar_motor_scheme.png" %}
3838

39+
In both cases (w/o resistors) you are limited to unregulated motor control.
40+
3941
## Data and Power Connector
4042

4143
{% include screenshot.html source="/images/xv11-tutorial/lidar_data_scheme.png" %}
4244

45+
## Sensor Port Mode
46+
47+
I am assuming your data connector is connected to `port 1` (adjust commands otherwise).
48+
49+
You will have to put the sensor port in `other-uart` mode:
50+
51+
echo other-uart > /sys/class/lego-port/port0/mode
52+
53+
You can read and write to or from LIDAR at:
54+
55+
/dev/tty_in1
56+
57+
It is binary tty communication. More information in `Testing the LIDAR` section.
58+
59+
## Motor Port Mode
60+
61+
I am assuming your motor connector is connected to `port A` and it is the only motor.
62+
63+
With auto-detection (resistors) your motor interface is available at:
64+
65+
/sys/class/tacho-motor/motor0
66+
67+
If you decided to not solder the resistors in motor connector, you have to put the motor port in `dc-motor` mode:
68+
69+
echo dc-motor > /sys/class/lego-port/port4/mode
70+
71+
Then your motor interface will be available at:
72+
73+
/sys/class/dc-motor/motor0
74+
75+
In both cases (w/o resistors) you are limited to unregulated motor control.
76+
4377
## LIDAR Rotational Geometry
4478

4579
If you assume that XV11 LIDAR returns you the distance to the object you will have it *almost* right. To do it correctly take into account the rotational geometry of the LIDAR.
4680

4781
{% include screenshot.html source="/images/xv11-tutorial/lidar_rotational_geometry.png" %}
4882

83+
You may ignore the above and the reported distance will still be approximately correct.
84+
You will introduce systematic error, dependent on angle, bounded by 25 mm on x and y.
85+
Regardless, the LIDAR has also random error with variance dependent on distance, surface and reflection angle.
86+
4987
## Testing the LIDAR
5088

5189
You can use [xv11test] from the github repository to:
@@ -54,7 +92,8 @@ You can use [xv11test] from the github repository to:
5492
- plot the LIDAR scan
5593
- get idea how to communicate with the LIDAR
5694
- get idea how to interpret the LIDAR output and apply geometric correction
57-
- or use `xv11lidar.h` and `xv11lidar.c` as a simple C library to communicate with the LIDAR
95+
- use `xv11lidar.h` and `xv11lidar.c` as a simple C library to communicate with the LIDAR
96+
- run `xv11test` with `-raw` argument and pipe LIDAR data to your program (C, C# and Java examples included)
5897

5998
Go to repository and follow readme.md instructions.
6099

0 commit comments

Comments
 (0)