DAVFoundation / missioncontrol

πŸ›° Controls and orchestrates missions between vehicles and DAV users
MIT License
181 stars 156 forks source link

first-timers-only: Generate random drone model names #1

Closed TalAter closed 7 years ago

TalAter commented 7 years ago

first-timers-only

This issue is tagged :octocat: first-timers-only. It is only for people who have never contributed to open source before, and are looking for an easy way take their first steps.

Consider this your chance to dip your toe into the world of open-source, and get some bragging rights for writing code that makes drones fly, lets cars find charging stations, helps people and goods get from place to place, and more.

Find more first-timers-only issues here.

Thank you for your help :heart:

What is this project?

DAV (Decentralized Autonomous Vehicles) is a new foundation working to build an open-source infrastructure for autonomous vehicles (cars, drones, trucks, robots, and all the service providers around them) to communicate and transact with each other over blockchain.

As an organization that believes in building a large community of open-source contributors, we often create issues like this one to help people take their first few steps into the world of open source.

Mission Control

The DAV project you are looking at is Mission Control. It is the brain in charge of orchestrating missions between DAV users and autonomous vehicles.

How you can help

Background

To help developers building on top of DAV technologies, Mission Control can start in a simulation environment. In a simulation environment, there are always a few simulated drones flying around the user, ready to take on missions. This makes it easy for developers to start building and testing without investing in hardware.

The Issue

When creating a new simulated drone, it needs to have a model name (e.g. DJX CargoFlyer). Currently, the method that creates this name always returns the same string.

The function randomDroneModel() inside /server/simulation/random.js needs to be updated to return a random model name. A model name is composed of a manufacturer (a random string chosen from ['DJX', 'Parakeet', 'Gruff', 'Unique', 'FlyHawk']) followed by a space, and then a model name (a random string chosen from ['CargoMate', 'Postman', 'ShipIt', 'Air Ship']).

console.log(
  randomDroneModel()
); // logs something like 'DJX CargoMate' or 'FlyHawk Postman' or 'Gruff ShipIt'

To test your function, follow the instructions in Contributing to Mission Control, and after you write your code visit http://localhost:8888/status.

Contributing to Mission Control

cg-cnu commented 7 years ago

hi there, first time contributor to open source. Can I pickup this one ?

TalAter commented 7 years ago

Of course! πŸ‘

cg-cnu commented 7 years ago

Thanks for the offer :) Did npm install, ran gulp watch and got these erorrs.

gulp watch
[23:17:40] Using gulpfile ~\Documents\GitHub\missioncontrol\gulpfile.js
[23:17:40] Starting 'lint'...
[23:17:40] Starting 'thrift-build'...

> missioncontrol@0.0.1 thrift C:\Users\user\Documents\GitHub\missioncontrol
> thrift -gen js:node -strict -recurse -out ./server/thrift ./resources/idl/CaptainMissionControl.thrift

'thrift' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "thrift"
npm ERR! node v6.10.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! missioncontrol@0.0.1 thrift: `thrift -gen js:node -strict -recurse -out ./server/thrift ./resources/idl/CaptainMissionControl.thrift`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the missioncontrol@0.0.1 thrift script 'thrift -gen js:node -strict -recurse -out ./server/thrift ./resources/idl/CaptainMissionCont
rol.thrift'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the missioncontrol package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     thrift -gen js:node -strict -recurse -out ./server/thrift ./resources/idl/CaptainMissionControl.thrift
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs missioncontrol
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls missioncontrol
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\user\Documents\GitHub\missioncontrol\npm-debug.log
[23:17:45] 'thrift-build' errored after 5.1 s
[23:17:45] Error in plugin 'gulp-shell'
Message:
    Command `npm run thrift` failed with exit code 1
[23:17:47]

Looks like thrift is not available system wide. But npm install -g thrift also didn't helped. Let me know if am doing anything wrong. Btw, am on windows 10.

TalAter commented 7 years ago

My fault. The thrift that is installed through npm is just a JavaScript wrapper. It assumes that you have the thrift library installed on your machine.

You shouldn't have to do that just to work on the JavaScript.

I have just pushed a new commit to the repo which will allow you to run gulp watch:js instead, without having to bother with thrift at all.

Either pull the latest changes from https://github.com/DAVFoundation/missioncontrol/ to your fork or if it's too complicated you can just delete your fork and create a new fork.

cg-cnu commented 7 years ago

Yeeaah! πŸŽ‰ πŸ˜„ Am able to to start the server after the fix.

Just that am getting a linting error... error Expected linebreaks to be 'LF' but found 'CRLF' linebreak-style Googling shows that its a windows issue; I have for now disabled the error by modifying the following lines in .eslintrc

"linebreak-style": [
      "error",
      "unix"
    ]

to "linebreak-style": 0,

Let me know if there is any better way to fix it.

Btw, just want to confirm; once its up all I see at localhost:8888 is hello world.

On to Coding... 😊

cg-cnu commented 7 years ago

Few questions regarding the code organization; can be stupid ones.

Should I keep the whole logic in one function randomDroneModel or have multiple functions like randomManufacturerName and randomModelName and all randomDroneModel does is return "randomManufacturerName() + " " + randomModelName()"

The defaults...

const manufacturerName = ['DJX', 'Parakeet', 'Gruff', 'Unique', 'FlyHawk']
const modelName = ['CargoMate', 'Postman', 'ShipIt', 'Air Ship'];

will be coming from a different config file or just declared in the above functions ?

TalAter commented 7 years ago
TalAter commented 7 years ago

Works and looks great πŸ‘

model-names

Bonus points for using template literals πŸ˜‰

Thank you!

cg-cnu commented 7 years ago

My first substantial opensource contribution ever! πŸ˜„ :confetti_ball: Thanks so much for the help! πŸ™ πŸ‘

TalAter commented 7 years ago

@cg-cnu Please join our gitter channel for contributors - https://gitter.im/DAVFoundation/DAV-Contributors