Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3D Farm Designer #2457

Open
23 of 62 tasks
roryaronson opened this issue Jan 31, 2024 · 0 comments
Open
23 of 62 tasks

3D Farm Designer #2457

roryaronson opened this issue Jan 31, 2024 · 0 comments

Comments

@roryaronson
Copy link
Member

roryaronson commented Jan 31, 2024

Replace the 2D, SVG based farm designer with a fully 3D, three.js based farm designer. Demo.

FarmBot 3D Demo

Coordinate system

As most objects in the scene (the gantry, plants, grid lines, points, etc) will need to be positioned based off the FarmBot's origin, it maybe makes the most sense for the three.js origin and the FarmBot origin to be one in the same. This will avoid having to translate/rotate the majority of objects, and the three.js coordinates will always equal the FarmBot coordinates. Meanwhile, the rest of the environment (camera position/angle, ground plane, sun, etc will need to be translated/rotated accordingly based on the bearing and size of the bot.

Perhaps other origins would make more sense though, such as the top center of the soil, top center of the ground, top of the raised bed at the home position. This should be discussed a bit more so the best architecture is chosen.

Environment

  • Ground plane with customizable color hex code (GROUND COLOR), default to #f4f4f4.
  • Customizable setting in degrees of the FarmBot bed relative to North (BEARING). Default to 0 deg, which should make the positive Y direction of the FarmBot axes pointing towards North. When the user has the bearing field selected, show a large North arrow and "N" on the ground plane.
  • Customizable starting camera position (DEFAULT VIEWPOINT) for when the app loads. Options include each corner, each side, and top-down. Default should be from the max-X/min-Y corner. Starting camera angle should always be pointed at the top center of the soil. Starting camera height should always be at an eye-level height of 1600mm. Distance from the center of the bed should be based on bed dimensions to fit the whole bed in view with some margin.
  • Add outer bed dimension fields for X (OUTER BED LENGTH), Y (OUTER BED WIDTH), and Z (OUTER BED HIEGHT) in millimeters. X and Y should default to the recommended max outer dimensions listed in the hardware docs. Z should default to 300mm.
  • Add a BED WALL THICKNESS field, default to 40mm.
  • Add an OVERALL BED HEIGHT field, to allow for the bed to be raised off the ground plane (mobile raised beds, bots on tables, etc). Default to 300mm. When this value exceeds the outer bed height, render 90mm x 90mm (4x4) legs in the corners of the bed.
  • Bed should have a customizable color hex code (BED COLOR), default to #c39f7a.
  • Add ambient light.
  • Add directional point light for the Sun, coming from the South East (afternoon light).
  • Add ability to turn on/off PERSPECTIVE.
  • Add rotation cube in top right for quickly getting a straight-on view of a side or the top. There's probably a plugin/library for this?
  • Render soil height in 3D according to soil height measurements, interpolations, and fallback height.

Grid

  • Add grid lines/labels for 1000mm, 100mm, and 10mm at progressively finer strokes and lower opacities. Will need to fade out finer grid lines/labels at farther zoom levels.
  • Add crosshairs and coordinate labels at cursor whenever mousing over the soil surface or once clicked into a coordinate.
  • Setting to show/hide GRID in the map legend.

Tools

  • 1-slot toolbays (to allow for fine adjustments of individual slot coordinates) (no FarmBot logos, it will look tacky to have so many).
  • Seeder with separate needle object.
  • Seed bins, trays, troughs.
  • Watering nozzle.
  • Soil sensor with ability to control LED on PCB in 3D scene when connected.
  • Legacy weeder.
  • Rotary tool with top, bottom, and implements as separate objects. Add angle and implement fields to tool model.
  • Render inactive tools in front of bed on ground.

FarmBot

Initial 3D assets should be from the Genesis v1.7 design. We can eventually add the old style tracks for v1.6- bots, and the 3-in-1 tool head and different gantry wheel plates for Express bots. All other assets can remain the same amongst all bots.

  • Import separate objects for major subassemblies. Make sure these are cached by the browser for a week+.
  • Track extrusions: create object programmatically by extruding geometry so it can have dynamic length.
  • Left and right wheel plates (allows for eventual Express/Genesis differences).
  • Left and right gantry columns via extruded geometry (allows for dynamic length and performance improvements).
  • Left and right gantry corner brackets.
  • Electronics box (use same one as in controls popup) with operable buttons and dynamic lighting.
  • Main beam extruded geometry.
  • Cross-slide.
  • Z-axis.
  • UTM.
  • Cable carrier curves: basic C shaped object, moves at half the speed of the FarmBot.
  • Cable carrier straight sections: rectangular prisms positioned between curve and end positions. Length is dynamic based on distance between curve and ends.
  • Add lights along the gantry, illuminated when the LED strip is on.
  • Solenoid valve assembly with some basic tubing extending along the column.

Plants, Weeds, Points

  • Render plant and weed icons as sprites (always facing the camera).
  • When spread is turned on, render a plant's current size with a stretched green sphere (#66aa44, opacity 0.8) according to the plant's current age and spread and height curves. Use radius as the fallback value for both spread and height. This is in addition to the icon; the sphere should envelope the icon. Also render a second sphere at opacity 0.2 according to the plant's max spread and height.
  • When spread is turned on, render a weed's current size with a red sphere (#ee6666, opacity 0.8) according to the weed's radius. This is in addition to the icon; the sphere should envelope the icon.
  • Render points as 20mm diameter spheres, opacity 0.8.
  • When spread is turned on, render rings on the soil surface at opacity 0.5 to show a point's size.

Photos

  • Render images on soil surface, with clipping at inner bed edges.
  • Render camera view in 3D (rectangle on soil surface + lines extending from corners to camera lens).
  • Add button in photos panel to zoom farm designer to the camera's view (+~50% field of view to provide context).

Future

  • Replace the SVG graphics in the tool details panel with a slowly rotating 3D model.
  • When a tool details panel is opened, zoom the main farm designer environment to the tool. When closed, zoom the main environment back to where it was pre-zoom.
  • Render Trail from the UTM in 3D.
  • Rebuild the profile viewer as a special camera setting for the main farm designer view where perspective is turned off and the camera's view is clipped at a min and max distance.
  • Add animations to represent watering, the vacuum pump on, the rotary tool spinning.
  • Lay the groundwork for visualization of point clouds and other 3D data.
  • Add a utilities pole that can be clicked into to show metrics such as WiFi strength.
  • Ability for users to add and position other basic elements to the environment such as walls, buildings, another raised bed, solar panels, trees, hedges, etc.
  • Add needle diameter and length fields to tool model.
  • Overlay a satellite image onto the ground plane.
  • Change the Sun's position, color, and intensity based on the time of day and lat/lon.
  • Change the lighting based on the weather. Animation/effect for rain, snow.
  • Ability for users to add and position other common gardening objects such as starter trays and pots.
  • Ability to open the electronics box and get a detailed view of the Farmduino/Pi, along with various controls and info.
  • Rendering of belts with multiple objects (bend area + straight sections, like cable carriers).
  • Rendering of rotation of leadscrew and pulleys.
  • Eventual moving of other controls and app interactions into the 3D environment. For example, we could render a little mailbox on top of the utilities pole and a pulsing blue sphere for when the user has mail in the message center. Manual control buttons could be floating near the relevant parts of the FarmBot when in a controls mode. Connectivity info and settings could be found inside the electronics box. Documentation could be opened by clicking a 3D manual located near the utilities pole. Etc. Lots of fun to be had!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

No branches or pull requests

1 participant