A game of snake in rviz2; This was made for fun as an introduction for ROS2.
Currently, this has only been tested for rclcpp
for ROS2 Galactic, though it is very likely it will work perfectly fine on anything slightly older. In addition, you'll need to have rviz2 installed and ncurses (for user input) installed via sudo apt-get install libncurses-dev
.
Firstly, source your ros2 installation.
- Build the project by heading into the root directory and running
colcon build
. - Source project via
source install/setup.bash
. - Run the game via
ros2 run snake_publisher publisher
. - In a separate terminal, run
rviz2 src/snake_publisher/rvizSetup.rviz
.
With that, the game should run. Input is taken at the terminal where ros2 run
was run.
Currently, the following node parameters are implemented:
game_fps
- Rate at which the game updates.input_fps
- Rate at which input is processed from the queue.snake_color_*
- Color of the snake in its RGB components.fruit_color_*
- Color of the fruit in its RGB components.grid_color_*
- Color of the grid in its RGB components.
- No launch file is provided (I could make one in the future)
- Game will crash if you are good enough to fill up the entire board.
- After awhile, messages will slowly be delayed by a noticable amount; Simply restart rviz2 OR turn off and on the Marker display (don't ask me why this works)