public void OnRequestControl(object arg) { JausAddress targetAddress = GenerateCurrentAddress(); if (targetAddress == null) { return; } RequestControl requestControl = new RequestControl(); requestControl.SetAuthorityCode(BadgerControlSubsystem.AUTHORITY_LEVEL); requestControl.SetSource(badgerControlSubsystem.LocalAddress); requestControl.SetDestination(targetAddress); Transport.SendMessage(requestControl); }
protected override void Execute(Component component) { LocateJoystick(); if (!isEnabled || destinationAddress == null) return; // request control and update the GUI to denote this if (!hasControl) { RequestControl requestControl = new RequestControl(); requestControl.SetDestination(destinationAddress); requestControl.SetSource(component.JausAddress); Transport.SendMessage(requestControl); // update the connection icon for the correct component to orange if (destinationAddress.getComponent() == 1) connectionDetails.direct = ConnectionOption.REQUESTING_CONTROL; if (destinationAddress.getComponent() == 2) connectionDetails.remote = ConnectionOption.REQUESTING_CONTROL; if (destinationAddress.getComponent() == 3) connectionDetails.ai = ConnectionOption.REQUESTING_CONTROL; _eventAggregator.GetEvent<ConnectionDetailsEvent>().Publish(connectionDetails); return; } // shut down all components, then resume the one that should be active (i.e. jank hax) if (!isReady) { // shut down all active components Shutdown shutdown = new Shutdown(); int subsys = CurrentDestinationAddress.SubsystemID; int node = CurrentDestinationAddress.getNode(); JausAddress newAddress = new JausAddress(subsys, node, 1); QueryStatus queryStatus = new QueryStatus(); if (componentOneActive) { shutdown.SetDestination(newAddress); Transport.SendMessage(shutdown); queryStatus.SetDestination(newAddress); queryStatus.SetSource(component.JausAddress); Transport.SendMessage(queryStatus); } if (componentTwoActive) { newAddress.setComponent(2); shutdown.SetDestination(newAddress); Transport.SendMessage(shutdown); queryStatus.SetDestination(newAddress); queryStatus.SetSource(component.JausAddress); Transport.SendMessage(queryStatus); } if (componentThreeActive) { newAddress.setComponent(3); shutdown.SetDestination(newAddress); Transport.SendMessage(shutdown); queryStatus = new QueryStatus(); queryStatus.SetDestination(newAddress); queryStatus.SetSource(component.JausAddress); Transport.SendMessage(queryStatus); } // force component to boot Resume resume = new Resume(); resume.SetDestination(destinationAddress); resume.SetSource(component.JausAddress); Transport.SendMessage(resume); // see if the component is ready queryStatus = new QueryStatus(); queryStatus.SetDestination(destinationAddress); queryStatus.SetSource(component.JausAddress); Transport.SendMessage(queryStatus); return; } // send a drive message SetLocalVector msg = new SetLocalVector(); msg.SetDestination(destinationAddress); msg.SetSource(component.JausAddress); // convert joystick degrees into radians // TODO: THIS IS INCORRECT msg.SetHeading(joystickQueryThread.XVelocity * (Math.PI / 180)); //adding 100 to fit into defined setLocalVector MAX_SPEED & MIN_SPEED msg.SetSpeed(joystickQueryThread.YVelocity + 100); Transport.SendMessage(msg); }
public void OnRequestControl(object arg) { JausAddress targetAddress = GenerateCurrentAddress(); if (targetAddress == null) return; RequestControl requestControl = new RequestControl(); requestControl.SetAuthorityCode(BadgerControlSubsystem.AUTHORITY_LEVEL); requestControl.SetSource(badgerControlSubsystem.LocalAddress); requestControl.SetDestination(targetAddress); Transport.SendMessage(requestControl); }
protected override void Execute(Component component) { LocateJoystick(); if (!isEnabled || destinationAddress == null) { return; } // request control and update the GUI to denote this if (!hasControl) { RequestControl requestControl = new RequestControl(); requestControl.SetDestination(destinationAddress); requestControl.SetSource(component.JausAddress); Transport.SendMessage(requestControl); // update the connection icon for the correct component to orange if (destinationAddress.getComponent() == 1) { connectionDetails.direct = ConnectionOption.REQUESTING_CONTROL; } if (destinationAddress.getComponent() == 2) { connectionDetails.remote = ConnectionOption.REQUESTING_CONTROL; } if (destinationAddress.getComponent() == 3) { connectionDetails.ai = ConnectionOption.REQUESTING_CONTROL; } _eventAggregator.GetEvent <ConnectionDetailsEvent>().Publish(connectionDetails); return; } // shut down all components, then resume the one that should be active (i.e. jank hax) if (!isReady) { // shut down all active components Shutdown shutdown = new Shutdown(); int subsys = CurrentDestinationAddress.SubsystemID; int node = CurrentDestinationAddress.getNode(); JausAddress newAddress = new JausAddress(subsys, node, 1); QueryStatus queryStatus = new QueryStatus(); if (componentOneActive) { shutdown.SetDestination(newAddress); Transport.SendMessage(shutdown); queryStatus.SetDestination(newAddress); queryStatus.SetSource(component.JausAddress); Transport.SendMessage(queryStatus); } if (componentTwoActive) { newAddress.setComponent(2); shutdown.SetDestination(newAddress); Transport.SendMessage(shutdown); queryStatus.SetDestination(newAddress); queryStatus.SetSource(component.JausAddress); Transport.SendMessage(queryStatus); } if (componentThreeActive) { newAddress.setComponent(3); shutdown.SetDestination(newAddress); Transport.SendMessage(shutdown); queryStatus = new QueryStatus(); queryStatus.SetDestination(newAddress); queryStatus.SetSource(component.JausAddress); Transport.SendMessage(queryStatus); } // force component to boot Resume resume = new Resume(); resume.SetDestination(destinationAddress); resume.SetSource(component.JausAddress); Transport.SendMessage(resume); // see if the component is ready queryStatus = new QueryStatus(); queryStatus.SetDestination(destinationAddress); queryStatus.SetSource(component.JausAddress); Transport.SendMessage(queryStatus); return; } // send a drive message SetLocalVector msg = new SetLocalVector(); msg.SetDestination(destinationAddress); msg.SetSource(component.JausAddress); // convert joystick degrees into radians // TODO: THIS IS INCORRECT msg.SetHeading(joystickQueryThread.XVelocity * (Math.PI / 180)); //adding 100 to fit into defined setLocalVector MAX_SPEED & MIN_SPEED msg.SetSpeed(joystickQueryThread.YVelocity + 100); Transport.SendMessage(msg); }