Collection of monoDrive client software for different languages.
- Windows 10
- Visual Studio 2019 Community Edition
- VSCode
NOTE: Extract or install these libraries to C:\local
so cmake can find them.
-
- When installing, make sure to choose the option to CMake to your Windows Path variable.
To build the examples the following are required:
- OpenCV Extract to
C:\local\opencv
and addC:\local\opencv\build\x64\vc15\bin
to your PATH environment variable. - Eigen Extract to
C:\local\Eigen3
and addC:\local\Eigen3
to your PATH environment variable.
- Ubuntu 18.04
- VSCode
- Install packages:
sudo apt-get update && sudo apt-get install libboost-dev libboost-system-dev build-essential libeigen3-dev
-
Open VSCode.
-
Add the following VSCode extensions:
-
Select
File -> Open Folder
and navigate to this folder to build the cpp-examples or simulator-cpp-client to build just the client library. -
Use the CMake extension to configure and build
NOTE: Launching automatically fires off a build check in cmake so just setting the launch target will suffice.
Example configuration with fisheye_camera_equidistant
as a build + launch target.
After you've set your build configuration and target, you can run by hitting F5
to run in debug or Ctrl+F5
to run without debugging.
You can include the monoDrive Simulator client in your existing CMake project
by adding the following lines to your CMakeLists.txt
# add monodrive client library from local repo
add_subdirectory(path/to/monodrive-client/monodrive mdclient)
# link targets as needed
target_link_libraries(<mytarget> monodrive)
You can include the monoDrive Simulator client in your existing Bazel project
by adding the following lines to your WORKSPACE
file
local_repository(
name = "monodrive",
path = "path/to/monodrive-client"
)
and the following to your BUILD
files as needed
cc_library(
name = "my_lib",
srcs = [...],
hdrs = [...],
deps = [
...,
"@monodrive//monodrive/core:monodrive"
]
)
You can build and install the monoDrive Simulator client to your Ubuntu system using CMake
mkdir build
cd build
cmake ..
make
sudo make install
This will install the client library under the prefix /usr/local/monodrive/client
.
It can now be included or linked as needed.
For example, to compile your own executable with the monoDrive client library
g++ main.cpp -I/usr/local/monodrive/client/include/ -L/usr/local/monodrive/client/lib -lboost_system -lmonodrive -o my_program
Make library available for dynamic loading
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/monodrive/client/lib
Finally run
./my_program
There are two ways to integrate the monoDrive simulator with ROS.
The first is to configure the sensors to publish data directly to ROS instead of usng TCP streams. This is supported for
IMU, Waypoint, State, Camera and Lidar sensors. The simulator_control
, vehicle_control
, andwheel_vehicle_control
examples demonstrate how to do this.
The second is using TCP/IP streams to receive sensor data, converting that data on a frame by frame basis to ROS
messages, and publishing those on the desired ROS topic. To support this approach, there is a message conversion utility
class in monodrive/ros/src/monodrive_msgs/include/MessageFactory.h
that facilitates converting raw sensor frame data to
ROS messages and vice-versa. The distributed
ROS example demonstrates how to use this approach.
- monoDrive c++ client
- ROS Note: Tested with melodic
- ROS Bridge:
sudo apt-get install ros-melodic-rosbridge-suite
- ROS Joy:
sudo apt-get install ros-melodic-joy
- Execute the following to build the monoDrive ROS library with:
cd ./monodrive/ros
catkin_make
source devel/setup.bash
- Add the monoDrive ROS library setup file to your .bashrc to add the packages to your ros path on terminal load:
echo "source <path/to/monodrive/ros/devel/setup.bash>" >> ~/.bashrc
- Execute the following to build the ROS packages:
cd ./examples/ros
catkin_make
source devel/setup.bash
- Add the examples setup file to your .bashrc to add the packages to your ros path on terminal load:
echo "source <path/to/examples/ros/devel/setup.bash>" >> ~/.bashrc
If you are running both the client and simulator on the same machine you can skip this section as the networking defaults are for local host.
If you are running the simulator and client on separate machines the following networking settings must be configured.
-
Set the IP address and port IDs for the machine running the simulator and the machine running the ros bridge
- In the configuration file,
simulator_control/confg/simulator.json
, set the IP and port (default is9090
) of the machine that will host the ros bridge:
"ros": { "port": 9090, "server": "192.168.86.167" },
- and the IP and port of the simulator:
"server_ip": "192.168.86.168", "server_port": 8999,
- In the configuration file,
-
Forward the ports on both machines (
9090
and8999
) from step 1 or disable the firewalls on both machines.
-
To launch the monoDrive examples create 3 tabs and run each command in a separate terminal:
- Launch rosbridge, you can leave this running:
roslaunch rosbridge_server rosbridge_tcp.launch bson_only_mode:=True
- Start the vehicle control node which will subscribe to the state sensor topic and publish vehicle controls (the simulator does not need to be running)
rosrun vehicle_control node
Note: The vehicle_control example only requires the monodrive_msgs package and provides an example of how to connect your code to monoDrive through ROS messages.
- Make sure the monoDrive simulator is running since the next command will connect to and start the simulator scenario running.
rosrun simulator_control node
- To launch the monoDrive example create 3 tabs and run each command in a separate terminal:
- Make sure the monoDrive simulator is running since the run command will connect to and start the simulator scenario running.
rosrun distributed node
- Connect your joystick to your computer. Check if Linux recognized your joystick.
ls /dev/input/
From the list verify that you can see jx0
or jsX
in the list, this will mean Linux recognize your joystick.
- Make the joystick accessible to the ROS joy node. Where
jsX
isjs0
from the example above.
sudo chmod a+rw /dev/input/jsX
- Setup your the joystick device to use on the joy node . Assumig your joystick is
js0
rosparam set joy_node/dev "/dev/input/js0"
Optional: You can also specify the deadzone as a parameter
rosparam set joy_node/deadzone 0.05
To launch the monoDrive examples create 4 tabs and run each command in a separate terminal:
- Launch rosbridge, you can leave this running:
roslaunch rosbridge_server rosbridge_tcp.launch bson_only_mode:=True
- Start the joy_node.
rosrun joy joy_node
- Start the wheel vehicle control node which will subscribe to the state sensor topic and publish vehicle controls (the simulator does not need to be running)
rosrun wheel_vehicle_control node
Note: The vehicle_control example only requires the monodrive_msgs package and provides an example of how to connect your code to monoDrive through ROS messages.
- Make sure the monoDrive simulator is running since the next command will connect to and start the simulator scenario running.
rosrun simulator_control node
Note: The following table show how the buttons in the G920 wheel map to the ROS message.
AXES | BUTTONS | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|