def __init__(self, name):

        # Transforms absolute_target_position into a position in the frame of
        # the turtlesim, based on the input of this class.
        self.absolute_to_relative = TurtlesimTransform(name +
                                                       "_absolute_to_relative")

        # Computes the desired velocity based on the relative position using a
        # basic PD controller.
        self.pd_controller = TurtlesimControl(name + "_linear_control")
        self.pd_controller.setKp(np.array([0.0, 0.0]))  # the gains
        # Internal plug of this sub_graph
        plug(self.absolute_to_relative.relative_position,
             self.pd_controller.error)

        # Declaration of the sub graph inputs
        self.robot_absolute_position_sin = self.absolute_to_relative.robot_absolute_position
        self.robot_orientation_sin = self.absolute_to_relative.robot_orientation
        self.absolute_target_position_sin = self.absolute_to_relative.absolute_position

        # Declaration of the sub graph outputs
        self.control_sout = self.pd_controller.desired_velocity

        writeGraph("/tmp/my_graph.dot")
Esempio n. 2
0
def createPdf(name='graph', folder='/tmp/'):
    file = folder + name
    writeGraph(file+'.dot')
    import os
    os.system('dot -o '+file+'.pdf -Tpdf '+file+'.dot')
    os.system('evince '+file+'.pdf &')
Esempio n. 3
0
def createPdf(name='graph', folder='/tmp/'):
    file = folder + name
    writeGraph(file + '.dot')
    import os
    os.system('dot -o ' + file + '.pdf -Tpdf ' + file + '.dot')
    os.system('evince ' + file + '.pdf &')
Esempio n. 4
0
def write_svg_graph(path='/tmp/'):
    ''' outputs a svg of the graph to the specified path '''
    writeGraph(path + 'graph.dot')
    os.system('dot -Tsvg ' + path + 'graph.dot -o ' + path + 'graph.svg')
    return
Esempio n. 5
0
def write_pdf_graph(path='/tmp/'):
    ''' outputs a pdf of the graph to the specified path '''
    writeGraph(path + 'graph.dot')
    os.system('dot -Tpdf ' + path + 'graph.dot -o ' + path + 'graph.pdf')
    return
Esempio n. 6
0
def draw_simple_graph():
    writeGraph('/tmp/robot_state_reference_from_slider.dot')