A ROS Python package for the Sphero RVR - used on a Raspberry Pi.
Please note: this code is still in the middle of the development process!
- Install Raspberry Pi OS (fka Rasbpian) on your Raspberry Pi (Instruction).
sudo ssh-keygen -A
- Start ssh:
sudo systemctl restart ssh.service
sudo raspi-config
Choose:
- Interfacing Options
- P5 Serial
- No (No Login shell over serial port)
- Yes (Enable serial port hardware)
Do not reboot now!
- Change /boot/cmdline.txt file regarding tty-entries to this (credits to richard_mark):
[...] console=tty1 [...]
sudo nano /boot/cmdline.txt
- Add your user to the dialout group:
sudo gpasswd --add ${USER} dialout
- Now reboot the Raspberry Pi!
sudo apt-get install joystick
- Supported by the Kernel - if used with the USB connector.
- Connect a Gamepad to the Pi, start the following command and press any buttons or move some axes:
jstest --normal /dev/input/js0
-
Install ROS Noetic on your Raspberry Pi (Instruction):
-
Install ROS packages (+++ TO BE CHECKED !!! +++):
sudo apt-get install ros-melodic-urg-node ros-melodic-teleop-twist-keyboard joystick ros-melodic-joystick-drivers ros-melodic-teleop-twist-joy
- Create your own development directory "develop"
mkdir ~/develop
cd ~/develop
- Clone this repository
git clone https://github.com/markusk/rvr.git
- Create a catkin workspace without 'src' subfolder:
mkdir ~/catkin_ws
cd ~/catkin_ws
- Create symbolic link with the name 'src', pointing to the 'src' folder in the ROS directory from this repository:
ln -s ~/develop/rvr/ROS/catkin_workspace/src/ src
catkin_make
- Setup SDK with method 2: Instructions
- Without pipenv:
pip3 install aiohttp pyserial_asyncio
cd ~/develop
git clone https://github.com/sphero-inc/sphero-sdk-raspberrypi-python
- Create symbolic link, pointing to the 'sphero_sdk' folder:
ln -s ~/develop/sphero-sdk-raspberrypi-python/sphero_sdk/ ~/develop/rvr/ROS/catkin_workspace/src/rvr/lib/
- Start the ROS test program:
cd ~/catkin_ws/src/rvr/nodes
./test.py
- The output should look something like this:
Checking RVR firmware versions...
Checking CMS firmware versions...
Firmware check complete.
Battery percentage: 90 %
Voltage state: 1
Voltage states: [unknown: 0, ok: 1, low: 2, critical: 3]
Note: The firmware check seems to pop up from time to time.
- Start the ROS launch file:
cd ~/catkin_ws
roslaunch rvr test.launch
- The output should look like above.
- Exit the program with CTRL-C.
- Run the main launch file on the robot (Raspberry Pi):
cd ~/catkin_ws
roslaunch rvr rvr.launch
to do: On another computer (the ground control center):
export ROS_MASTER_URI=http://<hostname>:11311
rosparam set joy_node/dev "/dev/input/js1"
roslaunch rvr ground_control_center.launch
sudo cp raspi/etc__systemd__system__rvr-ros-start.service /etc/systemd/system/rvr-ros-start.service
sudo systemctl daemon-reload
sudo systemctl start rvr-ros-start.service
sudo systemctl enable rvr-ros-start.service
Listens to a teleop_twist_keyboard node and prints out the data/messages. Uses:
- teleop_twist_keyboard
- nodes/keyboard_listener.py
Controls the motors on the robot. Uses:
- motor_server.py
Controls the whole robot. To be started on the robot. Uses:
- motor_server.py
to do:
- tf_broadcaster.py
- battery_publisher.py
- imu_bno055.py
- base_controller.py
- minibot_camera
- urg_node