The character you are getting is a 3 just as you wrote into the data array. If you want the character 3 you need to write '3', or cast the output to an int before you print it.

uint8_t is just an unsigned char in a portable way (from stdint.h)

The array is just opaque data, you can put anything you like in there. There are some helper methods like playerc_pack_blackboard_entry_double to help with floating point etc.

See http://playerstage.sourceforge.net/doc/Player-3.0.2/player/group__playerc__proxy__blackboard.html for similar methods for packing data types,

Regards,
Toby


On 16 February 2013 20:57, kparvate <kanaadp@gmail.com> wrote:
Hi all,

I have tried to set up a communication system for multiple robots, but I am
facing some issues with the Blackboard Proxy associated with the localbb
driver.

Here is my code thus far:

#include <stdio.h>

#include <string.h>
#include <iostream>
#include <libplayerc++/playerc++.h>
#include <sstream>
using namespace std;
using namespace PlayerCc;
int main(int argc, char **argv) {
        PlayerClient robot("localhost", 6665);
        BlackBoardProxy bb(&robot, 0);
        char *key = (char *) "myKey";
        char *group = (char *) "myGroup";

                        player_blackboard_entry_t data,* output;


                data.data = new uint8_t[1];
                data.data_count = 1;
                data.data[0] = 3;
                data.key = key;
                data.key_count = strlen((const char*) key) + 1;
                data.group = group;
                data.group_count = strlen((const char*) group) + 1;
                time_t rawtime;
                time(&rawtime);
                data.timestamp_sec = rawtime;

                try {
                        //updating the key
                        bb.SetEntry(data);
                } catch (PlayerError pe) {
                        cout << "Error: " << pe.GetErrorStr() << endl;
                        return (-1);
                }

                try {

                        output = bb.GetEntry(key,group);
                } catch (PlayerError pe) {
                        cout << "Error: " << pe.GetErrorStr() << endl;
                        return (-1);
                }
                int datacount = output->data_count;
                for(int i=0; i<datacount; i++){
                        cout &lt;&lt; &quot;Data value at &quot; &lt;&lt; i&lt;&lt; &quot; is:
&quot; &lt;&lt; output->data[i];
                }
                cout << endl;
}

Here is the relevant portion of the cfg file just in case:
 driver
 (
  name "localbb"
  provides ["blackboard:0"]
 )

However, I am getting a very weird out put from  output->data[i].         It
doesn't seem to be a normal character. I have attached a picture of it.
<http://player-stage-gazebo.10965.n7.nabble.com/file/n18590/05.png> . Could
someone explain why this is happening, and how to fix it?

Furthermore, I am unfamiliar with the type uint8_t, and I am unsure as to
how I am supposed to store strings or doubles. Any help would be greatly
appreciated.

Cheers.

Kanaad





--
View this message in context: http://player-stage-gazebo.10965.n7.nabble.com/Blackboard-Data-Storage-tp18590.html
Sent from the playerstage-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
The Go Parallel Website, sponsored by Intel - in partnership with Geeknet,
is your hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials, tech docs,
whitepapers, evaluation guides, and opinion stories. Check out the most
recent posts - join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Playerstage-users mailing list
Playerstage-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-users