====== How to Upgrade DARwIn-OP to DARwIn++ ====== **Authors**: Email: , Email: \\ **Mentors**: Email: , Email: \\ **Date**: Last Modified on <11/21/21>\\ **Keywords**: \\ ====== Note: This tutorial is currently under construction. ====== [A picture of DARwIn%%++%% next to DARwIn-OP]\\ This tutorial details the process of upgrading DARwIn-OP (on the left in the picture above), a famous miniature humanoid robot, to DARwIn%%++%% (on the right in the picture above), a modernized version of DARwIn-OP. Since DARwIn-OP has been discontinued by its manufacturer, ROBOTIS, DARwIn-OP’s technological hardware has become obsolete. DARwIn%%++%% serves to breathe new life into the platform by replacing DARwIn-OP’s old management controller with a newer, more powerful piece of hardware (the NVIDIA Jetson Nano) to increase DARwIn%%++%%’s capabilities and potentially “future-proof” the hardware for years to come. This tutorial details the process of replacing DARwIn-OP’s old computer (the ATOM Z530) with the NVIDIA Jetson Nano, the installation of Ubuntu 18.04 onto the Jetson Nano. This tutorial takes approximately 2 hours to complete.\\ ==== Motivation and Audience ==== This tutorial’s motivation is to upgrade DARwIn-OP. This tutorial assumes that its readers have the following background and interests:\\ - Soldering\\ - Ubuntu\\ - Humanoids\\ The rest of this tutorial is presented as follows:\\ - Parts List and Sources\\ - Construction\\ - Final Words\\ ===== Parts List and Sources ===== US-based vendors that sell the materials used in this tutorial include Amazon, Raspberry Pi, and Aliexpress.\\ To complete this tutorial, you will need the following:\\ === Bill of Materials (BOM): === ^ Part Name / Description ^ Vendor ^ Vendor Number / URL ^ Price ^ QTY ^ |DARwIn-OP 1 or 2 |Aliexpress |https://bit.ly/3CAIOHM |%%$12,999%%| 1 | |NVIDIA Jetson Nano |Amazon |https://amzn.to/3qUqdnC |%%$59.00%% | 1 | |Male-to-Male USB Cable |Amazon |https://amzn.to/3FNNT1x |%%$6.99%% | 1 | |32 GB UHS-1 MicroSD Card |Amazon |https://amzn.to/3qUKEkA |%%$8.35%% | 1 | |Barrel Jack Connector |Amazon |https://amzn.to/3Dza62A |%%$9.99%% | 1 | |Step-Down Circuit |Amazon |https://amzn.to/3cvpf97 |%%$6.99%% | 1 | |Linux Arcade-Controller |Amazon |https://amzn.to/3cwFPFy |%%$39.99%% | 1 | |Raspberry Pi 4 |Raspberry Pi|https://bit.ly/30EUP23 |%%$35.00%% | 1 | === Required Software: === ^ Software Name ^ Link ^ |VLC Media Player |https://www.videolan.org/| |Jetson Nano Developer Kit SD Card Image |https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit#write| |BalenaEtcher |https://www.balena.io/etcher/| |Ubuntu 18.04 |https://releases.ubuntu.com/18.04/| |ROS Melodic |http://wiki.ros.org/melodic/Installation/Ubuntu| |Python-Rosdep |http://wiki.ros.org/rosdep| |OpenCV |https://opencv.org/releases/| |ROBOTIS OP-2 ROS Package |https://emanual.robotis.com/docs/en/platform/op2/ros_package/| |Vino VNC Software |https://linux.softpedia.com/get/System/Networking/Vino-18305.shtml| |Remmina |https://remmina.org/| |ROS Indigo |http://wiki.ros.org/indigo/Installation/Ubuntu| |ROS Melodic Joystick |http://wiki.ros.org/joy| === Block Diagram: === {{:darwinPlusPlusBlockDiagram.png?800|}}\\ ===== Construction ===== This section gives step-by-step instructions, along with photos, to upgrade DARwIn-OP to DARwIn%%++%%.\\ Note: This tutorial outlines the process of replacing the ATOM Z530 (DARwIn-OP 1’s original computer) with the NVIDIA Jetson Nano. The ATOM Z530 board is NOT upgraded in this tutorial. Also note that this tutorial works for DARwIn-OP 1 and DARwIn-OP 2, with the latter robot requiring an additional step. ==== Step 1: Removing the ATOM Z530 Board from DARwIn-OP. ==== == Preparation: == i) Remove the Nylon harness from the top of the backside of DARwIn’s torso. To aid in screw management, it can help to put a piece of double-sided tape on a piece of paper and write what each screw is for. This ensures you know where the screws are, and that you can’t lose them!\\ ii) Remove the Battery from DARwIn.\\ iii) Remove the battery compartment from the bottom of DARwIn’s torso. This should cause DARwIn’s entire lower torso to come off, as seen in the following pictures:\\ {{:darwinwithoutbatterycompartment.png?200|}}\\ **Figure X**: DARwIn with its battery compartment and Front and Back Plates removed.\\ == DARwIn Surgery: == NOTE: The steps listed here are reminiscent of what’s seen in this YouTube video of an “Exploratory Surgery of DARwIn 2.0”. This may help in understanding how to disassemble DARwIn.\\ Link: https://www.youtube.com/watch?v=c4H3XUlOcJs&ab_channel=ChrisI-B\\ i) Remove the screws from the front plastic covering (this plastic covering is called the “Front Plate”). Gently remove the Front Plate. Note that the Front Plate is connected to DARwIn’s torso via a speaker wire. Make sure to disconnect the speaker wire before taking DARwIn’s Front Plate off entirely.\\ ii) Remove the screws from DARwIn’s back plastic covering (this plastic covering is called the “Back Plate”). Gently remove the Back Plate. Note that the Back Plate is connected to DARwIn’s torso via 2 wires. Make sure to disconnect the wires before taking off DARwIn’s Back Plate entirely.\\ iii) Unscrew the screws that connect the “top part” of DARwIn’s torso to the “bottom part” of DARwIn’s torso (see **Figure X**). Note: There are 3 screws on the front, and 3 screws on the back.\\ {{:darwinupperandlowertorsoline.png?200|}}\\ **Figure X**: The “Upper” and “Lower” torso of DARwIn. DARwIn’s “Upper Torso” includes the plate with DARwIn’s shoulder and neck Dynamixels. DARwIn’s “Lower Torso” Includes the plate with the CM730 and the ATOM Z530 CPU.\\ iv) Disconnect the 5 TTL (Transistor-Transistor Logic) cables from the CM730 board (see **Figure X**). Label the cables “Cable 1” through “Cable 5”, as done in **Figure X** below to avoid confusion.\\ v) Expose DARwIn’s chest. My DARwIn had a zip-tie on its chest, so I cut it off.\\ vi) Disconnect all of the cables connecting the top and bottom portions of DARwIn’s torso. Label which cable is which to avoid confusion when reassembling DARwIn.\\ vii) Remove the ATOM Z530 from DARwIn.\\ ==== Step 2: Upgrading the Head Camera ==== To connect the new main computer (the NVIDIA Jetson Nano) to the DARwIn’s Head Camera/Subcontrollers, a connection via USB will be established. While both the CM730 Board and the Head Camera follow the USB protocol, the two components use different USB connection ports. For this reason, the Head Camera will need to be updated to utilize the USB interface.\\ == Converting to USB == i) Prepare a USB board. Note: if you don’t have a USB board, one can do the following:\\ - Get a USB cable from an unused peripheral (like an old mouse/keyboard). You can cut the USB wire off of the peripheral (one can also use the Male-to-Male USB cable included in the Bill of Materials (“BOM”)).\\ - You should see 4 wires and a tin-foil-esque film. Strip all four wires and label them “Wire 1”, “Wire 2”, “Wire 3”, and “Wire 4”. Note: not all of these wires are made equally. Errors can cause massive damage, so don’t rely solely on the colors of the wires!\\ - Ensure that you can discern which wire is which by putting a multimeter to continuity mode and placing the two prongs on two points of the wire. If continuity is achieved, you have completed the preparation of a USB board!\\ ii) Solder the 4 wires found in the USB cable to the 4 pin connector as done in **Figures** X and X.\\ **Figure X**: The USB Port\\ {{:darwinusbboard.png?200|}}\\ **Figure X**: The USB Board\\ iii) Once you are finished soldering, you should have a USB Board that looks like **Figure 3**.\\ **Figure 3**: The Completed USB Board\\ iv) To check if the newly-made USB Board works, connect the USB cable into your computer and run the “VLC Media Player” program. v) Go to the top left corner to the “Media” dropdown menu. vi) In “Media”, click on “Open Capture Device”. vii) Under the “Capture Device” tab of the “Open Media” window, click on the dropdown menu of “Video device name” and select any one of the devices, and then hit “Play” on the “Open Media” window. Note: there may not be a specific name for the USB Board, so you may have to go through all of the names in the list. You can see **Figures 4 - 8** for a visual walkthrough of this process.\\ **Figure 4**:\\ **Figure 5**:\\ **Figure 6**:\\ **Figure 7**:\\ **Figure 8**:\\ ==== Step 3: Installing and Setting up the NVIDIA Jetson Nano ==== This step details the process of Installing an NVIDIA Jetson Nano into DARwIn and setting up the NVIDIA Jetson Nano.\\ == Installation of the NVIDIA Jetson Nano. == **This section is currently under construction**.\\ == Setting up the NVIDIA Jetson Nano. == These steps follow the tutorial.\\ URL: https://developer.nvidia.com/embedded/learn/get-started-jetson-nano-devkit\\ The following instructions guide you through the process of installing Linux (specifically Ubuntu 18.04) onto the NVIDIA Jetson Nano.\\ i) Ensure that you have the following materials:\\ - A 32 GB UHS-1 microSD Card\\ - A good Barrel-Jack-ended power supply capable of providing 5V⎓4A.\\ ii) Download the Jetson Nano Developer Kit SD Card Image (https://developer.nvidia.com/jetson-nano-sd-card-image). Assuming you’re running Ubuntu download and launch Balena Etcher (https://www.balena.io/etcher/). If you’re not using Ubuntu, go to the “Get Started with Jetson Nano Developer Kit” link above and follow their tutorial for setting up a Jetson Nano with a different operating system.\\ iii) Click on “Select Image” and choose the zipped SD card image file downloaded in step ii).\\ iv) Insert the microSD card into your computer. BalenaEtcher should automatically recognize it as the target device. If not, select it manually.\\ v) Click “Flash!” You may need to enter your Username and Password for BalenaEtcher to continue.\\ vi) After BalenaEtcher is done writing the image to the microSD card, eject the microSD card from the files app and then take the microSD card out of your computer.\\ vii) Insert the microSD card into the NVIDIA Jetson Nano, and then boot into the NVIDIA Jetson Nano. Note that if you’re powering the NVIDIA Jetson Nano with a barrel jack connector, you must add a jumper cable to the D63 pin.\\ viii) Go through the default instructions and set up the password (e.g. “DASL1234”).\\ ix) Boot up into the NVIDIA Jetson Nano for the first time, and enter in the following 3 lines into the terminal (you can open the terminal by pressing ctrl+alt+t):\\ sudo jetson_clocks sudo apt-get update sudo apt-get upgrade == Setting Up the NVIDIA Jetson Nano for ROS: == Note: these instructions are for the installation of ROS Melodic on Ubuntu 18.04. This tutorial will assume that you already know how to download Ubuntu. If you don’t, see the following URL:http://wiki.ros.org/melodic/Installation/Ubuntu. i) Open the Terminal (ctrl+alt+t) and paste the following command lines one at a time, step-by-step. sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' -recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 sudo apt update sudo apt install ros-melodic-desktop-full echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc source ~/.bashrc sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential sudo apt install python-rosdep sudo rosdep init rosdep update source /opt/ros/melodic/setup.bash mkdir -p ~/catkin_ws/src cd ~/catkin_ws/ catkin_make sudo reboot == Installing OpenCV: == Open the Terminal again (ctrl+alt+t), and paste the following command lines one at a time, step-by-step. sudo reboot sudo apt update && sudo apt install -y cmake g++ wget unzip wget -O opencv.zip https://github.com/opencv/opencv/archive/master.zip wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/master.zip unzip opencv.zip unzip opencv_contrib.zip mkdir -p build && cd build cmake -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib-master/modules ../opencv-master cmake --build . == Installing the ROBOTIS OP-2 ROS Package: == i) When booted into Ubuntu, search for “additional drivers” in the search bar. Navigate to “additional drivers”, and select “UBUNTU Software” and “enable source code”. Make sure the “download from” field is set to “main server”. ii) Open the terminal (ctrl+alt+t), and paste the following commands one at a time, step-by-step. sudo apt-get install libncurses5-dev libncursesw5-dev sudo apt-get install ros-melodic-sbpl sudo apt-get install ros-melodic-map-server sudo apt-get install ros-melodic-nav-msgs sudo apt-get install ros-melodic-octomap sudo apt-get install ros-melodic-octomap-msgs sudo apt-get install ros-melodic-octomap-ros sudo apt-get install ros-melodic-octomap-server sudo apt-get install ros-melodic-gazebo-ros cd ~/catkin_ws/src git clone https://github.com/ahornung/humanoid_msgs.git git clone https://github.com/ROBOTIS-GIT/DynamixelSDK git clone https://github.com/ROBOTIS-GIT/ROBOTIS-Framework git clone https://github.com/ROBOTIS-GIT/ROBOTIS-Framework-msgs git clone https://github.com/ROBOTIS-GIT/ROBOTIS-Math git clone https://github.com/ROBOTIS-GIT/ROBOTIS-OP2 git clone https://github.com/ROBOTIS-GIT/ROBOTIS-OP2-Common git clone https://github.com/ROBOTIS-GIT/ROBOTIS-OP3 git clone https://github.com/ROBOTIS-GIT/ROBOTIS-OP3-msgs git clone https://github.com/ROBOTIS-GIT/ROBOTIS-OP3-Tools git clone https://github.com/HumaRobotics/darwin_gazebo.git git clone https://github.com/HumaRobotics/darwin_description git clone https://github.com/HumaRobotics/darwin_control cd ~/catkin_ws iii) Navigate to “/catkin_ws/src/ROBOTIS-OP3-Tools” and delete the “op3_action_editor” folder. (Note: this step is VERY important) iv) After deleting the “op3_action_editor”, open up the terminal (ctrl+alt+t), and paste in the following command: :$ catkin_make == Running DARwIn++: == i) Open the terminal (ctrl+alt+t), and paste the following commands one at a time, step-by-step. sudo bash source catkin_ws/devel/setup.bash sudo chmod 666 /dev/ttyUSB0 roslaunch op2_manager op2_manager.launch ii) Open a new terminal (ctrl+alt+t) next to the old terminal and paste the following commands one at a time, step-by-step. sudo bash source catkin_ws/devel/setup.bash sudo chmod 666 /dev/ttyUSB0 roslaunch op2_gui_demo op2_demo.launch ==== Step 4: Controlling DARwIn++ Remotely ==== == Connecting the Jetson Nano via a VNC Viewer:== Note that the following website was used as a major reference for this step: URL: https://bit.ly/3nxgfGM The steps outlined in this portion of the tutorial merely summarize what Bharath Sudharsan describes in his medium article. i) Open the Terminal (ctrl+alt+t) and paste the following: sudo gedit /usr/share/glib-2.0/schemas/org.gnome.Vino.gschema.xml ii) Doing the above should have opened a text editor up. Paste the code from the box below into the file, between “” and “”. See **Figure X** to see this done. Enable remote access to the desktop If true, allows remote access to the desktop via the RFB protocol. Users on remote machines may then connect to the desktop using a VNC viewer. true iii) After pasting the code found in ii), save and exit out of that window. iv) Open another terminal (ctrl+alt+t), and paste the following: sudo glib-compile-schemas /usr/share/glib-2.0/schemas v) Select “Allow other users to view your desktop” and “Allow other users to control your desktop”. Make sure that “You must confirm each access to this machine” is deselected. Lastly, select the “Require the user to enter this password” box and enter in a password for the VNC session. == Starting the VNC Server on Startup by Default: == i) Open “Startup Applications” in Ubuntu. Click on “Add”. Type “Vino” in the search box, and then type “/usr/lib/vino/vino-server” into the command box. After doing so, save and close the app. ii) Open the terminal (ctrl+alt+t), and paste in the following commands: $ gsettings set org.gnome.Vino require-encryption false $ gsettings set org.gnome.Vino prompt-enabled false iii) Reboot. == Connecting to the Jetson Nano via VNC: == i) Open the terminal (ctrl+alt+t) and paste the following to find the IP address. $ ifconfig ii) Paste the following into the terminal to check if the VNC server is running. $ ps -ef|grep vnc iii) Connect to the Jetson Nano using any VNC Client. The next steps assume that the VNC Client “Remmina” is used. iv) Open Remmina. Click the “Add” button, and select “VNC” as the protocol. v) Click the “...” button to automatically scan. Once the Jetson NANO appears, click on it, and enter your password. Lastly, hit “Connect”. ==== Step 5 (optional): Auto-Login and Disable the Lock Screen ==== == Configuring and Using a Linux-Supported Joystick Control to DARwIn with ROS: == Note that the following was used as a major reference for this step: URL: http://wiki.ros.org/joy Warning: The link above is is for ROS Indigo, not ROS Melodic. Since this tutorial featured using ROS Melodic on Ubuntu 18.04, the following steps will act to translate the above link to ROS Melodic. i) Start by opening the terminal (ctrl+alt+t) and pasting the following code to download a package: $ sudo apt-get install ros-melodic-joy ii) Connect your joystick to your laptop. Check if Linux recognizes the joystick by pasting the following command into the terminal: $ ls /dev/input/ Joystick devices are referred to as “jsX”, where the “X” is a number. My joystick was recognized as “js0”. Now, let’s check if the joystick actually works. iii) Open a new terminal (ctrl+alt+t) and paste the following code: $ sudo jstest /dev/input/jsX Try moving the joystick around now. Changes in the data output on the screen indicate that the joystick’s inputs are being read! iv) Next, the ROS node needs to access the joystick. This can be done by first opening a new terminal (ctrl+alt+t) and pasting the following code to list the permissions of the joystick: $ ls -l /dev/input/jsX This should yield an output of the form: “crw-rw-XX- 1 root dialout 188, 0 2009-08-14 12:04 /dev/input/jsX” Where the “XX” in the “crw-rw”xx- 1” varies. If “XX” is “rw”: the joystick device (“js”) was configured properly. If “XX” is “--”: the joystick device was not configured properly. You’ll need to paste the following code in a new terminal (ctrl+alt+t): $ sudo chmod a+rw /dev/input/jsX v) We will need to start a new ROS Joy node to obtain the data published by the Joystick. Assuming the joystick device was recognized as “js0”, paste the following code into a terminal (ctrl+alt+t), line-by-line. $ roscore $ rosparam set joy_node/dev “/dev/input/jsX” vi) Next, start the ROS Joy node by pasting the following code into the terminal (ctrl+alt+t): $ rosrun joy joy_node vii) Lastly, run a new terminal (ctrl+alt+t) simultaneously to be able to see the data stream from the joystick. $ rostopic echo joy As you move the joystick around, you should be able to see something like: Axes: (0.0, 0.0, 0.0, 0.0, 0.0) Buttons: (0, 0, 0, 0, 0) ==== Step X: Using DARwIn++ ==== This step details the process of setting up DARwIn++ (following the DARwIn++ "Hello World" tutorial video linked below) and the process of using the buttons on the joystick to control DARwIn++. Note that this tutorial was written in the context of using //Arcade DARwIn//. == Setting Up DARwIn++ == The DARwIn++ controlling process begins with the setting up of DARwIn++, done as follows: i) Plug in a keyboard (USB), a mouse (USB), and a monitor (HDMI) into DARwIn++. Then plug in the 5V 4A power cord into DARwIn++. ii) Switch DARwIn++ //ON// and look at the monitor as it boots up. iii) Once the NVIDIA Jetson Nano boots up fully, connect to the WiFi Network "HUBO 5G". iv) Open a new terminal and input the following commands: sudo bash source catkin_ws/devel/setup.bash sudo chmod 666 /dev/ttyUSB0 roslaunch op2_manager op2_manager.launch After inputting the final command (the "roslaunch" command), the screen will print out information about dynamixels 1-20. After that, DARwIn++ will move to a prepatory position before entering a sitting position (the "initial position" of DARwIn++). Then swap to the Controlling Station (laptop). v) Boot up the Controlling Station and open a new terminal (in the Controlling Station). Then input the following code: source catkin_ws/devel/setup.bash ls -l /dev/input/js0 sudo chmod a+rw/dev/input/js0 rosparam set joy_node/dev "/dev/input/js0" rosrun joy joy_node vi) After inputting the code, go back to the NVIDIA Jetson Nano monitor and open a new terminal. Then, input the following code to the new NVIDIA Jetson Nano terminal: source catkin_ws/devel/setup.bash rosrun grace_joy listener.py vii) Push each button on the Joystick and watch as DARwIn++ listens to your commands! :) ==== Helpful Links: ==== Dismantling the DARwIn OP2 https://www.youtube.com/watch?v=c4H3XUlOcJs DARwIn OP DARwIn OP - Getting started https://emanual.robotis.com/docs/en/platform/op/getting_started/ DARwIn OP 2 - Getting Started https://emanual.robotis.com/docs/en/platform/op2/getting_started/ Writing a Teleoperation Node for a Linux-Supported Joystick http://wiki.ros.org/joy/Tutorials/WritingTeleopNode DARwIn-OP DASL WIKI https://www.daslhub.org/unlv/wiki/doku.php?id=darwin_op ===== Final Words ===== While upgrading DARwIn-OP to DARwIn++ may seem daunting, the inherently cost-prohibitive pricing of new robots is damaging to novices interested in the industry. By upgrading obsolete humanoids to modern standards, the field of humanoid robotics becomes vastly more accessible, allowing for many more people to participate and advance the field.