@@ -86,7 +86,7 @@ Convert::Convert(ros::NodeHandle node, ros::NodeHandle private_nh,
8686 : data_(new pandar_rawdata::RawData()),
8787 drv (node, private_nh, node_type, this ) {
8888
89- m_sRosVersion = " PandarSwiftROS_1.0.36 " ;
89+ m_sRosVersion = " PandarSwiftROS_1.0.37 " ;
9090 ROS_WARN (" --------PandarSwift ROS version: %s--------\n\n " ,m_sRosVersion.c_str ());
9191
9292 publishmodel = " " ;
@@ -344,7 +344,7 @@ int Convert::loadChannelConfigFile(std::string channel_config_content){
344344 m_PandarQTChannelConfig.m_u8MinVersion = std::stoi (versionLine[2 ].c_str ());
345345 }
346346 else {
347- std::cout << " channel config file delimiter is wrong" << versionLine[0 ];
347+ std::cout << " channel config file delimiter is wrong" << versionLine[0 ] << std::endl ;
348348 return -1 ;
349349 }
350350 std::getline (ifs, line);
@@ -366,13 +366,17 @@ int Convert::loadChannelConfigFile(std::string channel_config_content){
366366 std::getline (ifs, line);
367367 std::vector<std::string> ChannelLine;
368368 boost::split (ChannelLine, line, boost::is_any_of (" ," ));
369+ if (ChannelLine.size () != loop_num) {
370+ std::cout << " channel config file format is wrong" << std::endl;
371+ return -1 ;
372+ }
369373 for (int j = 0 ; j < loop_num; j++){
370374 if (ChannelLine.size () == loop_num){
371375 m_PandarQTChannelConfig.m_vChannelConfigTable [j][i] = std::stoi (ChannelLine[j].c_str ());
372376 // printf("%d %d \n",i, m_PandarQTChannelConfig.m_vChannelConfigTable[j][i]);
373377 }
374378 else {
375- std::cout << " loop num is not equal to the first channel line" ;
379+ std::cout << " loop num is not equal to the first channel line" << std::endl ;
376380 return -1 ;
377381 }
378382
@@ -772,7 +776,7 @@ void Convert::init() {
772776 PANDAR128_AZIMUTH_SIZE * header->u8BlockNum +
773777 PANDAR128_CRC_SIZE +
774778 (header->hasFunctionSafety ()? PANDAR128_FUNCTION_SAFETY_SIZE : 0 ));
775- m_iWorkMode = tail->nShutdownFlag & 0x03 ;
779+ m_iWorkMode = tail->getOperationMode () ;
776780 m_iReturnMode = tail->nReturnMode ;
777781 drv.setUdpVersion (m_u8UdpVersionMajor, m_u8UdpVersionMinor);
778782 lidarmotorspeed = tail->nMotorSpeed ;
@@ -953,7 +957,7 @@ int Convert::checkLiadaMode() {
953957 PANDAR128_AZIMUTH_SIZE * header->u8BlockNum +
954958 PANDAR128_CRC_SIZE +
955959 (header->hasFunctionSafety ()? PANDAR128_FUNCTION_SAFETY_SIZE : 0 ));
956- lidarworkmode = tail->nShutdownFlag & 0x03 ;
960+ lidarworkmode = tail->getOperationMode () ;
957961 lidarreturnmode = tail->nReturnMode ;
958962 lidarmotorspeed = tail->nMotorSpeed ;
959963 laserNum = header->u8LaserNum ;
@@ -1221,9 +1225,8 @@ void Convert::calcPointXYZIT(pandar_msgs::PandarPacket &packet, int cursor) {
12211225 // ROS_WARN("#####block.fAzimuth[%u]",u16Azimuth);
12221226 index += PANDAR128_AZIMUTH_SIZE;
12231227
1224- int mode = tail->nShutdownFlag & 0x03 ;
1225- int state = (tail->nShutdownFlag & 0xF0 ) >> 4 ;
1226-
1228+ int mode = tail->getOperationMode ();
1229+ int state = tail->getAngleState (blockid);
12271230 for (int i = 0 ; i < header->u8LaserNum ; i++) {
12281231 /* for all the units in a block */
12291232 uint16_t u16Distance = *(uint16_t *)(&packet.data [0 ] + index);
@@ -1343,7 +1346,7 @@ void Convert::calcQT128PointXYZIT(pandar_msgs::PandarPacket &packet, int cursor)
13431346 int index = 0 ;
13441347 index += PANDAR128_HEAD_SIZE;
13451348 for (int blockid = 0 ; blockid < header->u8BlockNum ; blockid++) {
1346- int loopIndex = blockid;
1349+ int loopIndex = (tail-> nModeFlag + ( blockid / ((tail-> nReturnMode < 0x39 ) ? 1 : 2 )) + 1 ) % header-> u8BlockNum ;
13471350 if ((isSelfDefine && m_PandarQTChannelConfig.m_bIsChannelConfigObtained )){
13481351 loopIndex = (tail->nModeFlag + (blockid / ((tail->nReturnMode < 0x39 ) ? 1 : 2 )) + 1 ) % m_PandarQTChannelConfig.m_vChannelConfigTable .size ();
13491352 }
0 commit comments