<commit_before>import numpy as np
import robot



def navigateToWaypoint(X,Y):


    #assuming robot is at (0,0,0)

    #xnew = cos(theta)*d
    #ynew = sin(theta)*d

    d = np.sqrt(X*X + Y*Y)
    sin_theta = Y/d
    cos_theta = X/d

    #theta is in radians
    theta_rad = np.arccos(cos_theta)

    #turn theta into degrees
    theta_deg = theta_rad * 360.0 / (2.0* np.pi)

    #call function that rotates robot by theta_deg degrees
    robot.left(theta_deg)


    #call function to move robot straight for d cm
    robot.forwards(d)


path_planning((0,0,0),(0,-1))
888
def path_planning(current_loc, goal):

    #need to translate our frame of reference
    x_c, y_c, theta_c = current_loc  #!!!!!make sure that theta_c is in degrees!
    x_g, y_g = goal


    d = np.sqrt((x_c-x_g)**2+(y_c-y_g)**2)


    #calculate angle of goal point with respect to real frame
    sin_theta = y_g/d
    cos_theta = x_g/d

    #theta is in radians
    theta_rad = np.arccos(cos_theta)

    #turn theta into degrees
    theta_deg = np.rad2deg(theta_rad)<commit_msg>use numpy radian converter<commit_after>import numpy as np
import robot



def navigateToWaypoint(X,Y):


    #assuming robot is at (0,0,0)

    #xnew = cos(theta)*d
    #ynew = sin(theta)*d

    d = np.sqrt(X*X + Y*Y)
    sin_theta = Y/d
    cos_theta = X/d

    #theta is in radians
    theta_rad = np.arccos(cos_theta)

    #turn theta into degrees
    theta_deg = theta_rad * 360.0 / (2.0* np.pi)

    #call function that rotates robot by theta_deg degrees
    robot.left(theta_deg)


    #call function to move robot straight for d cm
    robot.forwards(d)


def path_planning(current_loc, goal):

    #need to translate our frame of reference
    x_c, y_c, theta_c = current_loc  #!!!!!make sure that theta_c is in degrees!
    x_g, y_g = goal


    d = np.sqrt((x_c-x_g)**2+(y_c-y_g)**2)


    #calculate angle of goal point with respect to real frame
    sin_theta = y_g/d
    cos_theta = x_g/d

    #theta is in radians
    theta_rad = np.arccos(cos_theta)

    #turn theta into degrees
    theta_deg = np.rad2deg(theta_rad)
{'fraction_non_alphanumeric': 0.10397700047915669, 'fraction_numerical': 0.015333013895543843, 'mean_word_length': 2.888268156424581, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5169264', 'n_tokens_mistral': 841, 'n_tokens_neox': 769, 'n_words': 224}