Esempio n. 1
0
    def error_publisher(self):
        """
        Publish the error between the car and the cone. We will view this
        with rqt_plot to plot the success of the controller
        """
        error_msg = parking_error()

        #################################

        # Your Code Here
        # Populate error_msg with relative_x, relative_y, sqrt(x^2+y^2)

        #################################
        self.error_pub.publish(error_msg)
    def error_publisher(self):
        """
        Publish the error between the car and the cone. We will view this
        with rqt_plot to plot the success of the controller
        """

        # Might need to subtract desired distance from error???

        error_msg = parking_error()

        error_msg.x_error = self.relative_x
        error_msg.y_error = self.relative_y
        error_msg.distance_error = np.sqrt((self.relative_x**2) +
                                           (self.relative_y**2))

        self.error_pub.publish(error_msg)
Esempio n. 3
0
    def error_publisher(self):
        """
        Publish the error between the car and the cone. We will view this
        with rqt_plot to plot the success of the controller
        """
        error_msg = parking_error()

        #################################

        # Your Code Here
        # Populate error_msg with relative_x, relative_y, sqrt(x^2+y^2)
        error_msg.x_error = self.relative_x
        error_msg.y_error = self.relative_y
        #cartesian distance b/n car and cone
        cart_distance = np.sqrt(self.relative_x**2 + self.relative_y**2)
        error_msg.distance_error = cart_distance
        #################################
        self.error_pub.publish(error_msg)
Esempio n. 4
0
    def error_publisher(self):
        """
        Publish the error between the car and the cone. We will view this
        with rqt_plot to plot the success of the controller
        """
        error_msg = parking_error()
        
        #################################
        
        # Your Code Here
        # Populate error_msg with relative_x, relative_y, sqrt(x^2+y^2)i
        
        est_ang = math.atan2(self.relative_y, self.relative_x)
        est_dis = math.sqrt(self.relative_x**2 + self.relative_y**2)

        error_msg.x_error = est_dis * math.cos(est_ang) - self.parking_distance # x coord when car is parked in front of cone is parking_distance away
        error_msg.y_error = est_dis * math.sin(est_ang)
        error_msg.distance_error = est_dis - self.parking_distance

        #################################

        self.error_pub.publish(error_msg)