Overview
Yeoman is a Lego Mindstorms EV3 bot for training flag semaphore.
Flag Semaphore is telemetry system conveying information at a distance by means of visual signals with hand-held flags, rods, disks, paddles, or occasionally bare or gloved hands. Information is encoded by the position of the flags where it is read when the flag is in a fixed position. Semaphores were adopted and widely used in the maritime world in the 19th century. Despite modern alternative electronic communication means, flag semaphore is use a must learnt subject by all navies and mariners around the world.
Picture below shows the semaphore flag signals when facing the transmitting party. error is normally used with the waving position in attention mode.
https://en.wikipedia.org/wiki/Flag_semaphore tells more details about flag semaphore.
Initial Test
The first requirement is to have the EV3 to able to swing its arm to all the directions used in semaphore. This is indicated as below.
an EV3 bot is used and hold 2 flags
From the video below, we do an initial test to see if all the positions of the flag semaphore can be covered.
Alexa Skill
i follow https://www.hackster.io/alexagadgets/lego-mindstorms-voice-challenge-mission-3-4ed812 to create a custom Alexa Skill named YEOMAN.
(ps: Yeoman refers to signals petty officer in the British Royal Navy and other Commonwealth navies. The term has been in use since 1816. Yeoman is a communications technical specialist.
specific steps needed
turn on custom interface controller in alexa developer console and save the interface.
With Custom Interface Controller we can write code that sends custom directives to EV3 Brick and program its reaction. Learn more about Custom Interfaces. In short, here are steps to define and use Custom Interface on a gadget :
- Step 1: Name your interface, directives, and events
- Step 2: Declare support for the interface
- Step 3: Handle directives on your gadget
- Step 4: Send events from your gadget
Defining Skill interaction model
we go to JSON editor to define the interaction model (Alexa Developer Console\Interaction Model\JSON Editor). The JSON file is used to define the intent and slot. An intent represents an action that fulfills a user's spoken request. Intents can optionally have arguments called slots. For example, in the JSON you will see a MoveIntent
with slots for Direction
, which maps to a list of words that represent the different directions you can say, and a Duration
slot that maps to a predefined AMAZON.NUMBER
integer value. The combination of the intent and slots will allow to write code that reacts to:
“Alexa, tell mindstorms to move forward 5 seconds.”
Then, create the necessary files for the skill. they are index.js, util.js, common.js
we can then click deploy in the alexa developer console and test it.
Testing
we can click test and use the pc mic to test our code. screenshot below shows i am testing to make sure my invocation word can work. It does. :)
In Visual Studio Code, copy the code to EV3
after that, we can run our yeoman code
Take note that there are a few rather confusing parts
1) unable to import agt
as seen below, you will see this problem in VS code. This can be ignored as the code is meant to run on EV3. it will have this error on pc
Explanation on code
Letter A-Z is mapped to intend and slot. in the code (details look at https://github.com/weiwei2/yeoman),
we only need to control the direction of of right or left motor (of right hand side of the flag) for different position
example
self.right_motor.on_to_position(20,50)
self.left_motor.on_to_position(20,50)
Final Testing
This is the video showing it in action
we issue the command to show the letter (for example letter A), and the ev3 will shows the letter A.
https://github.com/weiwei2/yeoman/blob/master/ev3_yeoman.mp4
this is also explained in https://github.com/weiwei2/yeoman/blob/master/README.md
References
[1]custom interface https://developer.amazon.com/en-US/docs/alexa/alexa-gadgets-toolkit/custom-interface.html
[2] repository of the project https://github.com/weiwei2/yeoman/blob/master/README.md
Comments