def test_creer_moto(): result = True try: nom_moto = "maMoto" position_dep = [45, -3, 57] moto = Moto(nom=nom_moto, position_dep=position_dep) result &= isinstance(moto.celebrer(), str) except: return False result &= moto.nom == nom_moto result &= compare_arrays(moto.vitesse, [0, 0, 0]) result &= compare_arrays(moto.position, position_dep) result &= moto.poids == 202 result &= moto.traction == 1878.6000000000001 result &= moto.trainee == 0.0 result &= moto.friction == 0.0 expected_dict_keys = [ '_Vehicule__nom', '_Vehicule__vitesse', '_Vehicule__position', '_Vehicule__roues', '_Vehicule__moteur', '_Vehicule__chassis' ] result &= list(moto.__dict__.keys()) == expected_dict_keys expected_n_wheels = 2 result &= len(moto.__dict__.get('_Vehicule__roues', [])) == expected_n_wheels return result
def cadastra_jetski(): print("Informe os dados do seu jetski") ano = input('Ano:') cor = input('Cor:') modelo = input('Modelo:') marca = input('Marca:') return Moto(placa, ano, cor, marca, km)
def cadastra_moto(): print("Informe os dados da sua moto") placa = input('Placa:') ano = input('Ano:') cor = input('Cor:') marca = input('Marca:') km = input('Km:') return Moto(placa, ano, cor, marca, km)
from moto import Moto from carro import Carro moto = Moto('pneus', 'pintura', 'marca', 'modelo', 'guidon') carro = Carro('pneus', 'pintura', 'marca', 'modelo', 'ar_condicionado') print(moto) print(carro)
from moto.simple_message import ( JointFeedbackEx, JointTrajPtExData, JointTrajPtFull, JointTrajPtFullEx, ) import copy from opcua import ua, Server import numpy as np import json robot_pos_file = "serverDouble_robot_test1.json" simulation_pos_file = "serverDouble_sin_test1.json" robot: Moto = Moto( "192.168.255.200", [ControlGroupDefinition("robot", 0, 6, ["s", "l", "u", "r", "b", "t"])], ) #connect to physical robot and prepare for movement robot.motion.start_servos() robot.motion.start_trajectory_mode() check_ready = robot.motion.check_motion_ready() print("robot ready?..............") print(check_ready) time.sleep(3) def disconnect(self): client.close()
def __init__(self, name): Moto.__init__(self, name) self.features = [('Marque', 'Suzuki'), ('cc', '650')] self.gladius_model = None
def __init__(self, name): Moto.__init__(self, name) self.features = [('Marque', 'Yamaha'), ('cc', '650')] self.er6_model = None
MsgType, RobotStatus, SimpleMessage, MOT_MAX_GR, ) import copy from opcua import ua, Server import numpy as np #robotip:192.168.255.200 #robotip:192.168.255.200 #m er et object(?) i/av klassen Moto robot: Moto = Moto( "localhost", [ControlGroupDefinition("robot", 0, 6, ["s", "l", "u", "r", "b", "t"])], ) ''' først: robot.motion.start_servos() så: robot.motion.start_trajectory_mode() så sjekk status: status = robot.motion.check_motion_ready() print("status of robot is: ", status)''' robot.motion.start_servos() robot.motion.start_trajectory_mode() #print("##############\nPosition of joint {}\n##############".format(type(robot.state.joint_feedback(0))))
from automovel import Automovel from carro import Carro from moto import Moto if __name__ == '__main__': c = Carro('Chevrolet', 'Onix') m = Moto('Yamaha', '300') # O python tem métodos especiais que podem ser usados fazendo __metodo__( # esses dois underlines juntos são chamdos de dunder no python) # são vaŕios os métodos especiais ,usaremos alguns para demonstração # doc faz referencia a toda docstring usada para documentar aquela classe print('c.__doc__ ', c.__doc__) # dict traz o objeto ctomovel criado print('c.__dict__ ', c.__dict__) # module significa o modulo de classe usada, que no nosso caso é Carro print('c.__module__ ', c.__module__) # getattribute pega o valor do atributo passado como parametro, que no nosso caso é marca print('c.__getattribute__ ', c.__getattribute__('marca')) # setattr seta um atributo novo nessa instancia de automovel, chamado velocidade maxima print('c.__setattr__ ', c.__setattr__('velocidade_maxima', 250)) # poderiamos pegar o valor desse novo atributo criado print('c.__getattribute__ ', c.__getattribute__('velocidade_maxima')) # sizeof traz o tamanho da instancia em bytes print('c.__sizeof__ ', c.__sizeof__()) # Podemos também ver se Carro é uma instancia de Automovel print('isinstance(c, Automovel) ', isinstance(c, Automovel)) # Podemos também usar os métodos criados por nós na classe c.acelera() c.acelera()
m = Moto( "192.168.255.200", [ ControlGroupDefinition( groupid="robot", groupno=0, num_joints=6, joint_names=[ "joint_1_s", "joint_2_l", "joint_3_u", "joint_4_r", "joint_5_b", "joint_6_t", ], ), ControlGroupDefinition( groupid="positioner", groupno=1, num_joints=2, joint_names=[ "joint_1", "joint_2", ], ), ], start_motion_connection=True, start_state_connection=True, )
from moto import Moto estado_moto = int(input('Digite 8 para ligar moto: ')) estado_marcha = int( input( 'Digite qual macha você deseja:\n (0) Neutro, (1) Primeira marcha, (2) Segunda marcha, (3) Terceira macha :' )) moto1 = Moto('Honda', 'R1', 'Azul', estado_marcha, estado_moto) moto1.ligar() moto1.marcha_acima() moto1.imprimir() moto1.marcha_abaixo() moto1.imprimir()
else: print('THE INPUT IS INVALID, PLEASE ENTER NUMBER') #operations for motor elif choose == 2: print("1. Insert New Motor") print("2. Delete Motor") print("3. Rent Motor") print("4. See all available Motor") print("5. Check the carbon footprint of a motor") print("6. Go ahead or Stop") # User input the operation they want to make operation = int(input("\nPlease enter the number of the operation you want to perform: ")) if operation: if operation == 1: new = Moto() new.add_vehicle(all_vehicles) elif operation == 2: delete = Moto() delete.delete_vehicle(all_vehicles) elif operation == 3: rent = Moto() rent.rent_vehicle(all_vehicles) elif operation == 4: view = Moto() view.view_vehicle(all_vehicles) elif operation == 5: check = Car() check.carbon_footprint(all_vehicles) elif operation == 6: nooperation = Car()
from veiculo import Veiculo from carro import Carro from moto import Moto fusca = Carro("Volkswagem", "Fusca", 5, 41, 8.4, 'Verde', 5, 4) fusca.dados() corolla = Carro("Toyota", "Corolla", 5, 60, 10.6, "Preto", 6, 4) corolla.dados() camaro = Carro("Chevrolet", "Camaro", 2, 80, 11.2, "Amarelo", 5, 4) camaro.dados() titan = Moto("Honda", "Titan 150", 2, 80, 11.2, "Azul", 5, 2) titan.dados()