Commit bd587cb0 authored by Bruno Laurencich's avatar Bruno Laurencich

BETA stage message

parent 22481063
......@@ -2,185 +2,9 @@
_Hub software of the Chordata motion capture system_
## ATTENTION: WIP!
This software is still on an ALPHA stage. This branch is stable but lacks most of the current funcionalities. Refer to the `develop` branch for an up-to-date version.
This software is still on an BETA stage and under heavy development. Refer to the `develop` branch for the lastest version.
### Hardware
Tested under a Raspberry Pi3 with Raspbian "Stretch" Lite
with one Chordata Hub R1 as a multiplexer
and three Chordata K-Ceptor R2 as sensors
### WIRING
- [RPI 1 (3.3v)] -> [Chordata Hub 1 (3.3v)]
- [RPI 6 (GND)] -> [Chordata Hub 2 (GND)]
- [RPI 3 (SDA)] -> [Chordata Hub 4 (SDA)]
- [RPI 5 (SCL)] -> [Chordata Hub 5 (SCL)]
- [RPI 7 (GPIO)] -> [Chordata Hub 3 (ENABLE)]
_The following connections are made with a 6 cores cable, ~26 AWG, with crimped RJ12 connectors._
- [MUX JP1] -> [First KCeptor IN] <ID_module #1>
- [First KCeptor OUT] -> [Second KCeptor IN] <ID_module #4>
- [Second KCeptor OUT]-> [Third KCeptor IN] <ID_module #6>
For this to work the `Chordata.xml` file has to have the following structure):
```xml
<Chordata version="0.1.0">
<Configuration>
(... config nodes ...)
</Configuration>
<Armature>
<Mux Name="main_mux" id="0">
0x73
<Branch Name="main_branch" id="1">
CH_1
<K_Ceptor Name="first" id="2">
1
<K_Ceptor Name="second" id="3">
4
<K_Ceptor Name="third" id="4">
6
</K_Ceptor>
</K_Ceptor>
</K_Ceptor>
</Branch>
</Mux>
</Armature>
</Chordata>
```
Note that any other arbitrary hierarchy can be used, it only has to reflect what is connected in reality.
### INSTALLATION
**First of all you have to activate the i2c adaptor on your rPi**
```
sudo raspi-config
```
And activate the option under [9 Advanced Options] > [A7 I2C]
**Then install the folowing:**
- I2C tools
```
sudo apt-get install i2c-tools
```
- G++ 5 (or higher, if it's not already installed)
[Guide](https://ijat.my/install-gcc-5-raspberry-pi-3)
- Boost
```
sudo apt-get install libboost1.54-dev
```
- i2c driver lib
```
sudo apt-get install libi2c-dev
```
- Xml Lint
```
sudo apt-get install libxml2-utils
```
- Make sure `scons` (Software contruction tool) is installed on your system, `scons -v` should return version info, if not:
```
sudo apt install scons
```
**Now you can compile**
```
scons
```
**And run**
```
cd bin
./notochord
```
### CALIBRATION
**At the moment, just a basic manual magnetometer calibration is performed.**
In order to do it, you need a way to read raw data from the sensor. The simple programm `notochord_read` is tweaked in a way that allow you to get just the data you need in a _tab separated values_ format.
So go to the `src` folder and compile it:
```
make notochord_read
```
The proccesing of the raw data is performed by a matlab script created by _Ozan AKTAÞ_: `calib/getMagCalib.m`, so you will need something to run it, like _Octave_. If you don't have it already installed, do:
```
sudo apt install octave
```
**Now you are ready to perform the calibration, follow this steps for each sensor**
## 1.
Plug just the sensor you are about to calibrate to the rPi.
run the `notochord_read` program, saving the output to some file, for example:
```
cd ../bin
./notochord_read > ../calib/arm_mag_dump.tsv
```
with the read program running you need to move your sensor in a manner that the sensed vectors form a sphere around the center. It's not easy to cover all the possible rotations, but a trick that works for me is to think on all the positive and negative axis of the sensor (+-X, +-Y, +-Z, 6 in total), put one of those pointing up, and do a 360° turn arround it (I mean rotate the sensor, not yourself); then move to the next axis, and so on..
----
## 2.
Once you have colected the raw data is time to process it. Navigate to the `calib` folder and run `octave`
```
cd ../calib
octave --no-gui
```
Inside octave read the data you saved in the file, and do the calculations:
```octave
M = dlmread('arm_mag_dump.tsv','\t' ,1,0)
[ Bfield , offset , W_inverted ] = getMagCalib(M)
```
You will get a 3D plot of the raw and corrected data, a cmd line return of the numeric result.
First of all rotate the 3d plot to be sure that the collected data descrives a **not truncated** sphere or ellipsoid. If not you will have to start over from step 1.
If everething is ok, the `offset` and `W_inverted` variables you got in response represent the offset vector to center your "sensed ellipsoid" at the origin (hard-iron effect compensation), and the matrix to deform "sensed ellipsoid" back to a spherical form (soft-iron effect compensation), respectively.
---
## 3.
Now you will have to manualy replace the calibration data you will find in `Chordata.xml`. Look for the K_Ceptor node that represents the sensor you are calibrating, copy the `offset` vector inside the `<calibration type="offset">` node, and the `W_inverted` matrix inside the `<calibration type="matrix">` one.
You are done with this sensor, and free to start over with the next one :)
Sooner or later we will have to automatize this process a little, don't you think?
**TODO document remote console usage!!**
The proccesing of the raw data is performed by a matlab script created by _Ozan AKTAÞ_: `calib/getMagCalib.m`
For more information take a look at our [wiki](http://wiki.chordata.cc) or [forum](http://forum.chordata.cc)
### LICENSE
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment