aseba-community / aseba

Aseba is a set of tools which allow beginners to program robots easily and efficiently. To contact us, please open an issue.
http://aseba.wikidot.com
GNU Lesser General Public License v3.0
48 stars 62 forks source link

Stop button for Thymio in text mode #160

Closed stephanemagnenat closed 10 years ago

stephanemagnenat commented 11 years ago

Many people ask for a stop button in Thymio when in text mode. This could be implemented as in VPL, through a simple plugin.

stephanemagnenat commented 10 years ago

In issue #86 it was suggested to have the Reset button stopping the motors. This would require a hook in the VM, especially in AsebaVMDebugMessage() at line 729 of vm/vm.c. I can see with Philippe, the firmware maintainer, but not sure he will consider the change worth the added feature. Philippe, if you read this, feel free to comment, thanks!

retornaz commented 10 years ago

No. Doesn't requires anything. What we want is a full robot reset, thus, if you send the already existing ASEBA_MESSAGE_REBOOT message, the VM will call AsebaResetIntoBootloader() which, will according to skel-usb.c line 42 in thymio firmware:

Then the bootloader will:

Then, the main function will be called again, and the robot will restart as usual and immediately switch to the VM mode as the serial port is open.

The only downside of this method is:

If you want to avoid thoses two problems, then I sugest that you simply send a "ASEBA_MESSAGE_STOP" immediately followed by a "ASEBA_MESSAGE_SET_VARIABLES" on the motors variable (they are consecutive, thus only one is needed).

In both case, no changes are needed on the thymio firmware.

stephanemagnenat commented 10 years ago

Hi Philippe, thanks for the explanations!

I did not thought about the reboot message, which indeed work. I agree with your second suggestion, it is what is done in VPL. The idea of Moti was to hook up the ASEBA_MESSAGE_RESET message, which is visually much more accessible that the reboot option. But I will probably implement your second suggestion, which builds on existing code.

stephanemagnenat commented 10 years ago

Implemented in commits c270aee978016ab4f258ef3ca7b3a9ca84854b53 (release-1.3.x) and 96841841c81777bc05341396a4e689d5c1b8b4c9 (master)