This tutorial explains how to create a text to morse block for the Erle-Brain 2 using Blockly.
Follow this or one of the other tutorials in the same page to connect to the Brain.
Cloning the Code and Compiling Itgit clone https://github.com/Nestor94Gonzalez/ros_erle_morse.git
mv ros_erle_morse/ catkin_ws_morse
cd catkin_ws_morse
catkin_make_isolated
Deploying the Website and Running Apachecd src/robot_blockly/scripts/
./deploy.sh
Make sure apache is running or simply run
systemctl restart apache2
Running ROS NodesBefore you start: If you find any problem when running the nodes, execute them as root. You will need to load the corresponding source files too. Ex: source devel/setup.bash.
ros_erle_statusled
If you want to use the blue/orange status leds individually, open a new connection to the Brain in a new terminal and follow this steps.
cd catkin_ws_morse/
source devel/setup.bash
rosrun ros_erle_statusled statusleds.py
If everything is okay you should see the following message. That node has to stay running so don't end the execution.
/home/erle/catkin_ws_morse/src/ros_erle_statusled/scripts/statusleds.py:26: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(24, GPIO.OUT)
/home/erle/catkin_ws_morse/src/ros_erle_statusled/scripts/statusleds.py:27: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(25, GPIO.OUT)
ros_morse
Now you need to run the morse node if you want to use the Text_to_Morse block.
cd catkin_ws_morse/
source devel_isolated/setup.bash
rosrun ros_morse morse.py
If everything is okay you should see the following message. That node has to stay running so don't end the execution.
/home/erle/catkin_ws_morse/src/ros_morse/scripts/morse.py:29: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(24, GPIO.OUT)
/home/erle/catkin_ws_morse/src/ros_morse/scripts/morse.py:30: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings.
GPIO.setup(25, GPIO.OUT)
robot_blockly
You need to run the robot_blockly node so that the website and the Brain can communicate, so follow these steps.
cd catkin_ws_morse/
source devel_isolated/setup.bash
rosrun robot_blockly robot_blockly_backend.py
Now go to your browser and open the blockly main page.
http://erle-brain-2.local/pages/blockly.html
The main page should load and you should see the following message in the robot_blockly node execution log.
Client connecting: tcp:192.168.1.XX:YYYYY
WebSocket connection open.
Trying it OutLet's make a simple execution example. Create the following workspace or load it from a file. To do that you can use the file at the end of the page called "Blockly workspace example".
The workspace in the main page should look like this.
Now click the "Launch" button and an alert message should appear.
Now click "OK" and the leds in the Erle-Brain 2 should create the morse code for the corresponding message. Fast blink means '.' and a longer blink means "-".
Comments