Skip to content

Commit

Permalink
RPLIDAR SDK v1.11.0
Browse files Browse the repository at this point in the history
- [new feature] support 256000 baudrate on macOS
- [improvement] better support for S1 in framegrabber
- [improvement] default tty device is set to /dev/tty.SLAB_USBtoUART instead of /dev/ttyUSB0
  • Loading branch information
tony-slamtec committed May 5, 2019
1 parent dd82dee commit e240433
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 26 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The demo applications are licensed under GPLv3 license.
Release Notes
-------------

* [v1.11.0](https://github.com/slamtec/rplidar_sdk/blob/master/docs/ReleaseNote.v1.10.0.md)
* [v1.10.0](https://github.com/slamtec/rplidar_sdk/blob/master/docs/ReleaseNote.v1.10.0.md)
* [v1.9.1](https://github.com/slamtec/rplidar_sdk/blob/master/docs/ReleaseNote.v1.9.1.md)
* [v1.9.0](https://github.com/slamtec/rplidar_sdk/blob/master/docs/ReleaseNote.v1.9.0.md)
Expand All @@ -36,7 +37,7 @@ RPLIDAR SDK supports Windows, macOS and Linux by using Visual Studio 2010 projec
| ---------------------- | ------- | ----- | ------|
| A1 | Yes | Yes | Yes |
| A2 | Yes | Yes | Yes |
| A3 | Yes | No | Yes |
| A3 | Yes | Yes | Yes |

Quick Start
-----------
Expand All @@ -47,8 +48,6 @@ If you have Microsoft Visual Studio 2010 installed, just open sdk/workspaces/vc1

### On macOS and Linux

> Note: RPLIDAR A3 is not supported on macOS yet, because macOS doens't support the baudrate used by RPLIDAR A3, which is 256000
Please make sure you have make and g++ installed, and then just invoke make in the root directory, you can get the compiled result at `output/$PLATFORM/$SCHEME`, such as `output/Linux/Release`.

make
Expand Down
1 change: 1 addition & 0 deletions docs/ReleaseNote.v1.10.0.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
RPLIDAR Public SDK v1.10.0 Release Note
======================================

- [new feature] support Rplidar S1
6 changes: 6 additions & 0 deletions docs/ReleaseNote.v1.11.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
RPLIDAR Public SDK v1.11.0 Release Note
======================================

- [new feature] support 256000 baudrate on macOS
- [improvement] better support for S1 in framegrabber
- [improvement] default tty device is set to /dev/tty.SLAB_USBtoUART instead of /dev/ttyUSB0
2 changes: 1 addition & 1 deletion sdk/app/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#/*
# * Copyright (C) 2014 RoboPeak
# * Copyright (C) 2014 - 2018 Shanghai Slamtec Co., Ltd.
# * Copyright (C) 2014 - 2019 Shanghai Slamtec Co., Ltd.
# *
# * This program is free software: you can redistribute it and/or modify
# * it under the terms of the GNU General Public License as published by
Expand Down
14 changes: 12 additions & 2 deletions sdk/app/frame_grabber/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ void CMainFrame::onUpdateTitle()
{
char titleMsg[200];
const char * workingmodeDesc;
char deviceDesc[10];
switch (workingMode) {
case WORKING_MODE_IDLE:
workingmodeDesc = "IDLE";
Expand All @@ -314,8 +315,17 @@ void CMainFrame::onUpdateTitle()
assert(!"should not come here");
}

sprintf(titleMsg, "[%s] Model: %d FW: %d.%02d HW: %d Serial: "
if((devInfo.model>>4)>RPLIDAR_T_SERIES_MINUM_MAJOR_ID){
sprintf(deviceDesc,"T%d",(devInfo.model>>4)-RPLIDAR_T_SERIES_MINUM_MAJOR_ID) ;
}else if((devInfo.model>>4)>RPLIDAR_S_SERIES_MINUM_MAJOR_ID){
sprintf(deviceDesc,"S%d",(devInfo.model>>4)-RPLIDAR_S_SERIES_MINUM_MAJOR_ID) ;
}else{
sprintf(deviceDesc,"A%d",devInfo.model>>4) ;
}
sprintf(titleMsg, "[%s] Model: %sM%d(%d) FW: %d.%02d HW: %d Serial: "
, workingmodeDesc
, deviceDesc
, devInfo.model&0xf
, devInfo.model
, devInfo.firmware_version>>8
, devInfo.firmware_version & 0xFF, devInfo.hardware_version);
Expand Down Expand Up @@ -343,12 +353,12 @@ void CMainFrame::onSwitchMode(int newMode)
// stop the previous operation
LidarMgr::GetInstance().lidar_drv->stop();
LidarMgr::GetInstance().lidar_drv->stopMotor();

UISetCheck(ID_CMD_STOP, 1);
UISetCheck(ID_CMD_GRAB_PEAK, 0);
UISetCheck(ID_CMD_GRAB_FRAME, 0);
UISetCheck(ID_CMD_SCAN, 0);
UISetCheck(ID_CMD_GRABFRAMENONEDIFF, 0);
LidarMgr::GetInstance().lidar_drv->clearNetSerialRxCache();
}
break;
case WORKING_MODE_SCAN:
Expand Down
6 changes: 5 additions & 1 deletion sdk/app/frame_grabber/MainFrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ class CMainFrame :
WORKING_MODE_IDLE = 0,
WORKING_MODE_SCAN = 3,
};

enum {
RPLIDAR_A_SERIES_MINUM_MAJOR_ID = 0,
RPLIDAR_S_SERIES_MINUM_MAJOR_ID = 5,
RPLIDAR_T_SERIES_MINUM_MAJOR_ID = 8,
};

DECLARE_FRAME_WND_CLASS(NULL, IDR_MAINFRAME)
CScanView m_scanview;
Expand Down
5 changes: 2 additions & 3 deletions sdk/app/frame_grabber/SerialSelDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
#include "SerialSelDlg.h"

static const int baudRateLists[] = {
115200,
256000,
57600,
1382400
115200,
256000
};

CSerialSelDlg::CSerialSelDlg()
Expand Down
2 changes: 2 additions & 0 deletions sdk/app/ultra_simple/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ int main(int argc, const char * argv[]) {
#ifdef _WIN32
// use default com port
opt_com_path = "\\\\.\\com3";
#elif __APPLE__
opt_com_path = "/dev/tty.SLAB_USBtoUART";
#else
opt_com_path = "/dev/ttyUSB0";
#endif
Expand Down
2 changes: 1 addition & 1 deletion sdk/sdk/include/rplidar.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@

#include "rplidar_driver.h"

#define RPLIDAR_SDK_VERSION "1.10.0"
#define RPLIDAR_SDK_VERSION "1.11.0"
27 changes: 12 additions & 15 deletions sdk/sdk/src/arch/macOS/net_serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "arch/macOS/net_serial.h"
#include <termios.h>
#include <sys/select.h>
#include <IOKit/serial/ioss.h>

namespace rp{ namespace arch{ namespace net{

Expand Down Expand Up @@ -79,16 +80,8 @@ bool raw_serial::open(const char * portname, uint32_t baudrate, uint32_t flags)
tcgetattr(serial_fd, &oldopt);
bzero(&options,sizeof(struct termios));

_u32 termbaud = getTermBaudBitmap(baudrate);
cfsetspeed(&options, B19200);

if (termbaud == (_u32)-1) {
fprintf(stderr, "Baudrate %d is not supported on macOS\r\n", baudrate);
close();
return false;
}
cfsetispeed(&options, termbaud);
cfsetospeed(&options, termbaud);

// enable rx and tx
options.c_cflag |= (CLOCAL | CREAD);

Expand All @@ -111,19 +104,23 @@ bool raw_serial::open(const char * portname, uint32_t baudrate, uint32_t flags)
options.c_oflag &= ~OPOST;

tcflush(serial_fd,TCIFLUSH);
/*
if (fcntl(serial_fd, F_SETFL, FNDELAY))

if (tcsetattr(serial_fd, TCSANOW, &options))
{
close();
return false;
}
*/
if (tcsetattr(serial_fd, TCSANOW, &options))
{

printf("Setting serial port baudrate...\n");

speed_t speed = (speed_t)baudrate;
if (ioctl(serial_fd, IOSSIOSPEED, &speed)== -1) {
printf("Error calling ioctl(..., IOSSIOSPEED, ...) %s - %s(%d).\n",
portname, strerror(errno), errno);
close();
return false;
}

_is_serial_opened = true;

//Clear the DTR bit to let the motor spin
Expand Down

0 comments on commit e240433

Please sign in to comment.