DAVFoundation / missioncontrol

🛰 Controls and orchestrates missions between vehicles and DAV users
MIT License
181 stars 156 forks source link

If user requests a pickup in an area with no drones, generate drones #87

Closed TalAter closed 6 years ago

TalAter commented 6 years ago

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.

The specific 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

Mission Control comes with a built in simulation environment which generates and controls simulated drones, allowing developers to start developing without investing in costly hardware first.

If you are looking at any point on the map inside the missions app, and there are no drones around, the server will generate a few simulated drones on demand around that point.

However, if the user tries to order a pickup from a location on the map they are not looking at, and that location has no drones around it... no bids for that delivery will come in. That is because the function that creates a request for bids doesn't generate simulated drones.

What you can do

When a user requests a pickup, the function createRequest() in /server/store/requests.js gets called.

Add a call to getVehiclesInRange() to the start of that function passing it the coordinates of the request and a radius of 7000 meters. This should generate some simulated vehicles if not enough exist in range.

To test, run the missions app and when asked for pickup coordinates enter some random coordinates (e.g. 1,3 or 12.2,-20). The next screen should show no drones before you fix, and should show drones after you fix

no-drones

Contributing to Mission Control

Rob-Rychs commented 6 years ago

can I work on this one? @TalAter

TalAter commented 6 years ago

@Rob-Rychs Go for it! Thank you.

TalAter commented 6 years ago

Hi @Rob-Rychs ,

Still planning on doing this one, or can I open it up for grabs again?

Rob-Rychs commented 6 years ago

Hey @TalAter quick question: how would you access the coords to pass into getVehiclesInRange()? I've tried a couple different ways (requestDetails.pickup, string interpolation, an array with [pickup_long, pickup_lat] but haven't quite been able to get it...) Just got set up with both projects + docker... If someone wants to help me out with a teaching moment or wants to jump in and solve this 👍 screenshot of some funny things I tried: (lines 3 + 30) image

Rob-Rychs commented 6 years ago

it looks like coords is supposed to be an object with .long and .lat properties based on reading the getVehiclesInRange func... So would I need to create that obj from the requestDetails data first and then pass it into the func? Feels like I'm missing something...

TalAter commented 6 years ago

You can see exactly how getVehiclesInRange is used elsewhere in the code - https://github.com/DAVFoundation/missioncontrol/blob/4cec793ddeb845573d3b5b0a289a3820a267b28f/server/controllers/StatusController.js#L19 You need to use it the same way, passing it the pickup lat and long.

Rob-Rychs commented 6 years ago

Thanks for that link @TalAter I should have searched for other calls to the function not just the definition that was silly of me! Thanks for your patience. I added const { getVehiclesInRange } = require('./vehicles'); and the call getVehiclesInRange({ lat: parseFloat(pickup_lat), long: parseFloat(pickup_long) }, 7000); and was rewarded with seeing the drones pop-up in my browser 🎉

But as I was filing out the PR template I went to generate a gif of the drone rendering action but to my dismay the drones have stopped rendering 🤔

However the missionscontrol_1 is still receiving the calls to create_vehicle image

I didn't change the code at all since the first time it worked and have tried restarting both missioncontrol with the docker command and missions with 'npm start' after but have not gotten the drones to render again ☚ī¸

Don't feel good about submitting a PR until I figure out what's going on... any thoughts?

TalAter commented 6 years ago

I'm not sure I understand the problem you are describing. What do you mean they stopped rendering?

Can you create that pull request so I'll be able to run the code locally?

Rob-Rychs commented 6 years ago

please see #139 i tried to explain in the PR.... basically the first time I tested these changes it created the drones within and range and took me to a list where i could select a drone and sign a contract... But subsequent tests have not produced the same behaviour...