Errors when enabling servos

3 replies [Last post]
anair13
Title: NooBot
Joined: 02/04/2012
Posts:
BotPoints: 7
User offline. Last seen 9 years 33 weeks ago.

I get that there is a segmentation fault when running something like


Servo lifter;
...
lifter = new Servo(1);
System.out.println(lifter.getPosition());
lifter.enable();
lifter.setPosition(LIFTER_DOWN);

It seems to fail on lifter.enable(). If lifter.enable() is excluded, I get a NoSuchMethodError about lifter.setPosition( ), which makes even less sense to me. Has anyone seen anything like this before?

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

I have not programmed in java on the CBC, but you don't need to enable a servo. Simply setting a position will enable it, and this way, it won't go to the default position and jerk when the program starts. I think your error is the remains of old code that should be removed.

-Marty Rand
{
Senior programmer at Norman Advanced Robotics

Former senior programmer at Whittier Middle School

Youth Advisory Council

All around nerd
}

anair13
Title: NooBot
Joined: 02/04/2012
Posts:
BotPoints: 7
User offline. Last seen 9 years 33 weeks ago.

Thanks, Marty. You were right: enabling is not necessary. I believe our problem was generally caused by using different versions of the CBCJVM.

Beta
Beta's picture
Title: The Magnificent
Joined: 02/24/2012
Posts:
BotPoints: 266
User offline. Last seen 8 years 32 weeks ago.

I will see if we can't get these removed in the next release. I agree, they are very confusing.

Braden McDorman

Developer of the KIPR Link, KISS IDE, KIPR's 2D Simulator, and CBCJVM.

Reach me at bmcdorman(cat)kipr(dog)org where (cat)=@ and (dog)=. if you need assistance of any kind.