Sending a Script to the Create?

27 replies [Last post]
Aaron Mutchler
Title: NooBot
Joined: 02/17/2013
Posts:
BotPoints: 29
User offline. Last seen 8 years 8 weeks ago.

I am trying to send a script to the create. So far I have discovered that there are no supported functions in the KISS IDE that allow me to do so. How can I accomplish this? Also, is it possible to delete a loaded script off of the Create and then send it a new one through the CBC? Any help would be greatly appreciated.

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 18 weeks ago.

Hi Aaron, welcome to the Botball Community!

If you're interested in writing your own library, read my GCER papers on Create Open Interface Scripting: http://community.botball.org/forum/technical/programming/gcer-papers-cre...

If you're looking for a prewritten library for the CBC, Garrett Sickles has written a quite nice library: https://github.com/normanadvanced/OpenCode

If you're looking for a prewritten library for the Link, as far as I know you're out of luck. Last I heard, Garrett's library does not work on the Link without major modifications (which have not yet been publicly released). I wouldn't be surprised if a Link-compatible scripting library were released at GCER 2013, but that's not certain at this point.

Scripts last until they finish executing, or until the Create is power-cycled. If you send the Create a script via the CBC, you can send a second script immediately and it will sit in the input buffer until the first script is finished, at which point the second script will immediately begin executing. If you want to interrupt a script that hasn't finished, there's a pin on the Cargo Bay Connector which can power-cycle the Create (see the Create manual), which you might be able to trigger from a CBC's digital output. Or you could use a servo to tap the Create's power-button twice (Norman Advanced did this in 2011).

Hope this info helps!

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

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

Is it legal in Botball to use the cargo bay pins? If it is, under what conditions can you use it?

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 18 weeks ago.

My team used the Cargo Bay Connector to power motors in the past; we even won an award for it in 2009. As far as I know, there are no restrictions on using it, so long as you haven't made any hardware modifications. That said, if you want a guarantee that it's legal, you should ask on the Game Rules FAQ on the Home Base.

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

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

Doesn't connecting motors to the cargo bay require you to bend the motor pins?

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 18 weeks ago.

You can avoid bending the motor pins if you're willing to use 2 servo extension cables. Connect one cable to the three PWR pins, and another cable to the three LSD pins. I think I mention this in my 2009 paper.

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

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

Ah, ok. One last question. What is the actual function that sends the script to the Create? I was told that there was not a supported one in the KISS IDE (I haven't checked the new IDE with the LINK). If there is not one, how does one create one? I looked at the Norman Advanced Robotics open source code from last year and didn't fully understand what is the line of code that actually sends the script.

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 18 weeks ago.

If you're using a Conventional Script or a Subroutine Script, you have to send a byte to the Create that tells it a script is coming, followed by a byte containing the size of the script in bytes, and after you send the commands of the script, you have to send another byte to tell it to play the script you stored. I don't recommend this in most cases. If you're using an Input Buffer Script (which I prefer), you don't have to do anything special, there are just a few extra commands you can send (the Wait commands). My papers, and the Create OI manual, are a good source of info on this.

EDIT: On the XBC, this is serial_write_byte(). On the CBC, this is create_write_byte(). No idea about the Link.

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

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

Thanks. This was a tremendous help!

Jeremy Rand
Jeremy Rand's picture
Title: Botball Youth Advisory Council
Joined: 04/03/2009
Posts:
BotPoints: 1168
User offline. Last seen 7 years 18 weeks ago.

Happy to help, good luck!

-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS

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

I tried the create_write_byte and it didn't recognize it as a function. Should I ignore this compile error and just load the program onto the CBC with a flash drive?