problem with blackboard

View: New views
2 Messages — Rating Filter:   Alert me  

problem with blackboard

by arik_chen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi, all
I am trying to use blackboard to conduct inter-robot communication
However, I encounter a problem to do a simple test.
the following is part of the code, it will firstly put some data to the entry
and then get the data from the entry.
The problem is that it will segment fault in line 25
. anyone can give me some hint, please.

  4     robot = new PlayerCc::PlayerClient(host, port);
  5     // arm with equipment
  6     pos = new PlayerCc::Position2dProxy(robot, index);
  7
  8     gp = new PlayerCc::GripperProxy(robot, index);
  9
 10     bbp = new PlayerCc::BlackBoardProxy(robot, index);


 18 void pbAgent::communicate()
 19 {
 20     const char * key = "test";
 21     const char * group = "arik";
 22     player_blackboard_entry_t data;
 23     player_blackboard_entry_t *mydata;
 24     std::cout<<"bb in !"<<endl;
 25     bbp->SubscribeToKey(key, group);
 26     std::cout<<"bb entry set!"<<endl;
 27     data.data_count = 3;
 28     data.data[0] = 'a';
 29     data.data[1] = 'b';
 30     data.data[2] = 'c';
 31     bbp->SetEntry(data);
 32     std::cout<<"bb entry ready!"<<endl;
 33     mydata = bbp->GetEntry(key, group);
 34     std::cout<<"bb entry got!"<<endl;
 35     if(mydata)
 36     {
 37       printf("blackboard:%c", (char)mydata->data[0]);
 38     }
 39 }

thanks for your reply

Arik

Re: problem with blackboard

by arik_chen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, all
I have figured out my problem, it seems because I bind the blackboard device with a port which is consumed by another device.
I have another question, anyone know how to use the function
SubscribeToKey() and
SetEventHandler()  

arik_chen wrote:
hi, all
I am trying to use blackboard to conduct inter-robot communication
However, I encounter a problem to do a simple test.
the following is part of the code, it will firstly put some data to the entry
and then get the data from the entry.
The problem is that it will segment fault in line 25
. anyone can give me some hint, please.

  4     robot = new PlayerCc::PlayerClient(host, port);
  5     // arm with equipment
  6     pos = new PlayerCc::Position2dProxy(robot, index);
  7
  8     gp = new PlayerCc::GripperProxy(robot, index);
  9
 10     bbp = new PlayerCc::BlackBoardProxy(robot, index);


 18 void pbAgent::communicate()
 19 {
 20     const char * key = "test";
 21     const char * group = "arik";
 22     player_blackboard_entry_t data;
 23     player_blackboard_entry_t *mydata;
 24     std::cout<<"bb in !"<<endl;
 25     bbp->SubscribeToKey(key, group);
 26     std::cout<<"bb entry set!"<<endl;
 27     data.data_count = 3;
 28     data.data[0] = 'a';
 29     data.data[1] = 'b';
 30     data.data[2] = 'c';
 31     bbp->SetEntry(data);
 32     std::cout<<"bb entry ready!"<<endl;
 33     mydata = bbp->GetEntry(key, group);
 34     std::cout<<"bb entry got!"<<endl;
 35     if(mydata)
 36     {
 37       printf("blackboard:%c", (char)mydata->data[0]);
 38     }
 39 }

thanks for your reply

Arik