Gazebo simulation packages for the SD Twizy vehicle
The original repository was designed to work with ROS Kinetic. This version has been modified to work with ROS Noetic (Ubuntu 20.04).
For the original version, please visit the original StreetDrone repository.
- ROS noetic ros-noetic-desktop-full
- Catkin Command Line Tools catkin_tools
- Gazebo ros-noetic-gazebo-ros-pkgs
This model has been tested with Gazebo 11. Run gazebo --version
to make sure you have the correct version installed.
For users who prefer not to install all the dependencies, a Docker container is available. This container has all the necessary dependencies pre-installed.
To use the Docker container, please follow the instructions provided at the following link:
apt install \
ros-noetic-teleop-twist-keyboard \
ros-noetic-joy \
ros-noetic-velodyne-simulator
ros-noetic-teleop-twist-keyboard
is required for the keyboard control.ros-noetic-joy
is required for the joystick control.ros-noetic-velodyne-simulator
is required for the Velodyne VLP-16 LiDAR model.
To setup your workspace after installing ROS noetic and catkin tools, do:
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws
catkin init
For more information, visit create_a_workspace
cd ~/catkin_ws/src
git clone https://github.com/alunos-pfc/TwizyModel-Noetic.git
cd ~/catkin_ws
catkin config --extend /opt/ros/noetic
rosdep install --from-paths src/ --ignore-src -r -y
catkin build
After the built has successfully finished, source ros and your workspace:
source /opt/ros/noetic/setup.bash
source ~/catkin_ws/devel/setup.bash
Due to a bug in Gazebo, the required models are not downloaded automatically, so we provide a script to download them.
Before running the simulation, you can download the required models by using the provided script:
cd ~/catkin_ws/src/TwizyModel-Noetic/streetdrone_model
./download_models.sh
That step is optional, but if you don't do it, you will only be able to use empty world.
This launches the vehicle model in Gazebo and RViz for visualizing the sensors' output.
roslaunch sd_robot sd_twizy_empty.launch
# OR roslaunch sd_robot sd_twizy_worlds.launch enable_rviz:=true world:=empty
For more detailed information on launch, refer to the robot page
LiDAR: VLP - 16 Velodyne
Cameras: 8 x Blackfly S 2.3MP
The scripts for the sensors are written based on the common scripts that exist for sensors in Gazebo.
The robot supports the generic Linux
joystick controllers. The sd_control
package contains a node to turn joystick commands into control
messages that drive the throttle and steering of the model. To use
this, launch a simulation as described above, then run the following:
roslaunch sd_control sd_twizy_control_teleop.launch
You can map specific buttons using the parameters defined in that launch file. For instance, the following uses the left stick for throttle, the right stick for steering, and right button (RB) to enable control on a Logitech F710 Gamepad:
roslaunch sd_control sd_twizy_control_teleop.launch enable_button:=5 throttle_axis:=1 steer_axis:=2
The simulation can also be controlled by the keyboard.
To launch the sd_teleop_keyboard node, run the following:
bash ~/catkin_ws/src/TwizyModel-Noetic/streetdrone_model/sd_control/keyboardlaunch.sh
And follow the instructions on the terminal.
Once the simulation is running, you can record the LiDAR data by running the following command in a new terminal window:
rosbag record -O <Filename>.bag /points_raw
To stop recording, press Ctrl+C
in the terminal window where the rosbag record command was executed.
The StreetDrone Vehicle Interface is a ROS package that provides a bridge between the SD-TwizyModel simulation and the StreetDrone Vehicle API.
cd ~/catkin_ws/src
git clone --single-branch -b melodic-devel https://github.com/streetdrone-home/SD-VehicleInterface.git
rm -r ~/catkin_ws/src/SD-VehicleInterface/msgs/
The SD-VehicleInterface package is not compatible with ROS Noetic. To fix this, you need to change the code in the socketcan_bridge_node.cpp file.
Open the file SD-VehicleInterface/vehicle_interface/src/socketcan_bridge/socketcan_bridge_node.cpp
in a text editor of your choice.
Replace the existing code in line 45:
can::ThreadedSocketCANInterfaceSharedPtr driver = std::make_shared<can::ThreadedSocketCANInterface> ();
with the following code:
std::shared_ptr<can::ThreadedInterface<can::SocketCANInterface>> driver = std::make_shared<can::ThreadedSocketCANInterface>();
Or simply run the following command:
sed -i 's/can::ThreadedSocketCANInterfaceSharedPtr/std::shared_ptr<can::ThreadedInterface<can::SocketCANInterface>>/' ~/catkin_ws/src/SD-VehicleInterface/vehicle_interface/src/socketcan_bridge/socketcan_bridge_node.cpp
cd ~/catkin_ws
catkin build vehicle_interface
After building the SD-VehicleInterface package and starting the simulation, you can launch the SD-VehicleInterface package:
- Open a new terminal window.
- Source ros and your workspace:
source /opt/ros/noetic/setup.bash
source ~/catkin_ws/devel/setup.bash
- Run the following command:
roslaunch sd_vehicle_interface sd_vehicle_interface.launch sd_vehicle:=twizy sd_gps_imu:=none sd_simulation_mode:=true
For more detailed information on the StreetDrone Vehicle Interface, refer to the official documentation: SD-VehicleInterface Documentation