From: Joschka B. <jbo...@un...> - 2007-03-02 09:59:48
|
Hi Yuan, Yuan Xu wrote: > > I am working on my team now. > I tried to draw the model specification of soccerbot, > I doubt about (setLocalRotation 0 0 180) > the line 273 in soccerbot.rsg in rcssserver3d-0.5.3 > or line 249 in http://www.uni-koblenz.de/~murray/robocup/soccerbot.rsg > > I want to know is there need this rotation? > Because other right joints are the same direction with the left joints. After having a quick look, I think you're right. This rotation is not needed. I can't test reliably test though right now, because I kind of messed up my SimSpark installation. I'll try again later with a fresh version from the CVS. > And do you have the model specification graphic of soccerbot? > > I'm working on it :-) > And, in app/agentspark/main.cpp "bool GetMessage(string& msg)" function, > I think there is another bug which caused the segment fault: > > > while (msgRead < msgLen) > { > if (! SelectInput()) > { > return false; > } > > msgRead += read(gSocket.getFD(), offset, sizeof(buffer) - > msgRead); > //cerr << "msgRead = |" << msgRead << "|\n"; > offset += msgRead; <-------------BUG????? > } I think you're right again about the bug, but I think it is 2 lines above. In my oppinion, it should be: msgRead += read(gSocket.getFD(), offset, sizeof(buffer) - bytesRead); Example: Say we got a message of 20kB, but our buffer is only 16kB. After the first read in that function, bytesRead will be 16384 which is the maximum. msgLen will be 20000. The first 4 Bytes are the length prefix which is subtracted from bytesRead and stored in msgRead, so it will be 16380. Since msgRead is less than msgLen, we will enter the while loop. Offset was set to the beginning of the buffer + bytesRead which means it's at the end of the buffer. The read inside the loop will, however, still read 4 Bytes if sizeof(buffer) - msgRead is used for the length. This will result in a segfault. Right? Cheers, Joschka |