davidjsherman / inirobot-scratch-thymioII

Link Scratch 2 and the Thymio-II robot
7 stars 2 forks source link

not working with wireless Thymio #4

Closed mbonani closed 8 years ago

mbonani commented 8 years ago

Hi,

I try to test with the Wireless dongle and get a runtime_error, :

D:\asebacomp\Scratch2-ThymioII-0.7-Win7>start "Scratch-ThymioII" /min /w /b bin/ asebascratch --aesl bin/thymio_motion.aesl ser:name=Thymio-II Found Thymio-II on port .\COM17 terminate called after throwing an instance of 'std::runtime_error' what(): Can't allocate an unused node id for target id 52704 in stream 0x2b48 ee4 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information.

Same error with a robot that has a wireless module but connect with cable

There is no crashes with robot that have not wireless module with firmware 9 or 10.

I think there is a problem with the wireless Thymio. The nodeID of Aseba are changing from on robot to the other.

Kind regards

davidjsherman commented 8 years ago

My code for collision avoidance makes some guesses about what node ids might be encountered, and it seems that they are wrong. The code is the same for wired and wireless connections, and only depends on the value that the robot reports. Could you tell me the node id for that particular robot? There is a hack-y workaround: like asebaswitch, you can use Dashel parameters remapLocal and remapTarget to renumber nodes, if you know the value that you want to replace. Do you happen to know the valid range for node ids?

mbonani commented 8 years ago

In asebastudio it was show as "-12832", the id is a 16bit but aseba show it as an signed int16. Probably it is here the problem, because when I change it to "12832" it works (with the hidden aseba function _rf.nodeid(), you have to power off and on the robot after execute one time the function).

davidjsherman commented 8 years ago

Fixed in davidjsherman/aseba@fd347dc2c78c84062df829b9b0a4fe37342e596b. Finding an unused id proceeds by steps of 20 and simply wraps around when the unsigned 16-bit values overflow.