How to use set_test_parameters method in autotest

Best Python code snippet using autotest_python

pid_tuning.py

Source:pid_tuning.py Github

copy

Full Screen

...91 await self.protocol.feedback_controller.request_all()92 self.num_cycles = 593 self.low_position = 10094 self.high_position = 70095 await self.set_test_parameters()96 await self.prompt('Press enter to begin: ')97 await self.dashboard.plotter.toggler.start_plotting()98 try:99 while True:100 for i in range(self.num_cycles):101 await self.go_to_position(self.low_position)102 await asyncio.sleep(0.5)103 await self.go_to_position(self.high_position)104 await asyncio.sleep(0.5)105 print('Finished test cycles!')106 self.dashboard.plotter.position_plotter.stop_plotting()107 self.dashboard.plotter.duty_plotter.stop_plotting()108 await self.set_test_parameters()109 await self.prompt('Press enter to restart: ')110 self.dashboard.plotter.position_plotter.clear()111 self.dashboard.plotter.duty_plotter.clear()112 if self.dashboard.plotter.toggler.plotting:113 self.dashboard.plotter.position_plotter.start_plotting()114 self.dashboard.plotter.duty_plotter.start_plotting()115 except KeyboardInterrupt:116 await self.dashboard.plotter.toggler.stop_plotting()117 print('Idling...')118 self.dashboard.plotter.server.run_until_shutdown()119 async def set_test_parameters(self):120 """Set the test motion parameters."""121 self.num_cycles = await self.prompt.number(122 'How many test cycles to run?', self.num_cycles123 )124 self.low_position = await self.prompt.number(125 'Low target position?', self.low_position126 )127 self.high_position = await self.prompt.number(128 'High target position?', self.high_position129 )130 async def go_to_position(self, position):131 """Send the actuator to the specified position."""132 self.dashboard.plotter.position_plotter.add_arrow(position, slope=2)133 self.dashboard.plotter.duty_plotter.start_state_region()...

Full Screen

Full Screen

run.py

Source:run.py Github

copy

Full Screen

...40 lp = LearningParameters()41 lp.set_rm_learning(rm_init_steps=200e3, rm_u_max=10, rm_preprocess=True, rm_tabu_size=10000, 42 rm_lr_steps=100, rm_workers=n_workers)43 lp.set_rl_parameters(gamma=0.9, train_steps=None, episode_horizon=int(5e3), epsilon=0.1, max_learning_steps=None)44 lp.set_test_parameters(test_freq = int(1e4))45 lp.set_deep_rl(lr = 5e-5, learning_starts = 50000, train_freq = 1, target_network_update_freq = 100, 46 buffer_size = 100000, batch_size = 32, use_double_dqn = True, num_hidden_layers = 5, num_neurons = 64)47 # Setting the environment48 env_params = set_environment(env, lp)49 # Choosing the RL algorithm50 print("\n----------------------")51 print("LRM agent:", rl)52 print("----------------------\n")53 # Running the experiment54 run_lrm_experiments(env_params, lp, rl, n_seed, save)55def run_baseline_agent(rl, env, n_seed, k_order):56 save = True57 print("Running", str(k_order)+"-order", rl, "in", env, "using seed", n_seed)58 if save: print("SAVING RESULTS!")59 else: print("*NOT* SAVING RESULTS!")60 # Setting the learning parameters61 lp = LearningParameters()62 lp.set_rl_parameters(gamma=0.9, train_steps=int(5e6), episode_horizon=int(5e3), epsilon=0.1, max_learning_steps=None)63 lp.set_test_parameters(test_freq = int(1e4))64 lp.set_deep_rl(lr = 5e-5, learning_starts = 50000, train_freq = 1, target_network_update_freq = 100, 65 buffer_size = 100000, batch_size = 32, use_double_dqn = True, num_hidden_layers = 5, num_neurons = 64)66 # Setting the environment67 env_params = set_environment(env, lp)68 # Choosing the RL algorithm69 print("\n----------------------")70 print("Baseline:", rl)71 print("----------------------\n")72 # Running the experiment73 run_baseline_experiments(env_params, lp, rl, k_order, n_seed, save)74if __name__ == "__main__":75 # EXAMPLE: python3 run.py --agent="lrm-dqn" --world="cookie" --seed=1 --workers=1676 # EXAMPLE: python3 run.py --agent="lrm-dqn" --world="keys" --seed=1 --workers=1677 # EXAMPLE: python3 run.py --agent="lrm-dqn" --world="symbol" --seed=1 --workers=16...

Full Screen

Full Screen

test_parameters.py

Source:test_parameters.py Github

copy

Full Screen

1#!/usr/bin/env python2import rospy3import sys4import actionlib5from infrastructure_msgs.msg import TestParametersAction, TestParametersGoal, TestParametersFeedback, TestParametersResult6class TestParameters():7 8 def __init__(self): 9 #initializing actionservers10 self.test_parameters = actionlib.SimpleActionServer("set_test_parameters", TestParametersAction, self.set_parameters_callback, False) 11 self.test_parameters.start()12 13 def set_parameters_callback(self, goal):14 #ANY CHECKS FOR PARAMETERS AND EXECUTION OF PARAMETERS ON HARDWARE HERE15 self.test_parameters.publish_feedback(TestParametersFeedback(status="EXAMPLE: CHANGED OBJECT"))16 self.test_parameters.set_succeeded(TestParametersResult(result=0), text="SUCCESS")17 #Or if failed:18 #self.test_parameters.set_aborted(TestParameters(result = 100), text="FAILED")19if __name__ == '__main__':20 rospy.init_node("test_parameters", argv=sys.argv)21 begin = TestParameters()...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful