Giter Club home page Giter Club logo

bluesea2's Introduction

BLUESEA ROS driver

Overview


BLUESEA ROS driver is specially designed to connect to the lidar products produced by our company. The driver can run on operating systems with ROS installed, and mainly supports ubuntu series operating systems (14.04LTS-20.04LTS). The hardware platforms that have been tested to run the ROS driver include: Intel x86 mainstream CPU platform, and some ARM64 hardware platforms (such as NVIDIA, Rockchip, Raspberry Pi, etc., which may need to update the cp210x driver).

Get and build the BLUESEA ROS driver package

1.Get the BLUESEA ROS driver from Github and deploy the corresponding location

mkdir bluesea2   											//create a folder and customize it
cd bluesea2    												//into this folder
git clone https://github.com/BlueSeaLidar/bluesea2.git  src //download the driver package and rename it to src

2.Build

catkin_make

3.Update the current ROS package environment

source ./devel/setup.sh

4.Using ROS launch to run drivers

sudo chmod 777 /dev/ttyUSB0 (uart)			//  /dev/ttyUSB0  refers to the serial port name. If it is a serial/virtual serial port model, it needs to be authorized

roslaunch bluesea2 [launch file]    		//The specific launch file description is as follows

Driver launch launch file

explain:[launch file] refers to the configuration files in the src/launch folder, distinguished by functional categories

  • uart_lidar.launch: lidar with serial port connection method
  • udp_lidar.launch: lidar for UDP network communication
  • vpc_lidar.launch: lidar with virtual serial port connection method
  • dual_udp_lidar.launch: lidar with multiple UDP network communication(only one node)
  • template.launch: All parameter definition templates

Main parameter configuration instructions:

#ROS# (mandatory parameter for the framework)
<param name="topic" value="scan" />#Publish topic
<param name="frame_id" value="map" />#Name of the flag coordinate system
 #DATA# (driver-defined data level limiting parameter)
<param name="min_dist" value="0.01" />#Minimum point cloud distance (m)
<param name="max_dist" value="50.0"/>#Maximum point cloud distance (m)
<param name="from_zero" value="false"/>#Whether start angle is from 0 (false is 180).
<param name="output_scan" value="true" />#2D scan data (default)
<param name="output_cloud" value="false"/>#3D spatial data.
<param name="output_360" value="true" />#Output by frame.
<param name="inverted" value="false"/>#Publish data angle parameter inverted(angle_min,angle_max,angle_increment).
<param name="reversed" value="false"/>#Publish data point cloud data reversed (row from last point to first point)
<param name="hard_resample" value="false"/>#hard_resample_factor(if lidar support this command)
<param name="soft_resample" value="false"/>#Soft resample coefficient (need point cloud larger than the minimum number of points for soft resample)
<param name="with_angle_filter" value="false"/>#Angle filter switch.
<param name="min_angle" value="-3.1415926"/>#Minimum available angle.
<param name="max_angle" value="3.1415926"/#Maximum available angle.
<rosparam param="mask1" >[-3.14,3.14]</rosparam>#mask data for angle in this interval
<param name="time_mode" value="0"/>#Timestamp source of packet (default 0 system time, 1 is lidar time synchronized time)
<! -- <rosparam param="mask2" >[-1,0]</rosparam-->#Multiple segments to mask the angle of the interval, mask upwards +1
#CUSTOM# (driver customization function)
<param name="error_circle" value="3"/># Judge the weight of the point with distance 0 Three consecutive circles.
<param name="error_scale" value="0.9"/># 90% of points with distance 0 in each circle will report error.
<param name="group_listener" value="false" />#Only used to listen to multicast data (need to change the upload address of lidar by host computer, and fix the upload, then this driver will listen to the data).
<param name="group_ip" value="224.0.0.11" />#Listen to multicast ip.
#FITTER# (lidar different angular resolution parameters are different, need to be customized)
<param name="filter_open" value="true"/>#Filter enable switch.
<param name="max_range" value="20"/#Maximum range for filtering.
<param name="min_range" value="0.5"/>#Minimum range for filtering.
<param name="max_range_difference" value="0.1"/>#Physical range to judge the divergence.
<param name="filter_window" value="1"/>#Range of subscripts for judging outliers
#CONNECT# (parameter that drives the connection lidar)
<param name="type" value="udp" />
<param name="lidar_port" value="6543" />
<param name="local_port" value="6668" />
<param name="lidar_ip" value="192.168.158.98" />
#GET# (the query command switch that the driver sends to the lidar)
<param name="uuid" value="-1" /> #Query lidar SN number, -1 no query, >=0 query
#SET# (set command switch that driver sends to lidar)
<param name="rpm" value="-1"/#Set lidar rpm (different models of lidar can support different rpm, specific check the manual of the model):-1 not set 600 900 ... Setting
<param name="sample_res" value="-1"/>#set angular resolution (different lidar models can support different angular resolution, check the manual of the model),-1 not set 0 original data 1 angular correction
<param name="with_smooth" value="-1" />#Set de-smooth point, -1 not set 0 off 1 on.
<param name="with_deshadow" value="-1" />#Set filtering, -1 not set 0 off 1 on
<param name="alarm_msg" value="-1" />#set alarm message, -1 not set 0 off 1 on
<param name="direction" value="-1"/>#Set direction of rotation(only used by lidar which support this command),-1 not set 0 off 1 on

Driver Client Functional Description

source code locate at src/client.cpp start/stop rotate:

rosrun bluesea2  bluesea2_client start  0  arg1 is (start/stop)  arg2 is lidar serial (Starting from 0, if it is a negative number, it means that all lidars are executed.)

switch defense zones:

rosrun bluesea2  bluesea2_client switchZone  0    192.168.158.98     arg1 is switchZone   arg2 is defense zones to be switched  arg3 is lidar ip

set rpm:

rosrun bluesea2  bluesea2_client rpm  0 600   arg1 is rpm   arg2 is lidar serial(start from zero)  arg3 is rpm to be set

rosbag bag operating instructions

rostopic list 

Get the topic list, the driver default topic name is /lidar1/scan

rosbag record /lidar1/scan 

Start recording data.

The recorded file is named with a timestamp, to stop recording, CTRL+C in the current terminal

rosbag play packet name

Check the recorded packet in the path where the packet is stored, if it prompts failed connect master exception, then ros master first and then rosbag play.

Business Support

Please contact the technical support (https://pacecat.com/) through the official website for specific usage problems.

bluesea2's People

Contributors

bluesealidar avatar johnrayn avatar mikhailbertrand avatar h-wata avatar

bluesea2's Issues

Port名が長いと`buffer overflow`が出てしまう

概要

catkin build実行時に-DCMAKE_BUILD_TYPE=ReleaseでBuildするとPort名の長さが長くなるとbuffer overflow detected: terminatedのエラーが出て処理落ちする。

再現手順

uart_lidar.launch実行時にport名を長くすると(今回試したのは/dev/ttyLDS50C_head)処理落ちする。
image

※ Defaultの/dev/ttyUSB0で実行する分では問題なし。
※ 検証中、-DCMAKE_BUILD_TYPE=Debugでも問題は起きなかった。

修正しないとどう困るか

現状の指定するときのUSB rulesで指定ができない。

原因

ここで、Nodeを作る際に、

m_driver->openLidarThread();

下記のParserOpen関数が呼ばれたときに、ip変数にport名/dev/ttyUSB0等が入る(m_argdata.connectargs[i].arg1.c_str())。

m_parsers[i] = ParserOpen(m_argdata.raw_bytes, true, m_argdata.dev_id, m_argdata.custom.error_circle, m_argdata.custom.error_scale, m_argdata.from_zero, m_argdata.time_mode,m_cmdlist, (char *)m_argdata.connectargs[i].arg1.c_str(), m_argdata.connectargs[i].arg2);

ParserOpen関数。ここではParserの構造体のConstructを行っている。

bluesea2/sdk/src/parser.cpp

Lines 997 to 1018 in d4c650e

Parser *ParserOpen(int raw_bytes, bool with_chksum, int dev_id,
int error_circle, double error_scale, bool from_zero, int time_mode,
CommandList cmd, char *ip, int port)
{
Parser *parser = new Parser;
parser->rest_len = 0;
parser->raw_mode = raw_bytes;
parser->with_chk = with_chksum;
parser->fan_segs_c7 = NULL;
parser->fan_segs_aa = NULL;
parser->dev_id = dev_id;
parser->error_circle = error_circle;
parser->error_scale = error_scale;
parser->cmd = cmd;
parser->is_from_zero = from_zero;
strcpy(parser->ip, ip);
parser->port = port;
g_timemode = time_mode;
parser->isrun = false;
return parser;
}

Parserの構造体定義でipchar ip[16]で定義されているが、/dev/ttyLDS50C_headは19字となりbufferを超えてしまう。

struct Parser
{
int rest_len;
unsigned char rest_buf[BUF_SIZE];
bool with_chk;
int raw_mode;
uint32_t dev_id;
uint32_t flags;
FanSegment_AA *fan_segs_aa;
FanSegment_C7 *fan_segs_c7;
int error_circle;
float error_scale;
bool is_from_zero;
int time_mode;
CommandList cmd;
char ip[16];
int port;
bool direction;
bool isrun;
};

本来192.168.100.110のようなIPアドレスが入る想定で定義していたのを転用した際の拡張不足かと思われる。

修正案

ip[16]で定義されているものをip[32]に拡張する。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.