def test_creer_chassis(): result = True try: nom = "monChassis" poids = 10 aire_frontale = 2.4 coefficient_trainee = 0.6 chassis = Chassis(nom=nom, poids=poids, aire_frontale=aire_frontale, coefficient_trainee=coefficient_trainee) except: return False result &= chassis.nom == nom result &= chassis.poids == poids result &= chassis.aire_frontale == aire_frontale result &= chassis.coefficient_trainee == coefficient_trainee expected_dict = { '_Chassis__aire_frontale': 2.4, '_Chassis__coefficient_trainee': 0.6, '_Composante__nom': 'monChassis', '_Composante__poids': 10 } result &= chassis.__dict__ == expected_dict return result
def __init__(self, rospy): print 'Differential drive node initialization...' self.left_speed = 0 self.right_speed = 0 self.left_length = 0 self.right_length = 0 print 'Initialize Components...' self.chassis = Chassis() self.speed_measures = SpeedSensors(rospy) print 'Register control topic...' rospy.Subscriber("robot_mg", DiffSpeed, self.move) print 'Done !'
def __init__(self): rospy.init_node('wheel_odom_publisher') self.chassis = Chassis() self.wheel_shifts_sub = rospy.Subscriber('/wheel_shifts', WheelShifts, self.publishOdom) self.odometry_pub = rospy.Publisher('/wheel_odom', Odometry, queue_size=1) self.odometry_calc = OdometryCalculator(self.chassis) self.rate = rospy.Rate(15) self.reset_odom_service = rospy.Service( 'reset_wheel_odom', SetBool, self.resetWheelOdom) #resets odometry to 0,0,0
def __init__(self, host_and_port, adapter, log, device_id): self.log = log self.headers = {'Accept-Encoding': None} self.device_id = device_id """self.adapter_agent = adapter.adapter_agent self.adapter_name = adapter.name """ self.host_and_port = host_and_port.split( ':')[0] + Defaults.redfish_port requests.packages.urllib3.disable_warnings(InsecureRequestWarning) self.chassis_obj = Chassis(self) self.systems_obj = Systems(self) self.ethernet_obj = Ethernet(self) self.sys_info = {}
def main(): parser = argparse.ArgumentParser(description='Starts NetBot client.') parser.add_argument('host', action="store") parser.add_argument('--port', action="store", dest="port", default=2345, type=int, required=False) args = parser.parse_args() host = args.host port = args.port if (host == None) | (port == None): print(parser.usage) exit(0) else: chassis = Chassis() chassis.activate() client = Client(lambda msg: process_message(msg, chassis), get_msg_obj) client.init(host, port) capture_thread = threading.Thread(target=image_capture_thread_func, args=(client, )) capture_thread.start() done = False while not done: done = not client.process_recv_message() chassis.dectivate() stop_event.set() capture_thread.join() for _, cam in cameras.items(): cam.release() client.close()
def get_chassis(self): from chassis import Chassis chassis = Chassis() return chassis
#from chassis import Chassis from telemetry import Telemetry from chassis import Chassis #192.168.1.107 IP_ADDRESS = '10.0.0.22' PORT = 65432 SSID = 'utmresak' telemetry = Telemetry(IP_ADDRESS, PORT, 'wlan0', SSID) chassis = Chassis() while True: connected = telemetry.ping() if not connected: #failsafe condition chassis.stop_all( ) #for extra safety but technically redundant as telemetry.speed is set to 0 failsafe condition telemetry.get_connection(IP_ADDRESS, PORT) chassis.drive(int(telemetry.speed * 100))
def test_creer_vehicule(): result = True try: nom_vehicule = "monVehicule" position_dep = [45, -2, 57] nom_roue = "maRoue" poids_roue = 10 coefficient_friction = 0.4 poids_supporte = 10 roues = [ Roue(nom=nom_roue, poids=poids_roue, coefficient_friction=coefficient_friction, poids_supporte=poids_supporte), Roue(nom=nom_roue, poids=2 * poids_roue, coefficient_friction=2 * coefficient_friction, poids_supporte=2 * poids_supporte) ] nom_moteur = "monMoteur" poids_moteur = 10 acceleration = 2.5 moteur = Moteur(nom=nom_moteur, poids=poids_moteur, acceleration=acceleration) nom_chassis = "monChassis" poids_chassis = 10 aire_frontale = 2.4 coefficient_trainee = 0.6 chassis = Chassis(nom=nom_chassis, poids=poids_chassis, aire_frontale=aire_frontale, coefficient_trainee=coefficient_trainee) vehicule = Vehicule(nom=nom_vehicule, position_dep=position_dep, roues=roues, moteur=moteur, chassis=chassis) result &= vehicule.celebrer() == None result &= vehicule.position == position_dep result &= compare_arrays(vehicule.vitesse, [0, 0, 0]) print(result) result &= vehicule.trainee == 0.0 result &= vehicule.friction == 0.0 dt = 1 vehicule.accelerer(temps_ecoule=dt) result &= compare_arrays(vehicule.vitesse, [0, 0, 2.5]) result &= compare_arrays(vehicule.position, [45, -2, 59.5]) result &= vehicule.trainee == 5.4 result &= vehicule.friction == 3.0 except: return False result &= vehicule.nom == nom_vehicule result &= vehicule.poids == 50 result &= vehicule.traction == 125.0 result &= vehicule.roues == roues result &= vehicule.moteur == moteur result &= vehicule.chassis == chassis result &= vehicule.acceleration == 2.332 expected_dict_keys = [ '_Vehicule__nom', '_Vehicule__vitesse', '_Vehicule__position', '_Vehicule__roues', '_Vehicule__moteur', '_Vehicule__chassis' ] result &= list(vehicule.__dict__.keys()) == expected_dict_keys return result
def __init__(self): self.chassis = Chassis()