Stop Lego NXT drive with Drop handle RRS feed

  • Question

  • Hi! I have a trouble stopping Lego Drive during Drop.

    For example I start motors at Start()


    protected override void Start() {
      // wind up
      drive.SetDrivePowerRequest request = new drive.SetDrivePowerRequest(0.6, 0.6);
          delegate(DefaultUpdateResponseType ok) {
            LogInfo(LogGroups.Console, "Drive start success");
          delegate(Fault fault) {
            LogError(LogGroups.Console, "Drive start failed");

    When the work is done I want to disable all motors.


    public new virtual IEnumerator<ITask> DefaultDropHandler(DsspDefaultDrop dsspDefaultDrop) {
      // stop all motors
      drive.AllStopRequest allStop = new drive.AllStopRequest();
      yield return Arbiter.Choice(
        delegate(DefaultUpdateResponseType ok) {
          LogInfo(LogGroups.Console, "Drive stop success");
        delegate(Fault fault) {
          LogError(LogGroups.Console, "Drive stop failed");
      // wait a little
      yield return TimeoutPort(TimeSpan.FromSeconds(10)).Receive();
      yield break;

    But when press Ctrl+C I receive failure and the motors continue to work. I think that's because Lego Brick disconnect immediately after pressing Ctrl+C and the stop mesagge remains in drive port. Maybe someone knows how to stop the drive when finish?

    Wednesday, April 13, 2011 6:09 AM


  • I have also seen similar behavior (robot continues to drive when using ctrl-c to end a dsshost process.
    I am guessing that by the time the drop handler for your service is called the drive service may already have been torn down.

    What is the error you are seeing?

    I would try modifying the drive service so it performs an allStop during it's teardown, or possibly even having the lego brick service itself do that. 

    Note that if you do modify the sample brick or drive service I would first make a backup copy of the src (you can re-install to get back to the original source but that is a hassle) and the service you are modifying is the "(user)" version, so you will need to use that in your manifest and and partners will then also have to be the "(user)" versions.

    Wednesday, March 14, 2012 5:00 PM