Sending a Script to the Create?

27 replies [Last post]
KCotrone
Title: NooBot
Joined: 01/29/2013
Posts:
BotPoints: 38
User offline. Last seen 8 years 50 weeks ago.

The Link uses create_read_block(). The function isn't blocking and returns -1. You have to read what create_read_block() returns and then wait until it's not -1. If you just want to use the information to use sync, you don't have to worry about what it returns, you just have to wait until it returns something other than -1.

edit: Also not that this is on 1.9.

Marty Rand
Marty Rand's picture
Title: Botball Youth Advisory Council
Joined: 07/04/2009
Posts:
BotPoints: 253
User offline. Last seen 8 years 8 weeks ago.

KCotrone is correct. Use create_read_block(). It will return -1 while the create is busy with your script. Wait in a while loop for create_read_block() to return 1. At that point, the script has finished. This has to be changed from the stock opencode library. The new version should be on GitHub soon I believe (no release date though).

-Marty Rand
{
Senior programmer at Norman Advanced Robotics

Former senior programmer at Whittier Middle School

Youth Advisory Council

All around nerd
}

KCotrone
Title: NooBot
Joined: 01/29/2013
Posts:
BotPoints: 38
User offline. Last seen 8 years 50 weeks ago.

I just updated the create_sensor portion to include the changes to create_read_block.

If you'd like a place to get started with a function similar to sync the create movements you can look here:
https://github.com/normanadvanced/OpenCode/blob/master/opencode/create/c...

Aaron Mutchler
Title: NooBot
Joined: 02/17/2013
Posts:
BotPoints: 29
User offline. Last seen 8 years 9 weeks ago.

Ok, thank you. I have already looked at the sync function you have written and it has been quite helpful.

Aaron Mutchler
Title: NooBot
Joined: 02/17/2013
Posts:
BotPoints: 29
User offline. Last seen 8 years 9 weeks ago.

Ok, thank you. I have already looked at the sync function you have written and it has been quite helpful.

KCotrone
Title: NooBot
Joined: 01/29/2013
Posts:
BotPoints: 38
User offline. Last seen 8 years 50 weeks ago.

If you have any other questions regarding the create, I'd be happy to answer them. How is the create library going?

Aaron Mutchler
Title: NooBot
Joined: 02/17/2013
Posts:
BotPoints: 29
User offline. Last seen 8 years 9 weeks ago.

The library is going quite well. All of the move functions are much more accurate than the KIPR move functions. I know what the parameters or create_read_block() are but I don't understand what the parameters are asking for. I have been using
char buffer[1];
char *bptr = buffer;
for the buffer and 1 for the count (I got that code from the opencode). It worked but I would like to understand what it is doing