This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am beniutek on github. | |
* I am beniutek (https://keybase.io/beniutek) on keybase. | |
* I have a public key ASAfbvSw6AOzTdspKJNzqfZXtx97HX9BYHaiTxRLqMbZdAo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# author: beniutek | |
import math | |
from controller import Robot | |
from controller import Compass | |
def getBearingInDegrees(compass): | |
north = compass.getValues() | |
rad = math.atan2(north[0], north[2]); | |
bearing = (rad - 1.5708) / math.pi * 180.0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is taken from: https://github.com/rails/rails/blob/main/activestorage/app/controllers/active_storage/direct_uploads_controller.rb | |
# Have to override this controller because it's actually the easiest way (IMO) | |
# to let us choose which service to use for a blob that doesn't use | |
# the default rails active storage service | |
# place it in the app/controllers/active_storage folder | |
class ActiveStorage::DirectUploadsController < ActiveStorage::BaseController | |
# by default, active storage doesn't do any authorization, we choose to do it on our own via devise `authenticate_user!` | |
# we also get `current_user` thanks to devise | |
before_action :authenticate_user! |