Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firmware download and custom plugin #43

Merged
merged 10 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@ This release includes the new DRVEGRD 171 and DRVEGRD 152 user-interface. The re

## v5.0.0 - 2023-09-22

This release includes CAN communication for all the provided sensor types and sensors interfaces. The params are now extended to include the params/setting for the connected adapters along with the sensor params.
This release includes CAN communication for all the provided sensor types and sensors interfaces. The params are now extended to include the params/setting for the connected adapters along with the sensor params.

## v6.0.0 - 2023-12-20

This release includes features for downloading sensor firmware on to the sensors. It also provides custom RVIZ plugins to log the target list data, record and save it. It has a plugin to send instructions to the sensors and also it is possible to dowload the firmware too. This release also includes a python GUI to send custom CAN messages. The radar param templates have now been merged into one param file. The pointcloud has been extended to also include the polar coordinates. Additionally, the release also includes new user interface for sensor A4 T171.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
FROM ros:foxy

## Revert to snapshot once GPG key error is resolved
RUN rm /etc/apt/sources.list.d/ros2-snapshots.list
RUN apt-get update && apt-get install curl -y
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

RUN apt-get update && apt-get install -y \
iputils-ping \
python3 \
python3-pip \
ros-foxy-point-cloud-msg-wrapper \
ros-foxy-rviz2 \
ros-foxy-rviz-common \
ros-foxy-rviz-default-plugins \
ros-foxy-rviz-rendering \
wget

WORKDIR /code
57 changes: 51 additions & 6 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ acquired by the sensor through the ROS2 pipeline. This package implements such a
ros2 launch umrr_ros2_driver radar.launch.py
```

## How to launch the rviz with recorder plugin
From a separate terminal and after sourcing workspace
```
rviz2 -d [`recorder.rviz`](smart_rviz_plugin/config/rviz/recorder.rviz)
```

![Recorder](smart_rviz_plugin/config/images/recorder_rviz.png "Rviz Outlook")

## How to start the custom can message sender
From smart_rviz_plugin folder
```
python custom_can_sender.py
```

![Sender](smart_rviz_plugin/config/images/can_sender.png "Custom CAN Sender")

## Prerequisites

### Supported ROS distributions:
Expand All @@ -26,8 +42,8 @@ A [smartmicro](https://www.smartmicro.com/automotive-radar) UMRR96, UMRR11, DRVE
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: `September 22, 2023`
- Smart Access Automotive version: `v3.4.0`
- Date of release: `December 20, 2023`
- Smart Access Automotive version: `v3.5.0`
- User interface version: `UMRR96 Type 153 AUTOMOTIVE v1.2.2`
- User interface version: `UMRR11 Type 132 AUTOMOTIVE v1.1.2`
- User interface version: `UMRR9F Type 169 AUTOMOTIVE v1.1.1`
Expand All @@ -37,6 +53,7 @@ sure the version used to publish the data is compatible with this version:
- User interface version: `UMRR9D Type 152 AUTOMOTIVE v1.0.3`
- User interface version: `UMRR9D Type 152 AUTOMOTIVE v1.2.2`
- User interface version: `UMRRA4 Type 171 AUTOMOTIVE v1.0.1`
- User interface version: `UMRRA4 Type 171 AUTOMOTIVE v1.3.0`

### Sensor Firmwares
This ROS2 driver release is compatible with the following sensor firmwares:
Expand All @@ -48,6 +65,7 @@ This ROS2 driver release is compatible with the following sensor firmwares:
- UMRR9F Type 169: V2.0.2
- UMRR9F Type 169: V2.2.0
- UMRRA4 Type 171: V1.0.0
- UMRRA4 Type 171: V1.2.1

### Point cloud message wrapper library
To add targets to the point cloud in a safe and quick fashion a
Expand All @@ -57,6 +75,11 @@ this project's node. This project can be installed either through `rosdep` or ma
sudo apt install ros-foxy-point-cloud-msg-wrapper
```

To use the GUI provided, it is required to install the following package:
```
pip install python-can
```

## Inputs / Outputs / Configuration

### The inputs:
Expand Down Expand Up @@ -98,7 +121,7 @@ For the setting up the ***sensors***:
- `history_size`: size of history for the message publisher
- `inst_type`: the type of instruction serialization type, relevant to sensors using ethernet and should be 'port_based'
- `data_type`: the type of data serialization type, relevant to sensors using ethernet and should be 'port_based'
- `uifname`: the user interface name of the sensor
- `uifname`: the user interface name of the sensor (refer to the [`user_interfaces`](umrr_ros2_driver/smartmicro/user_interfaces/))
- `uifmajorv`: the major version of the sensor user interface
- `uifminorv`: the minor version of the sensor user interface
- `uifpatchv`: the patch version of the sensor user interface
Expand All @@ -124,12 +147,13 @@ A ros2 `SetMode` service should be called to implement these mode changes. There
For instance, changing the `Index of Transmit Antenna (tx_antenna_idx)` of a UMRR-11 sensor to `AEB (2)` mode would require the following call:
`ros2 service call /smart_radar/set_radar_mode umrr_ros2_msgs/srv/SetMode "{param: "tx_antenna_idx", value: 2, sensor_id: 100}"`

Similarly, a ros2 `SendCommand` service could be used to send commands to the sensors. There are two inputs for sending a command:
Similarly, a ros2 `SendCommand` service could be used to send commands to the sensors. There are three inputs for sending a command:
- `command`: name of the command (specific to the sensor interface)
- `value`: the value of the command
- `sensor_id`: the id of the sensor to which the service call should be sent.

The call for such a service would be as follows:
`ros2 service call /smart_radar/send_command umrr_ros2_msgs/srv/SendCommand "{command: "comp_eeprom_ctrl_default_param_sec", sensor_id: 100}"`
`ros2 service call /smart_radar/send_command umrr_ros2_msgs/srv/SendCommand "{command: "comp_eeprom_ctrl_default_param_sec", value: 2, sensor_id: 100}"`

## Configuration of the sensors
In order to use multiple sensors (maximum of up to eight sensors) with the node the sensors should be configured separately.
Expand All @@ -148,9 +172,23 @@ value in decimal `3232238400` should be used.
The call for such a service would be as follows:
`ros2 service call /smart_radar/set_ip_address umrr_ros2_msgs/srv/SetIp "{value_ip: 3232238400, sensor_id: 100}"`

Note: For successfull execution of this call it is important that the sensor is restarted, the ip address in the
Note: For successful execution of this call it is important that the sensor is restarted, the ip address in the
[`radar.template.yaml`](umrr_ros2_driver/param/radar.template.yaml) is updated and the driver is build again.

## Firmware download
All the smartmicro radar sensors have independent firmware which are updated every now and than. To keep the sensor updated a firmware download
needs to be performed.

A ros2 `FirmwareDownload` service should be called to implement these mode changes. There are two inputs to a ros2 service call:
- `file_path`: the path where the firmware is located
- `sensor_id`: the id of the sensor to which the service call should be sent.

The call for such a service would be as follows:
`ros2 service call /smart_radar/firmware_download umrr_ros2_msgs/srv/FirmwareDownload "{sensor_id: 100, file_path: '/path/to/firmware/file'}"`

Note: The download could be performed only for one sensor at a time!
Important: The download requires that the transfer length of the interface is set to minimum 4k!

## Sensor Service Responses
The sensor services respond with certain value codes. The following is a lookup table for the possible responses:

Expand All @@ -163,6 +201,13 @@ The sensor services respond with certain value codes. The following is a lookup
7 | Value out of minimal bounds
8 | Value out of maximal bounds

## Recorder plugin and custom CAN sender
A custom plugin for rviz to log the target list has been provided. A config file is available which adds this plugin to the rviz. WIth the plugin
it is now possible to view the target list data for the desired sensor. Along with logging the data the plugin also gives the possibility to record
the target list data, convert it into a csv format and save it.

Separately, a python GUI is also provided with which it is possible to send custom CAN messages.

## Development
The dockerfile can be used to build and test the ros driver.

Expand Down
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_3_4_0.tgz
smart_pack=SmartAccessAutomotive_3_5_0.tgz
URL_smartbinaries=https://www.smartmicro.com/fileadmin/media/Downloads/Automotive_Radar/Software/${smart_pack}

cat << EOF
Expand Down
101 changes: 101 additions & 0 deletions smart_rviz_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
cmake_minimum_required(VERSION 3.11)

project(smart_rviz_plugin)

# Default to C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Wnon-virtual-dtor -Woverloaded-virtual)
endif()

add_definitions(-D_BUILD_DIR_PATH="${CMAKE_CURRENT_BINARY_DIR}")
add_definitions(-D_SRC_DIR_PATH="${CMAKE_CURRENT_SOURCE_DIR}")

find_package(ament_cmake_auto REQUIRED)
find_package(umrr_ros2_msgs REQUIRED)
find_package(rviz_common REQUIRED)
find_package(rviz_default_plugins REQUIRED)
find_package(rviz_rendering REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Widgets Test)
find_package(pluginlib REQUIRED)
find_package(rclcpp REQUIRED)


set(CMAKE_AUTOMOC ON)

set(smart_rviz_plugin_SRCS
src/smart_recorder.cpp
src/smart_services.cpp
src/smart_download.cpp
)

set(smart_rviz_plugin_HDRS
include/smart_rviz_plugin/smart_recorder.hpp
include/smart_rviz_plugin/smart_services.hpp
include/smart_rviz_plugin/smart_download.hpp
)

add_library(smart_rviz_plugin SHARED
${smart_rviz_plugin_SRCS}
${smart_rviz_plugin_HDRS}
)

set(dependencies
umrr_ros2_msgs
pluginlib
Qt5
rclcpp
rviz_common
rviz_default_plugins
rviz_ogre_vendor
rviz_rendering
std_msgs
)

ament_target_dependencies(smart_rviz_plugin
${dependencies}
)

target_include_directories(smart_rviz_plugin PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/smart_rviz_plugin>
${Qt5Widgets_INCLUDE_DIRS}
)


target_link_libraries(smart_rviz_plugin
rviz_common::rviz_common
)


target_compile_definitions(smart_rviz_plugin PRIVATE "RVIZ_DEFAULT_PLUGINS_BUILDING_LIBRARY")

pluginlib_export_plugin_description_file(rviz_common plugins_description.xml)

install(
TARGETS smart_rviz_plugin
EXPORT smart_rviz_plugin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

install(
DIRECTORY include/
DESTINATION include/
)

ament_export_targets(smart_rviz_plugin HAS_LIBRARY_TARGET)
ament_export_dependencies(
rclcpp
rviz_common
rviz_ogre_vendor
sensor_msgs
umrr_ros2_msgs
)

ament_package()
Binary file added smart_rviz_plugin/config/images/can_sender.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
Panels:
- Class: rviz_common/Displays
Help Height: 78
Help Height: 0
Name: Displays
Property Tree Widget:
Expanded:
- /Global Options1
- /Status1
- /Grid1
- /Grid1/Offset1
- /PointCloud21
- /Axes1
Splitter Ratio: 0.5
Tree Height: 762
Tree Height: 370
- Class: rviz_common/Selection
Name: Selection
- Class: rviz_common/Tool Properties
Expand All @@ -24,6 +20,10 @@ Panels:
- /Current View1
Name: Views
Splitter Ratio: 0.5
- Class: smart_rviz_plugin/TargetList Recorder
Name: TargetList Recorder
- Class: smart_rviz_plugin/Smart Command Configurator
Name: Smart Command Configurator
Visualization Manager:
Class: ""
Displays:
Expand Down Expand Up @@ -74,7 +74,7 @@ Visualization Manager:
Durability Policy: Volatile
History Policy: Keep Last
Reliability Policy: Reliable
Value: /umrr/targets_0
Value: /smart_radar/targets_0
Use Fixed Frame: true
Use rainbow: true
Value: true
Expand Down Expand Up @@ -148,17 +148,21 @@ Visualization Manager:
Saved: ~
Window Geometry:
Displays:
collapsed: true
Height: 985
Hide Left Dock: true
collapsed: false
Height: 2090
Hide Left Dock: false
Hide Right Dock: true
QMainWindow State: 000000ff00000000fd00000004000000000000015600000383fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073000000003b00000383000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f00000383fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003b00000383000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d00650100000000000004500000000000000000000004d40000038300000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
QMainWindow State: 000000ff00000000fd0000000400000000000007d7000007c4fc020000000afb0000001200530065006c0065006300740069006f006e00000001e10000009b0000006a00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c0061007900730100000045000001b8000000e800fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb00000026005400610072006700650074004c0069007300740020005200650063006f007200640065007201000002040000049c0000010e00fffffffb000000340053006d00610072007400200043006f006d006d0061006e006400200043006f006e0066006900670075007200610074006f007201000006a7000001620000016200ffffff000000010000010f00000383fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003b00000383000000be00fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d0065010000000000000450000000000000000000000722000007c400000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
Selection:
collapsed: false
Smart Command Configurator:
collapsed: false
TargetList Recorder:
collapsed: false
Tool Properties:
collapsed: false
Views:
collapsed: true
Width: 1236
X: 263
Y: 67
Width: 3840
X: 0
Y: 33
Loading
Loading