Changeset 13469


Ignore:
Timestamp:
Sep 13, 2019 2:06:08 PM (3 months ago)
Author:
randersson
Message:

#5819 Added correct tabs into pyjmi example, since apparently this was removed at some unknown time, but looking at trunk it is clear that this change is the desired one.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-5819/Python/src/pyjmi/examples/cart_pendulum.py

    r7418 r13469  
    6969    opts['init_traj'] = init_res
    7070    res = pend_opt.optimize(options=opts)
    71                            
     71                           
    7272    # Extract variable profiles and plot the results
    7373    a_ref = res['a_ref']
     
    7777
    7878    if with_plots:
    79     plt.close(1)
    80     plt.figure(1)
    81     plt.plot(t,a_ref)
    82     plt.grid()
    83     plt.title('Input signal to process ($a_{ref}$)')
    84     plt.xlabel('Time (s)')
    85     plt.ylabel('Acceleration $m/s^2$')
    86        
    87     plt.close(2)
    88     plt.figure(2)
    89     plt.plot(x_p,y_p)
    90     plt.grid()
    91     plt.title('Pendulum end-point path and obstacle')
    92     plt.xlabel('x-coordinate (m)')
    93     plt.ylabel('y-coordinate (m)')
     79        plt.close(1)
     80        plt.figure(1)
     81        plt.plot(t,a_ref)
     82        plt.grid()
     83        plt.title('Input signal to process ($a_{ref}$)')
     84        plt.xlabel('Time (s)')
     85        plt.ylabel('Acceleration $m/s^2$')
     86           
     87        plt.close(2)
     88        plt.figure(2)
     89        plt.plot(x_p,y_p)
     90        plt.grid()
     91        plt.title('Pendulum end-point path and obstacle')
     92        plt.xlabel('x-coordinate (m)')
     93        plt.ylabel('y-coordinate (m)')
    9494
    95     x_obst = N.linspace(-0.35,-0.25)
    96     y_obst = N.sqrt(1-((x_obst+0.3)/0.05)**2)*0.3 - 0.4
     95        x_obst = N.linspace(-0.35,-0.25)
     96        y_obst = N.sqrt(1-((x_obst+0.3)/0.05)**2)*0.3 - 0.4
    9797
    98     x_track = N.linspace(-1.45,0.1)
    99     y_track = N.zeros(N.size(x_track))
     98        x_track = N.linspace(-1.45,0.1)
     99        y_track = N.zeros(N.size(x_track))
    100100
    101     plt.plot(x_obst,y_obst)
    102     plt.plot(x_track,y_track,'--')
     101        plt.plot(x_obst,y_obst)
     102        plt.plot(x_track,y_track,'--')
    103103
    104     plt.show()
     104        plt.show()
    105105
    106106if __name__ == "__main__":
Note: See TracChangeset for help on using the changeset viewer.