davidjsherman / aseba

Aseba is a set of tools that allow beginners to program robots easily and efficiently.
http://aseba.wikidot.com
GNU Lesser General Public License v3.0
3 stars 2 forks source link

asebascratch could use a broadcast protocol rather than polling #5

Closed davidjsherman closed 8 years ago

davidjsherman commented 9 years ago

Scratch polls asebascratch at 30 Hz. In order to reduce latency we maintain a cache of variable values and request variable updates less frequently. Each variable is a round trip in Aseba with the corresponding overhead.

Since we know which state variables are exposed to scratch, we could package them up in a single broadcast event that is sent by the robot at a regular frequency

davidjsherman commented 9 years ago

In cdb8dea409d837da7fefc5bfad964b5bc2c1d35b we allow asebascratch to listen to an event R_state that encodes 29 state variables in 24 event parameters. A modified thymio_motion.aesl in davidjsherman/inirobot-scratch-thymioII@6b38e1e0a3e6b91f2463f7cca1034f0f272191b7 broadcasts R_state at 10 Hz.

This should be around 3% of the bandwidth of the Thymio RF, assuming 250 Kbps for the RF dongle, and should fit in one 110-byte payload of an IEEE 802.15.4 frame.

davidjsherman commented 8 years ago

The broadcast event approach is not reliable with the Thymio-RF. Work in branch use-R_state adds a variable R_state that encodes the important state variables. If it exists in the AESL program then asebascratch polls for that variable instead of the state variables individually.

davidjsherman commented 8 years ago

Resolved in 1782d7f378bc5876f5a031a72691cd784ccc9a10. The R_state variable is used when it exists in the Aesl program, otherwise state variables are polled.