Legacy Forum: Preserving Nearly 20 Years of Community History - A Time Capsule of Discussions, Memories, and Shared Experiences.

rcservos libraries crashing

Based on DMP's Vortex processor / SoC this board is a full computer capable of running a standard Windows and Linux installation on the backpack of your robot.
4 postsPage 1 of 1
4 postsPage 1 of 1

rcservos libraries crashing

Post by matt.stevenson » Thu Apr 29, 2010 9:47 pm

Post by matt.stevenson
Thu Apr 29, 2010 9:47 pm

Hi, I recently got a roboard to play with, and I've had success controlling some hitec servos and vex motors through the pwm.

I've been working on writing some java wrappers for the rcservo control, and then exposing that through JMX so I can control the servos using java across a network. I've got this mostly working, and I intend to release it (and network dynamixel control) as open source it in a couple of weeks.

I am able to connect to the servos fine, and I can begin to control them. However, after a few minutes, the roboard libraries crash.

Here is part of the error I get:
Instructions: (pc=0xb4599b8f)
0xb4599b7f: 83 ec 14 8b 45 08 66 89 45 ec 0f b7 45 ec 89 c2
0xb4599b8f: ed 89 45 fc 8b 45 fc c9 c3 55 89 e5 83 ec 08 8b

Stack: [0xb4427000,0xb4477000], sp=0xb4474f18, free space=311k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libServoControlJNIWrapper.so+0x4b8f]
C [libServoControlJNIWrapper.so+0x4e07] io_inpdw+0x14
C [libServoControlJNIWrapper.so+0x5c3a] pwm_ClearMultiFLAG+0x16
C [libServoControlJNIWrapper.so+0x8c1d] _Z20stop_playmode_pulsesv+0x14
C [libServoControlJNIWrapper.so+0x8de9] _Z19set_playmode_pulsesPm+0x17
C [libServoControlJNIWrapper.so+0x7235] rcservo_PlayAction+0x50
C [libServoControlJNIWrapper.so+0x73eb] rcservo_MoveTo+0x1d
C [libServoControlJNIWrapper.so+0x4a2f] Java_servonativewrap_ServoFacade_MoveServos+0x94

My java code is running in a continuous loop, sending move signals with a move time of 25 msec, and then the thread sleeps fro 25 msec. So the roboard get a MoveServos command about every 50 msec.

The board will crash after an arbitrary length of time. Sometimes I will only send out a few commands before it crashes, other times it will run fine for 15-20 minutes before crashing.

Looking at the error and the code, the crash comes from this function call:
inl(addr);
Its a linux port i/o command, but I could't find any further information on it or what is causing the crash.

any ideas?
Hi, I recently got a roboard to play with, and I've had success controlling some hitec servos and vex motors through the pwm.

I've been working on writing some java wrappers for the rcservo control, and then exposing that through JMX so I can control the servos using java across a network. I've got this mostly working, and I intend to release it (and network dynamixel control) as open source it in a couple of weeks.

I am able to connect to the servos fine, and I can begin to control them. However, after a few minutes, the roboard libraries crash.

Here is part of the error I get:
Instructions: (pc=0xb4599b8f)
0xb4599b7f: 83 ec 14 8b 45 08 66 89 45 ec 0f b7 45 ec 89 c2
0xb4599b8f: ed 89 45 fc 8b 45 fc c9 c3 55 89 e5 83 ec 08 8b

Stack: [0xb4427000,0xb4477000], sp=0xb4474f18, free space=311k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libServoControlJNIWrapper.so+0x4b8f]
C [libServoControlJNIWrapper.so+0x4e07] io_inpdw+0x14
C [libServoControlJNIWrapper.so+0x5c3a] pwm_ClearMultiFLAG+0x16
C [libServoControlJNIWrapper.so+0x8c1d] _Z20stop_playmode_pulsesv+0x14
C [libServoControlJNIWrapper.so+0x8de9] _Z19set_playmode_pulsesPm+0x17
C [libServoControlJNIWrapper.so+0x7235] rcservo_PlayAction+0x50
C [libServoControlJNIWrapper.so+0x73eb] rcservo_MoveTo+0x1d
C [libServoControlJNIWrapper.so+0x4a2f] Java_servonativewrap_ServoFacade_MoveServos+0x94

My java code is running in a continuous loop, sending move signals with a move time of 25 msec, and then the thread sleeps fro 25 msec. So the roboard get a MoveServos command about every 50 msec.

The board will crash after an arbitrary length of time. Sometimes I will only send out a few commands before it crashes, other times it will run fine for 15-20 minutes before crashing.

Looking at the error and the code, the crash comes from this function call:
inl(addr);
Its a linux port i/o command, but I could't find any further information on it or what is causing the crash.

any ideas?
matt.stevenson
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu Apr 29, 2010 9:29 pm

Post by matt.stevenson » Fri Apr 30, 2010 8:55 pm

Post by matt.stevenson
Fri Apr 30, 2010 8:55 pm

I wanted to add that I am using hi-tec hs-82mg servos with no feedback.

After calling rcservo_Initialize(...)
I call rcservo_EnterPlayMode_NOFB(...)

Here are my servo settings if that matters:
RCSERVO_svParams[id].servoType = RCSERVO_SV_NOFEEDBACK;
RCSERVO_svParams[id].period = 10000L;
RCSERVO_svParams[id].minDuty = 500L;
RCSERVO_svParams[id].maxDuty = 2500L;
RCSERVO_svParams[id].invalidDuty = 5000L;
RCSERVO_svParams[id].minLowPhase = 500L;
RCSERVO_svParams[id].fbReadMode = RCSERVO_FB_SAFEMODE;
RCSERVO_svParams[id].fbMaxNumFail = 3;
RCSERVO_svParams[id].fbFilterWidth = 3;

RCSERVO_svParams[id].cmdDuty[0] = 50L;
RCSERVO_svParams[id].cmdDuty[1] = 100L;
RCSERVO_svParams[id].cmdDuty[2] = 150L;
RCSERVO_svParams[id].cmdDuty[3] = 200L;
RCSERVO_svParams[id].cmdDuty[4] = 50L;
RCSERVO_svParams[id].cmdDuty[5] = 50L;
RCSERVO_svParams[id].cmdDuty[6] = 50L;
RCSERVO_svParams[id].cmdDuty[7] = 50L;
RCSERVO_svParams[id].cmdInPlayMode = RCSERVO_CMD_POWEROFF;
RCSERVO_svParams[id].capInitDelay = 25L;
RCSERVO_svParams[id].capLastDelay = 250L;
RCSERVO_svParams[id].capMaxWidth = 2800L;
RCSERVO_svParams[id].capResolution = 10L;
RCSERVO_svParams[id].capWidthOffset = ROBOARD_WOFFSET;

Most of those are the default settings, I changed the min and max pulse width, and made sure to set no feedback.

I'm going to do more testing today to see if the problem comes from using Java, or if it is from the C code like I think it is.
I wanted to add that I am using hi-tec hs-82mg servos with no feedback.

After calling rcservo_Initialize(...)
I call rcservo_EnterPlayMode_NOFB(...)

Here are my servo settings if that matters:
RCSERVO_svParams[id].servoType = RCSERVO_SV_NOFEEDBACK;
RCSERVO_svParams[id].period = 10000L;
RCSERVO_svParams[id].minDuty = 500L;
RCSERVO_svParams[id].maxDuty = 2500L;
RCSERVO_svParams[id].invalidDuty = 5000L;
RCSERVO_svParams[id].minLowPhase = 500L;
RCSERVO_svParams[id].fbReadMode = RCSERVO_FB_SAFEMODE;
RCSERVO_svParams[id].fbMaxNumFail = 3;
RCSERVO_svParams[id].fbFilterWidth = 3;

RCSERVO_svParams[id].cmdDuty[0] = 50L;
RCSERVO_svParams[id].cmdDuty[1] = 100L;
RCSERVO_svParams[id].cmdDuty[2] = 150L;
RCSERVO_svParams[id].cmdDuty[3] = 200L;
RCSERVO_svParams[id].cmdDuty[4] = 50L;
RCSERVO_svParams[id].cmdDuty[5] = 50L;
RCSERVO_svParams[id].cmdDuty[6] = 50L;
RCSERVO_svParams[id].cmdDuty[7] = 50L;
RCSERVO_svParams[id].cmdInPlayMode = RCSERVO_CMD_POWEROFF;
RCSERVO_svParams[id].capInitDelay = 25L;
RCSERVO_svParams[id].capLastDelay = 250L;
RCSERVO_svParams[id].capMaxWidth = 2800L;
RCSERVO_svParams[id].capResolution = 10L;
RCSERVO_svParams[id].capWidthOffset = ROBOARD_WOFFSET;

Most of those are the default settings, I changed the min and max pulse width, and made sure to set no feedback.

I'm going to do more testing today to see if the problem comes from using Java, or if it is from the C code like I think it is.
matt.stevenson
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu Apr 29, 2010 9:29 pm

Post by matt.stevenson » Fri Apr 30, 2010 9:25 pm

Post by matt.stevenson
Fri Apr 30, 2010 9:25 pm

Also, I thought I would add that I'm running Ubuntu 10 on my Roboard.

If anyone wants the code I wrote to do the network and Java/C communication, let me know and I'll send it to you. I'll post the code online later today when I get home.
Also, I thought I would add that I'm running Ubuntu 10 on my Roboard.

If anyone wants the code I wrote to do the network and Java/C communication, let me know and I'll send it to you. I'll post the code online later today when I get home.
matt.stevenson
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu Apr 29, 2010 9:29 pm

Post by matt.stevenson » Sat May 01, 2010 8:47 am

Post by matt.stevenson
Sat May 01, 2010 8:47 am

Well, after a good days work I got the issue under control.
It seems that the issue was with how the network communication was being handled.
Occasionally the JMX would be received on a different thread. It would be fine for the java code, but the native library would crash trying to access the pwm port.
So now the JMX listener spawns a new control loop thread.
The listener will make the latest move request available to the control loop, and the control loop runs blissfully unaware of everything else.


In a week or two, I am expecting to release as open source Java libraries to control servos through the PWM ports over a network. I will also have similar Java libraries for Dynamixels (tested with RX-28 and RX-64 on the RS485 port).
Well, after a good days work I got the issue under control.
It seems that the issue was with how the network communication was being handled.
Occasionally the JMX would be received on a different thread. It would be fine for the java code, but the native library would crash trying to access the pwm port.
So now the JMX listener spawns a new control loop thread.
The listener will make the latest move request available to the control loop, and the control loop runs blissfully unaware of everything else.


In a week or two, I am expecting to release as open source Java libraries to control servos through the PWM ports over a network. I will also have similar Java libraries for Dynamixels (tested with RX-28 and RX-64 on the RS485 port).
matt.stevenson
Savvy Roboteer
Savvy Roboteer
Posts: 37
Joined: Thu Apr 29, 2010 9:29 pm


4 postsPage 1 of 1
4 postsPage 1 of 1