In order to be able to run the LocalizationFusionLibrary as a ROS node do the following:
- Follow the guide below to install Ubuntu 18.04 with ROS melodic in WSL and MobaXterm to open GUIs
- Create a catkin workspace
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
cd src/
git clone [email protected]:AD-platform/Tools/libraries/localizationfusionlibrary.git # Clone the library in /catkin_ws/src
cd ~/catkin_ws/
# cp -r path/to/library/localiztionfusionlibrary ~/catkin_ws/src/ # or copy
catkin_make # Build the ros package
- In order to start the node on a test bag do
cd ~/catkin_ws/
source devel/setup.bash
roslaunch LocalizationFusionLibrary filter_ros_node_1.launch
In order to get autocompletion capabilities for ROS related code and to add VSCode shortcuts for building and running add the folder and files as following:
LocalizationFusionLibrary
├── ...
└── .vscode
├── c_cpp_properties.json
└── settings.json
After following a and b, the workflow looks like:
- Open library with vscode:
code ~/catkin_ws/src/localizationfusionlibrary
- Build the ROS package: Ctrl + Shift + B
- Roslaunch a test bag and the filternode: Ctrl + Shift + 3
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c11",
"cppStandard": "c++14",
"intelliSenseMode": "gcc-x64",
"compileCommands": "~/catkin_ws/build/compile_commands.json"
}
],
"version": 4
}
Add shortcuts to build and run the roslaunch file in file->preferences->Keyboard Shortcuts( or Ctrl + KS) and then
- Set Tasks: Run Build Task with Ctrl+Shift+B
- Set Tasks: Run Test Task with Ctrl+Shift+3
{
"version": "2.0.0",
"tasks": [
{
"label": "catkin_make",
"type": "shell",
"command": "catkin_make",
"args": [
"-j4",
"-DCMAKE_BUILD_TYPE=Release",
"-DCMAKE_EXPORT_COMPILE_COMMANDS=1",
"-DCMAKE_CXX_STANDARD=14",
"-C=../../"
],
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "launch_test_1",
"type": "shell",
"command": "source ../../devel/setup.bash; roslaunch LocalizationFusionLibrary filter_ros_node.launch",
"problemMatcher": [],
"group": {
"kind": "test",
"isDefault": true
}
}
]
}
The directory structure should look like this at the end:
catkin_ws
├── build
├── devel
└── src
└── LocalizationFusionLibrary
├── ...
├── .vscode
├── c_cpp_properties.json
└── settings.json
├── package.xml
└── ros_srcs
├── ...
├── package.xml
└── CMakeLists.txt
This approach uses Windows Subsystems for Linux, WSL for short.
- Install Ubnutu 18.04 LTS (for ROS Melodic) or Ubnutu 16.04 LTS (for ROS Kinetic) via WSL in Windows.
- Open the installed Ubuntu distro you just installed and install ROS on it
- Install MobaXterm by following the following article
- Install VSCode and the Remote-WSL plugin.
Add the following lines to your ~/.bashrc
export DISPLAY=192.168.0.183:0.0 # or whatever you read on MobaXterm
alias open='explorer.exe .'
cd ~
To try out if it works, open MobaXterm and minimize it. In a Linux terminal give xterm
. If a graphical window shows up, everythingis working. Now we could even open up other GUIs such as RVIZ or RQT.
If faced with error messages related to D-bus read this article
If faced with error related to Segmentation error Segmentation fault (core dumped) add the following to your ~/.bashrc
export LIBGL_ALWAYS_INDIRECT=
The solution was found here
With the help of this
Open Windows Terminal and press Ctrl+, and copy the setting in profile.json
- Split vertically: Ctrl+Shift+O
- Split horizontally: Ctrl+Shift+E
- Close split: Ctrl+W
- Move around splits: Alt + up/down/left/right