Working with JSON Data, thenewboston 21
- need a .json file
- accessible on thenewboston github
- put it in main directory
- when copy and pasting code with messed up tabs
- crtl+a
- crtl+alt+l
- reformats code to organize
- local variables
- makes an "universal" variable for the whole program
- after app
- app.locals.any_word = variable
- makes something "local" to app
- type the word to display variable
- json = javascript object
- can set the local variable to a json file
- with json data, use forEach is used a lot to list out everything
In this video, we learned about json data which seems very useful. Using json data, we are able to list out multiple things and use a certain information repeatedly without having to type it out numerous times.
Passing JSON Data Using Routes, thenewboston 22
- code is specific to a single webpage
- put it in that route
- code that can be used everywhere
- app.js
- two dots means move up a directory
- finds the file from there
- var anything = require (json file)
- organizes the information
In this video, we learned how to organize the json data. It is crucial to be organized when coding and this tutorial emphasized it. Content inside of app.js are codes that apply to the whole program and everything else should be in their own file.
- require('module')
- necessary when referencing a specific module
- this can be stored into a variable
- require ('./file') can also be stored into a variable
- to install new modules, you can type npm install module_name
- typing node file in the terminal will execute the command
- ardrone_tool_set_ui_pad_start
- AT*REF
- int value: take off flag
- 1 to take-off
- 0 to land
- AT*REF = %d, %d<CR>
- sequence number, integer value representing a 32 bit-wide bit-field controlling the drone
- ardrone_tool_set_ui_pad_select
- AT*REF
- int value: emergency flag
- 1 to send emergency signal to the drone
- tells the drone to stop and land
- check navdata to see the drone's state
- 0 to stop sending emergency signal
- ardrone_at_set_progress_cmd
- AT*PCMD
- int flags
- enables progressive commands and the new Combined Yaw control mode
- float phi
- left or right bending angle
- 0 is the horizontal plane
- negative means left
- positive means right
- float theta
- front or back bending angle
- 0 is the horizontal plane
- negative means front
- positive means back
- float gaz
- the vertical speed of the drone
- float yaw
- the angular speed of the drone around the yaw-axis
- everything should be between the values -1 to 1
- ardrone_at_set_progress_cmd_with_magneto
- also moves the drone
- however, it allows the Absolute Control mode
- AT*PCMD_MAG
- same as the prior but has
- float magneto_psi
- angle of controlling device from north, value between -1 to 1
- float magneto_psi_accuracy
- the accuracy of the magneto_psi value between -1 to 1
- like the bullet point before this, this does nothing if the drone is on ground
- AT*PCMD_MAG=%d,%d,%d,%d,%d,%d,%d<CR>
- sequence number, flag enabling the progressive commands and/or Combined Yaw mode (bitfield), phi, theta, gaz, yaw, magneto psi, magneto psi accuracy
- ardrone_at_set_flat_trim
- AT*FTRIM=%d,<CR>
- sequence number
- sets a reference of the horizontal plane for the drone
- has to be called when drone is sitting on a horizontal ground
- stabilizes the drone when in air
- cannot be sent when the drone is already in air
- ardrone_at_set_calibration
- AT*CALIB=%d,%d,<CR>
- sequence number, identifier of the device to calibrate
- identifier can be chosen from ardrone_calibration_device_t
- calibrate drone magnetometer
- must be sent when drone is flying
- ardrone_at_set_toy_configuration
- AT*CONFIG=%d,%s,%s<CR>
- sequence number, option to set (byte with hex, value 22h), option value between double quotes
- AT*CONFIG_IDS=%d,%s,%s,%s<CR>
- sequence number, session id, user id, application id
- use during multiconfiguration
- only applied when the id match the AR.Drone
- ARDroneTool does this automatically
- AT*COMWDG
- reset communication watchdog
These were notes that we found online and we also looked at the ARDrone notes because we haven't seen it since the first few weeks. It was a nice change to just studying node.js. There is a lot of information inside the guide that we have to review and understand thoroughly. Just from Chapter 4 and 6 alone in the guide, we feel like there is an overwhelming amount of knowledge that we need to comprehend.
No comments:
Post a Comment