Skip to content

Commit

Permalink
Extend driver to include sensor type DRVEGRD 169
Browse files Browse the repository at this point in the history
  • Loading branch information
smartBUILDBOT authored Sep 23, 2022
1 parent 77b12fb commit 1a0b8e8
Show file tree
Hide file tree
Showing 24 changed files with 830 additions and 423 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dockerbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: docker build . -t umrr-ros:latest

- name: Building the driver with the docker container
run: docker run --rm -v`pwd`:/code umrr-ros colcon build --packages-select umrr_ros2_driver umrr_ros2_msgs
run: docker run --rm -v`pwd`:/code umrr-ros colcon build

- name: Running the unit/integration tests via the docker container and exit
run: docker-compose up
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ This is the first official versioned release of the `smartmicro_ros2_radars`. It

This major release of the driver includes multi-user interfaces. The driver now supports and publishes data from UMRR96 and UMRR11.
A new test approach has been implemented which simulates the sensors and interfaces with the node hence making the tests more robust.
Requires new sensor firmware, if using UMRR11-T132: V5.1.4 and if using UMRR96-T153: V5.2.4.

## v2.1.0 - 2022-06-02

This minor release of the driver offer ros2 services to communicate with the sensor. The driver now supports mode changes for UMRR96 and UMRR11.
This release also offers the possibilty of configuring the ip addresses of the sensor using ros2 services. The tests are further extended to inlcude ros2 services check.
This release also offers the possibilty of configuring the ip addresses of the sensor using ros2 services. The tests are further extended to inlcude ros2 services check. Requires new sensor firmware, if using UMRR11-T132: V5.1.4 and if using UMRR96-T153: V5.2.4.

## v3.0.0 - 2022-09-23

Major release includes the new smartmicro sensor DRVEGRD 169. The driver offers mode changes and configuration of the DRVEGRD 169 along with publishing the radar targets as pointcloud data. The callbacks for datastream now require a clientID.
25 changes: 19 additions & 6 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,21 @@ ros2 launch umrr_ros2_driver radar.launch.py
### Supported ROS distributions:
- ROS2 foxy

### UMRR-96 radar and Smart Access API version
A [smartmicro](https://www.smartmicro.com/automotive-radar) UMRR96 radar, UMRR11 radar or both are
### UMRR radars and Smart Access API version
A [smartmicro](https://www.smartmicro.com/automotive-radar) UMRR96 radar, UMRR11 radar or UMRR9F radar are
required to run this node. This code is bundled with a version of Smart Access API. Please make
sure the version used to publish the data is compatible with this version:

- Date of release: `June 02, 2022`
- Smart Access Automotive version: `v1.1.0`
- Date of release: `September 22, 2022`
- Smart Access Automotive version: `v2.0.0`
- User interface version: `UMRR96 Type 153 AUTOMOTIVE v1.2.1`
- User interface version: `UMRR11 Type 132 AUTOMOTIVE v1.1.1`
- User interface version: `UMRR9F Type 169 AUTOMOTIVE v1.1.1`

### Sensor Firmwares
This ROS2 driver release is compatible with the following sensor firmwares:
- UMRR11 Type 132: V5.1.4
- UMRR96 Type 153: V5.2.4

### Point cloud message wrapper library
To add targets to the point cloud in a safe and quick fashion a
Expand All @@ -45,6 +51,7 @@ sudo apt install ros-foxy-point-cloud-msg-wrapper
The inputs are coming as network packages generated in either of the following two ways:
- Through directly interfacing with the sensor
- Through a provided pcap file
- Through using the sensor simulators

These inputs are processed through the Smart Access C++ API and trigger a callback. Every time this
callback is triggered a new point cloud message is created and published.
Expand Down Expand Up @@ -77,7 +84,7 @@ For instance, changing the `Index of Transmit Antenna (tx_antenna_idx)` of a UMR
`ros2 service call /smartmicro_radar_node/set_radar_mode umrr_ros2_msgs/srv/SetMode "{param: "tx_antenna_idx", value: 2, sensor_id: 100}"`

## Configuration of the sensors
In order to use multiple sensors (maximum of up to ten sensors) with the node the sensors should be configured separately.
In order to use multiple sensors (maximum of up to eight sensors) with the node the sensors should be configured separately.
The IP addresses of the sensors could be assigned using:
- The smartmicro tool `DriveRecorder`.
- Using the `Smart Access C++ API`
Expand Down Expand Up @@ -112,6 +119,12 @@ The sensor services respond with certain value codes. The following is a lookup
## Development
The dockerfile can be used to build and test the ros driver.

### Prerequisites

- Docker version >= 20.10.14
- Docker compose version >= 1.29.2

## Building and Testing
Accept the agreement and get the smartaccess release
```bash
./smart_extract.sh
Expand All @@ -124,7 +137,7 @@ docker build . -t umrr-ros:latest

Building the driver with the docker container
```bash
docker run --rm -v`pwd`:/code umrr-ros colcon build --packages-select umrr_ros2_driver umrr_ros2_msgs
docker run --rm -v`pwd`:/code umrr-ros colcon build
```

Running the unit and integration tests via the docker compose
Expand Down
20 changes: 18 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
- SMART_ACCESS_CFG_FILE_PATH=/code/simulator/config_umrr11/com_lib_config.json
- LD_LIBRARY_PATH=/code/umrr_ros2_driver/smartmicro/lib-linux-x86_64-gcc_9
entrypoint: ["/code/simulator/simulation/out/bin/simulator"]
command: ["4", "1", "1"]
command: ["4", "1", "1", "A"]
networks:
device_network:
ipv4_address: 172.22.10.101
Expand All @@ -45,15 +45,31 @@ services:
- SMART_ACCESS_CFG_FILE_PATH=/code/simulator/config_umrr96/com_lib_config.json
- LD_LIBRARY_PATH=/code/umrr_ros2_driver/smartmicro/lib-linux-x86_64-gcc_9
entrypoint: ["/code/simulator/simulation/out/bin/simulator"]
command: ["5", "1", "2"]
command: ["5", "1", "2", "A"]
networks:
device_network:
ipv4_address: 172.22.10.102
sensor_2:
depends_on:
build_simulator:
condition: service_completed_successfully
image: umrr-ros:latest
volumes:
- .:/code
environment:
- SMART_ACCESS_CFG_FILE_PATH=/code/simulator/config_umrr9f/com_lib_config.json
- LD_LIBRARY_PATH=/code/umrr_ros2_driver/smartmicro/lib-linux-x86_64-gcc_9
entrypoint: ["/code/simulator/simulation/out/bin/simulator"]
command: ["9", "1", "1", "B"]
networks:
device_network:
ipv4_address: 172.22.10.103
ros_node:
image: umrr-ros:latest
depends_on:
- "sensor_0"
- "sensor_1"
- "sensor_2"
volumes:
- .:/code
command: ["colcon", "test", "--packages-above", "umrr_ros2_driver"]
Expand Down
Empty file added simulator/COLCON_IGNORE
Empty file.
16 changes: 16 additions & 0 deletions simulator/config_umrr9f/com_lib_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Com Lib Config",
"version": "1.0.0",
"client_id": 300,
"role": "slave",
"shared_lib_path": "/code/umrr_ros2_driver/smartmicro/lib-linux-x86_64-gcc_9",
"config_path": "/code/simulator/config_umrr9f",
"user_interface_name": "umrr9f_t169_automotive",
"user_interface_major_v": 1,
"user_interface_minor_v": 1,
"user_interface_patch_v": 1,
"download_path": "",
"instruction_serialization_type": "port_based",
"data_serialization_type": "port_based",
"alive": false
}
12 changes: 12 additions & 0 deletions simulator/config_umrr9f/hw_inventory.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"hwItems": [
{
"type": "eth",
"dev_id": 1,
"iface_name": "eth0",
"port": 55555
}
],
"name": "HW inventory List",
"version": "1.1.0"
}
14 changes: 14 additions & 0 deletions simulator/config_umrr9f/routing_table.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"clients": [
{
"client_id": 1,
"data_serialization_type": "port_based",
"instruction_serialization_type": "port_based",
"ip": "172.22.10.100",
"link_type": "eth",
"port": 55555
}
],
"name": "Client Routing Table",
"version": "1.0.0"
}
4 changes: 3 additions & 1 deletion simulator/simulation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ add_executable(simulator
target_include_directories(simulator PUBLIC
../../umrr_ros2_driver/smartmicro/include
umrr_ros2_driver/smartmicro/include/umrr11_t132_automotive_v1_1_1
umrr_ros2_driver/smartmicro/include/umrr96_t153_automotive_v1_2_1)
umrr_ros2_driver/smartmicro/include/umrr96_t153_automotive_v1_2_1
umrr_ros2_driver/smartmicro/include/umrr9f_t169_automotive_v1_1_1)

target_link_libraries(simulator
com_lib
osal
umrr11_t132_automotivev1.1.1_user_interface
umrr96_t153_automotivev1.2.1_user_interface
umrr9f_t169_automotivev1.1.1_user_interface
dl)

install(TARGETS simulator DESTINATION bin)
91 changes: 58 additions & 33 deletions simulator/simulation/src/simulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ using namespace com::types;
uint64_t identifier;
uint64_t majorVersion;
uint64_t minorVersion;
std::string port;
std::string portFile;


std::shared_ptr<com::common::DataServicesIface> dataServices =
com::common::DataServicesIface::Get();
Expand Down Expand Up @@ -59,13 +62,18 @@ void slave_callback(ClientId clientId, PortId, BufferDescriptor buffer) {
instruction->SetResponse(COM_INSTR_PORT_SUCCESS);
instruction->SetValue(minorVersion);
} else if (instruction->GetSectionId() == 2010 &&
instruction->GetId() == 0) {
std::cout << "Instruction for mode change tx_antenna answered!"
instruction->GetId() == 2) {
std::cout << "UMRR96 mode frequency_sweep set!"
<< std::endl;
instruction->SetResponse(COM_INSTR_PORT_SUCCESS);
} else if (instruction->GetSectionId() == 2010 &&
instruction->GetId() == 2) {
std::cout << "Instruction for mode change sweep_idx answered!"
instruction->GetId() == 4) {
std::cout << "UMRR11 mode angular_separation set!"
<< std::endl;
instruction->SetResponse(COM_INSTR_PORT_SUCCESS);
} else if (instruction->GetSectionId() == 2010 &&
instruction->GetId() == 5) {
std::cout << "UMRR9F mode range_toggle_mode set!"
<< std::endl;
instruction->SetResponse(COM_INSTR_PORT_SUCCESS);
} else {
Expand All @@ -76,51 +84,68 @@ void slave_callback(ClientId clientId, PortId, BufferDescriptor buffer) {
dataServices->SetInstructionBuffer(clientId, *receive, nullptr);
}

void stream_port(std::string portFile) {

dataServices->RegisterInstRecvCallback(slave_callback);

ClientId masterId = 1;
PortId portTargetListId = 66;
std::ifstream ifs(portFile, std::ifstream::binary | std::ios::binary);
std::filebuf *pbuf = ifs.rdbuf();
int size = pbuf->pubseekoff(0, ifs.end, ifs.in);
pbuf->pubseekpos(0, ifs.in);
char *filebuffer = new (std::nothrow) char[size];

if (filebuffer == nullptr) {
std::cout << "error assigning memory!" << std::endl;
}

pbuf->sgetn(filebuffer, size);
BufferDescriptor bufferdesc((uint8_t *)filebuffer, size);
std::this_thread::sleep_for(std::chrono::seconds(1));

if (ERROR_CODE_OK !=
dataServices->StreamDataPort(masterId, portTargetListId, bufferdesc)) {
return;
}

std::cout << "sensor is transmitting data! " << std::endl;
ifs.close();
delete[] filebuffer;

}

int main(int argc, char *argv[]) {
if (argc != 4) {
if (argc != 5) {
std::cout << "Specifiy User Interface for the sensor" << std::endl;
return 1;
}

identifier = strtoll(argv[1], nullptr, 10);
majorVersion = strtoll(argv[2], nullptr, 10);
minorVersion = strtoll(argv[3], nullptr, 10);

port = argv[4];

if (!dataServices->Init()) {
throw std::runtime_error("Data services have not been initialized!");
}

dataServices->RegisterInstRecvCallback(slave_callback);

auto Start = std::chrono::steady_clock::now();

while (1) {
ClientId masterId = 1;
PortId portTargetListId = 66;
std::string portFile = "/code/simulator/targetlist_port.bin";
std::ifstream ifs(portFile, std::ifstream::binary | std::ios::binary);
std::filebuf *pbuf = ifs.rdbuf();
int size = pbuf->pubseekoff(0, ifs.end, ifs.in);
pbuf->pubseekpos(0, ifs.in);
char *filebuffer = new (std::nothrow) char[size];

if (filebuffer == nullptr) {
std::cout << "error assigning memory!" << std::endl;
}

pbuf->sgetn(filebuffer, size);
BufferDescriptor bufferdesc((uint8_t *)filebuffer, size);
std::this_thread::sleep_for(std::chrono::seconds(1));

if (ERROR_CODE_OK !=
dataServices->StreamDataPort(masterId, portTargetListId, bufferdesc)) {
return -1;
if(port == "A") {
std::string portFile = "/code/simulator/targetlist_port_v2_1_0.bin";
stream_port(portFile);
}

std::cout << "sensor is transmitting data! " << std::endl;
ifs.close();
delete[] filebuffer;

if (std::chrono::steady_clock::now() - Start > std::chrono::seconds(40))
else if(port == "B") {
std::string portFile = "/code/simulator/targetlist_port_v3_0_0.bin";
stream_port(portFile);
}
else {
std::cout << "Invalid input!" << std::endl;
}
if (std::chrono::steady_clock::now() - Start > std::chrono::seconds(30))
break;
}
return 0;
Expand Down
File renamed without changes.
Binary file added simulator/targetlist_port_v3_0_0.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion smart_extract.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e

smart_pack=SmartAccessAutomotive_1_1_0.tar.gz
smart_pack=SmartAccessAutomotive_2_0_0.tar.gz
URL_smartbinaries=https://www.smartmicro.com/fileadmin/media/Downloads/Automotive_Radar/Software/${smart_pack}

cat << EOF
Expand Down
Loading

0 comments on commit 1a0b8e8

Please sign in to comment.