Acceleration of a Create

3 replies [Last post]
barvey
Title: NooBot+
Joined: 07/10/2010
Posts:
BotPoints: 8
User offline. Last seen 11 years 21 weeks ago.

Does anyone know the acceleration of a create? I'm trying to write a program to make it move a certain distance but i think the acceleration is throwing me off.
void drive_straight(float cm, int speed){
float mm = cm*10;
float t = mm/((float)speed);
if (t<0){
t=t*-1;
}
printf("%f",t);
create_drive_straight(-((int)speed));
sleep(t);
create_stop();
}
Any help/advice/general knowledge that you would be willing to share?

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 barvey, welcome to the Botball Community!

You may want to look at the distance measurement functionality of the Create. It can tell you how far the Create has traveled in millimeters, and is probably much more accurate than trying to guess with timing. The KISS-C manual should have details.

Feel free to post if you need more details.

-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

barvey
Title: NooBot+
Joined: 07/10/2010
Posts:
BotPoints: 8
User offline. Last seen 11 years 21 weeks ago.

Thanks for the tip! However, I'm getting some weird errors. When I compile it in KISS C, I have no problem. But when I download it to the CBC, I get the error "undefined reference to 'get_create_distance'". Here's my code.
void crDrive(float cm, int speed){
gc_distance=set_create_distance(0);
float mm = cm*10;
float t = mm/((float)speed);
if (t<0){
t=t*-1;
}
printf("%f",t);
create_drive_straight(-speed);
sleep(t-.2);
printf("%d\n", get_create_distance(5/speed));
while (get_create_distance(5/200)

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.

Having code compile in KISS-C but not in the CBC GUI or vice versa usually means one of three things:

1. You're using undocumented features of KISS-C or the CBC Firmware, e.g. getpwm(). I think this is unlikely.
2. You're using functionality that requires Chumby software, Linux, or Windows, and therefore cannot compile on both platforms. This is unlikely as well.
3. You're using a mismatched CBC Firmware and KISS-C. This is the most likely culprit.

Make sure that you're using the latest KISS-C and the latest CBC Firmware. If you're using the NHS Patchset firmware from last year, you'll probably want to use a version of KISS-C from last year.

Let us know if that solves your issue or if you have any more questions. :-)

-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