From: Brian G. <br...@ge...> - 2007-04-03 15:37:23
|
hi Jack, It looks to me like what you're doing should in fact work. I would start debugging in MessageQueue::CheckReplace(), in libplayercore/ message.cc. That's where the queue decides whether to replace a particular message. I'd specifically look at the way it iterates through the stored MessageReplaceRules, calling MessageReplaceRule::Match() on each. brian. On Mar 19, 2007, at 4:43 PM, Jack O'Quin wrote: > I'm working on the player driver for a local navigation and > obstacle avoidance in a car. > > This driver subscribes to several devices: > > * a position2d for controlling the vehicle > * another position2d that reports odometry > * a laser interface > * an opaque occupancy grid interface > > There are two clients sending it "order" commands using > a different opaque interface. One gives it waypoints > to follow with a set of behavior hints. The other is > a diagnostic monitor, which may asynchronously > tell the navigator to pause or resume its run. > > I need most of these interfaces set to "pull with replace" > so the navigator always uses the latest sensor data > when making decisions. > > That works fine, just setting replace mode in the > constructor and requesting pull mode for the queue > like this... > > // constructor, requesting overwrite of commands > NavQueueMgr::NavQueueMgr(ConfigFile* cf, int section) > : Driver(cf, section, true, PLAYER_MSGQUEUE_DEFAULT_MAXLEN, > PLAYER_OPAQUE_CODE) > { > InQueue->SetPull(true); > > BUT, I need to allow queuing of the commands giving orders > to control the navigator's state. Otherwise, a pause command > may be lost due the the nearly simultaneous arrival of a > waypoint following command. > > What I would like to do is set replace mode to false for these > commands only, leaving everything else alone. Then I can implement > a priority scheme for the requested behaviors, with run and pause > having higher priority than waypoint following. I tried to do that > by adding the following call immediately after the code above... > > // allow queuing of opaque Order messages, but nothing else > int my_index = 0; // TODO: parse "provides" to get this > InQueue->AddReplaceRule(-1, -1, PLAYER_OPAQUE_CODE, my_index, > PLAYER_MSGTYPE_CMD, PLAYER_OPAQUE_CMD, false); > > This has no discernable effect. I experimented with setting the > index to -1 instead of 0, but that did not work either. Setting > replace mode globally to false seems to result in handling all the > order messages, but it looks like I only see one at a time, never > two in the same ProcessMessages() cycle, so I fear I am getting > behind in processing commands (as well as sensor inputs). > > Clearly, I do not understand how the queue management works. > A few hints would be greatly appreciated (code to look at, etc.). > I looked at the libplayercore/message.cc implementation, but it > appears to do about what I expected, which is not what I see. > > Maybe this is all just a silly misunderstanding of the docs. > -- > joq > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Playerstage-users mailing list > Pla...@li... > https://lists.sourceforge.net/lists/listinfo/playerstage-users |