Caution! Items in the model view may be closer than they appear.

Correcting start and stop conditions for the push threading script.

Posted by Nelson Raphael February 9th, 2018

As I continue to debug the push threading script for the I realized I neglected to add a very crucial detail when creating the start and stop conditions.

Due to the successful threading of the modeling sequence with the motion sequence we can observe the environment during the real time movement.

Unfortunately since I was focused on replicating my start and stop conditions from my former push primitive state machine I forgot that these conditions need to be dependent on the snakes location relative to the environment. This will require me to first pull the height of the obstacles within the area of interest and the height of the snake in that same region.

A simple approach to this problem would be to create conditions that pull the values of the snake's current location in the environment. This can be done simply by accessing the xVal variables in the Snake model class and then accessing the model variable in the Environment model class. Using the x-index of the snake you can overlay the index on the environment and it will pinpoint the location of that motor relative to the environment. We will be checking if the motor is at least at the height of one block to start it. Then we will check f the motor is within 40 millimeters from the base of the environment to end it.

Prior to correcting this the start and stop conditions were dependent on the angles of the snake robot and whether the motors with ids greater than 1 were shifted with an angle greater than or equal to 10. These will be handled internally from now on as a series of substages.

You must walk before you run.

Just in the preliminary stages I have added just one push primitive sub-strategy so I can make sure it is actually functioning. During the initial state the snake detects whether there is an object in front of it and then executes the caterpillar gait. So it may be difficult to observe this in the video that the push primitive actually occurs for the snake body.

Eureka!
It works. Here is what it looks like with just the push primitive isolated. This was done on the previous snake that has more motors.

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