Sensors

Posted by Bryan on August 16, 2017

LadyBug

Install Official deb driver

===============================================================================

sudo apt-get install xsdcxx
sudo dpkg -i <ladybug5driver.deb> //download from official web

Keep in mind that PTGrey SDK Flycapture CANNOT be installed simultaneously with Ladybug SDK.

需要修改grub图像大小,否则可以检测到设备但无法采集到图像!

===============================================================================

On Linux systems, image size is restricted to 2MiB or less by default. To increase this limit so that you can make use of your imaging hardware’s full
capabilities, you will need to make a minor change to your system. Steps to make the change can be found below, or at ptgrey.

The USBFS buffer size is too small for 16 MB by default.

  • To temporarily set the maximum usbfs memory limit, run this command: sudo modprobe usbcore usbfs_memory_mb=1000
  • To permanently set the maximum usbfs memory limit: Open the /etc/default/grub file in any text editor.

Find and replace: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" with this: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash usbcore.usbfs_memory_mb=1000"

  • Update grub with these settings: sudo update-grub
  • You may need to reboot. WARN: make sure updating grub successful and reboot.
    If this method fails to set the memory limit, run the following command: sudo sh -c 'echo 1000 > /sys/module/usbcore/parameters/usbfs_memory_mb'
    To confirm that you have successfully updated the memory limit, run the following command: cat /sys/module/usbcore/parameters/usbfs_memory_mb

LADYBUG REMOVAL

=============================================================================== To uninstall: sudo dpkg -r ladybug
To uninstall & remove installation config files after uninstall: sudo dpkg -P ladybug

可选的安装

#Ubuntu 16.04
sudo apt-get install libraw1394-11 libgtkmm-2.4-1v5 libglademm-2.4-1v5 libgtkglextmm-x11-1.2-dev libgtkglextmm-x11-1.2 libusb-1.0-0

Driver file

AutoWare Point Grey Camera

Parameter Type Description
SCALE float Defines the downscale ratio (between 0.1 and 1.0).
CalibrationFile string Path to an Autoware-compatible calibration file to be published in the camera_info topic related to this camera.

由驱动所想到的

LKMs(Loadable Kernal Modules) are not user space programs. They are part of the kernel and different from the base kernel module in the interest of booting. Base moudule is loaded by computer booting, otherwise, LKM is not.

  • LKMs are used for six main things:
  • Device drivers.
  • Filesystem drivers(interpret the contents of a filesystem as files and dir and such. For example, there’s a filesystem driver for the ext2 filesystem type used almost universally on Linux disk drives.).
  • System call.
  • Network drivers.
  • TTY line disciplines(These are essentially augmentations of device drivers for terminal devices.).
  • Executable interpreters.

Loaded modules are shown in file called /proc/modules. lsmod lists the currently loaded LKMs, but all it does is dump the contents of /proc/modules.

[XSENS]

Xsens wire

使用的线缆名称为CA-MP2-MTi,9pin–9根线,连接电源到Vin和GND,连接USB+和USB-/电源地到USB接头。
serial RS232 有问题,无论连接tx/rx/电源地或者tx/rx或者交换tx/rx都无法与Windows上官方suite软件中的MT Manager通信,所以放弃使用串口,使用自制的USB接口

Xsens Prerequisites

  1. Install the MTi USB Serial Driver
    $ git clone https://github.com/xsens/xsens_mt.git
    $ cd ~/xsens_mt
    $ make
    $ sudo modprobe usbserial
    $ sudo insmod ./xsens_mt.ko # install module to /lib/modules/$(uname -r)/driver/usb/serial
    $ sudo reboot
    
  2. Run mtsdk_linux_4.8.sh in the “MT_Software_Suite_Linux_4.8”

    Download official software “MT_Software_Suite_Linux_4.8”.
    Test hardware connection and communication. Enter the installation directory you like.
    To test hardware, go to installed directory “MT_software/examples/mtsdk”, type “make src_cpp”;
    run “./example”, enter COM port name:/dev/ttyUSB0, baud rate: 115200
    The result shows the following:
    xsen_test_example

  3. Install gps_common
    $ sudo apt-get install ros-distro-gps-common
    

Xsens driver in Ros

sudo chmod 777 /dev/ttyUSB0
rosrun xsens_driver mtdevice.py --configure=oe50,aa50,wr50,vv50,pl20 #publish sensor data,set as 50Hz
roslaunch xsens_driver xsens_driver.launch

说明:iu: UTMtime, oe: Euler angle, aa: acceleration, wr: rate of turn, pl: latitudeLongitude, vv: velocity

Xsens message 格式

MT Low Level Communication Protocol documentation (LLCP)

以上文档中的page10注明了Xsens发出的信息格式详细情况

Xsens driver程序大致流程

  • 二进制流根据以上的message格式解释为对应的各种物理意义的量,并存储在一个dict中,这是在函数parse_MTData2(self, data)中实现的
  • 通过函数locals()find_handler_name(n),找到对应的函数的句柄,解析刚刚得到的数据,结果放在msgs中,最后publish出去

补充

文件的属主、属组可以通过chown命令更改。文件的权限可以通过chmod命令修改。

groups #查看所有group名称
users  #查看所有user名称
groupadd <group_name> #add new group
gpasswd -a <user_name> <group_name> #将用户加到组中,重启电脑生效
gpasswd -d <user_name> <group_name> #将用户从组中移除
  • 使用groups命令查看用户所在组的名称:
    groups inin
    
  • make sure that your $USER is in dialout group, you can use following commands:
    sudo usermod -G dialout -a $USER
    

Calibration (in windows)

Mti-710 needs sufficient velocity to do good heading estimation– search north
Since the yaw of the MTi-G-700/710 is referenced by comparing GNSS acceleration with the on-board accelerometers, more movement (when GNSS is available) will result in a better yaw.
The minimal acceleration and movement for the yaw to be estimated is above 7 m/s.
In general, the more accelerations and movement will result in a better yaw. At lower speeds the yaw might be less accurate and take longer. If the velocity is lower, a good option might be to select the GeneralMag filter profile which also uses the magnetometer to stabilize the yaw.

Xsens与差分Novatel对比

If you want to see result in detail, click here

[Electronic Scan Radar]

PCAN

pcan has two mode: chardev(default) and netdev. If netdev, the can device can be seen a network device, which can be found via ifconfig -a.

#check pcan device in chardev mode
cat /dev/pcan0
#write msg to can
echo "m s 3 01 02 03" > /dev/pcan0
echo "[msg/command] [standard/extend] [len] msg1 msg2 msglen" > devname
#check can status
lspcan -i
#check can setting
cat /proc/pcan

However, I choose another way using socketcan not pcan to read esr via Kvaser device(usb) and detail can be found in my github repo

Donation

If you think this useful for you, you can donate for me. Thank you for your support!

weixin zhifubao