Snakey knits a blaket

Threading the tasks of the project together.

Posted by Nelson Raphael November 13th, 2017

It is getting cold outside so it seems like a great time for Snakey to learn to knit a blanket.

Continuing from the visualization aspect of last week's blog post, when we model the motion of the snake we have to make sure each of the tasks in action are threaded together. This way the modeling is as accurate as possible and the decision making can be made as accuately as possible.

Currently the modeling functions on what is known as a poor man's scheduler where the process is not truly threaded, but in fact it captures an image at a lower frequency than when the motors are commanded to their new position for the motion. As a result the model jumps from pose to pose without a really smooth trajectory.

There are some obstacles we will have to combat regarding getting the threading to work since we have three tasks. MATLAB, our current programming language of choice limits us to just two threads at a time. Therefore we have to create a pseudo-thread that will operate during the main thread in order for it to work correctly.

This can be done simply by creating a large while loop for the main thread that has certain conditions (based on the frequencies needed) for the if statements to execute the tasks they refer to. MATLAB is able to execute a timer thread and this will be where the more frequent executions are needed (i.e. the motor commands).

Once this is corrected then we can move into creating demo runs that demonstrate each aspect of the project working together.

Caption text

Placeholder text by Nelson R.. Photographs by NASA on The Commons.