Exposes some functionalities for the Capstone VSLAM projects in ROS. Avoids complicated install and possible latency issues with other ROS implementations.
- Make sure you are on Ubuntu 20.04 LTS with ROS Noetic installed. If you are unable to use a dual boot or Ubuntu, VirtualBox is recommended (install Ubuntu 20.04 there).
- The robot used is Nao 6.
- Download the SDK from here, preferably to the home
~
folder. - Right-click the .tar.gz file and click Extract Here. Make sure the top extracted folder is called
naoqi-sdk-2.8.5.10-linux64
and contains atoolchain.xml
(not in any nested folders). - Rename the top extracted folder from
naoqi-sdk-2.8.5.10-linux64
tonaoqi_sdk_cpp
. - Open a terminal, clone this repository, and go into the
rosnao
workspace folder.
cd ~
git clone https://github.com/LaiYanKai/rosnao.git
cd ~/rosnao
- Make sure you have
pip
installed:
sudo apt install python3-pip
- Assign permissions to all bash scripts in the workspace:
chmod +x *.sh
- Open
init_qibuild.sh
and make sureSDK_DIR
is pointing to the correct path of thenaoqi_sdk_cpp
folder. It is if you downloaded the SDK into the home~
folder. Save when done. - Install qibuild and configures it for this project. If prompted, install the qibuild if it is not installed, and choose
Unix Makefiles
for CMake Generator andNone
for IDE:
sh init_qibuild.sh
- The user guide is available here. Please read first before continuing.
- Prepare the robot in crouching position and start the robot by pressing the chest button. Please take care not to topple the robot in this position, as the joints are not stiff (there's a joint controller). Some of our robots have their autonomous life turned off. So the robot remains in this crouching position even after starting.
- Install Robot Settings.
- Make sure your PC is connected to a network / router (for NUS students, this network cannot be any NUS network, please use your router instead).
- If NAO was never connected to the network / router that your PC is connected to, connect an Ethernet cable from the NAO to the router, and follow the steps here to connect wirelessly (Wi-Fi connection).
- For subsequent steps, make sure that your PC and NAO are connected to the network that you have chosen (you may choose another from Robot Settings).
- Obtain the PC's IP address (using
ip a
on an Ubuntu terminal). - Obtain the Nao's IP address (click the Chest button or look at Robot Settings).
- Disconnect the ethernet cable, as NAO is already wirelessly connected. Subsequent boot-ups should connect to the network / router wirelessly if available.
- In terminal open .bashrc:
nano ~/.bashrc
- Make sure the following is at the end of the .bashrc script. Scroll down using the
Arrow Down
key or useCtrl+End
:
export ROS_MASTER_URI=http://<PC IP>:11311
export ROS_HOSTNAME=<PC IP>
where <PC IP>
is replaced with the PC's IP address, or localhost
.
If there are multiple identical lines, remove the rest, as only the last lines will take effect.
3. Save and exit using Ctrl+S
and then `Ctrl+X.
4. For all open terminals, run:
source ~/.bashrc
-
Make sure the robot is started up, and connected to an access point via its wi-fi or an ethernet cable. Press the chest button to get its IP address.
-
In the
rosnao
workspace folder, openrun_cam.sh
. Edit the parameters, especiallyNAO_IP
:- When editing the SH script, make sure there are no spaces around the
=
operator. - Fill in the IP address for the Nao Robot in
NAO_IP
. - If running Ubuntu on VirtualBox, make sure the network adapter is Bridged Adapter.
- Set
RES=1
for QVGA (320*240), orRES=2
for VGA (640*480). - Set
CAM=0
for the bottom camera, orCAM=1
for the top camera. - The
TOPIC
is the ROS Image topic that the video feed will be published into. - The
FRAME
isframe_id
field of the message in the topic. See Header and Image. - Save and exit when done.
- When editing the SH script, make sure there are no spaces around the
-
Run the camera and RViz.
cd ~/rosnao
./run_cam.sh
- The feed is grayscale for OrbSLAM purposes.
DEPRECATED. RViz is already launched with run_cam.sh
- In another terminal, launch RViz using:
rviz
- In RViz, change the base frame to
world
(frommap
). - Add the
Image
display, - Then, change the topic in the
Image
display to whatever is inTOPIC
INrun_cam.sh
. - Make sure
run_cam.sh
is running in another terminal to see the camera stream in RViz.
A complete list of SDK functions, can be found here.
Only the bare minimum of the SDK is exposed in the class Motion
in src/rosnao_brige/include/motion.hpp
.
setAngle
: Can only turn the head to a specified yaw angle. 1.57 radians means look left 90 deg, -1.57 means look right. Angle is adjustable. Fractional max speed should be kept low to scan the environment. Can be blocking or unblocking.moveTo
: The robot can move to a pose in x, y, yaw, relative to current pose (i.e. in robot's frame). The speed of walking is already minimal to reduce head bobbing.moveToward
: Moves the robot in normalised x, y, yaw velocities (-1 to 1) in the robot frame.move
: Moves the robot in x (m/s), y (m/s), yaw (rad/s) velocities.wakeup
,rest
andmoveInit
functions. (see comments intest_motion.cpp
).
-
Make sure the robot is started up, and connected to an access point via its wi-fi or an ethernet cable. Press the chest button to get its IP address.
-
In the
rosnao
workspace folder, openrun_motion.sh
and edit the IP address of the NAO robot. -
Run the motion:
cd ~/rosnao
./run_motion.sh
- Modify
src/rosnao_bridge/src/test_motion.cpp
and try from there.
You can choose to export this package but must first add the motion.hpp
into a library using add_library
in CMakeLists.txt
in order to use it.
Teleoperate using the keyboard on the remote PC by moving the robot in normalised velocities.
The robot is stable between -0.8 and 0.8 normalised velocities. Beyond that, it may become unstable.
Key | Description | Math |
---|---|---|
w | Move forward faster | x += 0.1 |
x | Move backward faster | x -= 0.1 |
a | Strafe leftward faster | y += 0.1 |
d | Strafe rightward faster | y -= 0.1 |
q | Rotate leftward faster | yaw += 0.1 |
e | Rotate rightward faster | yaw -= 0.1 |
s | Stops all motion | |
Else | Press any other key to stop the teleoperation |
- In the
rosnao
workspace folder, openrun_teleop.sh
and edit the IP address of the NAO robot. - Run the teleoperation with:
cd ~/rosnao
./run_teleop.sh
- Wait for the robot to stand up.
- Teleoperate. Avoid moving the robot faster than 0.8 normalised speeds.
- After ending the teleoperate, wait a while for the robot go into resting position.