- Open a new terminal and source the workspace
cd ~/ros2_helloworld_ws
source install/local_setup.bash
Original setup guide: https://rebrand.ly/ros/install
NOTE: I recommend opening this guide up within the VirtualBox. Here's the short link for easy access: rebrand.ly/ros/quick-install
su
adduser <username> sudo
exit
Create a new package
cd ~/ros2_ws/src
ros2 pkg create monitor_station --build-type ament_python --dependencies rclpy
code monitor_station/
Install extra dependencies
import random | |
CHOICES = ['R', 'P', 'S'] | |
# Ask user for input (rock, paper, or scissors) | |
user_input = input('Rock, paper or scissors (type R, P, or S): ') | |
# Check if user input is valid | |
if user_input not in CHOICES: | |
print('Invalid choice') |
#!/bin/bash | |
# Source: OpenSSL Certificate Authority: https://jamielinux.com/docs/openssl-certificate-authority/index.html | |
# A function which pauses execution until 'Enter' is pressed | |
# If at least one parameter is given, that parameter will be displayed instead | |
pause() { | |
if [ $# -eq 0 ] | |
then | |
read -rsp $'Press enter to continue...\n' |
// Credits go to @Anjuna5 for original code: https://stackoverflow.com/a/39838257/9779148 | |
const mode = arr => [...new Set(arr)] | |
.map(value => [value, arr.filter((v) => v === value).length]) | |
.sort((a,b) => b[1] - a[1]) | |
.filter((v, i, a) => v[1] === a[0][1]) | |
.map(v => v[0]); |