Index: trunk/lib/FlairSensorActuator/src/VrpnClient_impl.cpp
===================================================================
--- trunk/lib/FlairSensorActuator/src/VrpnClient_impl.cpp	(revision 446)
+++ trunk/lib/FlairSensorActuator/src/VrpnClient_impl.cpp	(revision 447)
@@ -128,6 +128,6 @@
     mutex->ReleaseMutex();
   } else if (connectionType==VrpnClient::VrpnLite) {
-    if(trackables.size()<0xffff) {
-      uint16_t id=trackables.size();
+    if(trackables.size()<INT16_MAX) {
+      int16_t id=trackables.size()+1;//avoid 0; positive values for adding, negative for removing
       mutex->GetMutex();
       trackables.push_back(obj);
@@ -162,4 +162,21 @@
 void VrpnClient_impl::RemoveTrackable(VrpnObject_impl *obj) {
   mutex->GetMutex();
+  //send remove notification to vrpnlite
+  if (connectionType==VrpnClient::VrpnLite) {
+    for (size_t i = 0; i < trackables.size(); i++) {
+      if(trackables.at(i)==obj) {
+        int16_t id=-(i+1);//avoid 0; positive values for adding, negative for removing
+        
+        char char_array[obj->self->ObjectName().length() + sizeof(id)];
+        strcpy(char_array, obj->self->ObjectName().c_str());
+        dataSocket->HostToNetwork((char*)(&id),sizeof(id));
+        memcpy(&char_array[obj->self->ObjectName().length()],&id,sizeof(id));
+        dataSocket->SendMessage(char_array,obj->self->ObjectName().length() + sizeof(id));
+        break;
+      }
+    }
+  }
+  
+  //update vector
   if (connectionType==VrpnClient::Vrpn || connectionType==VrpnClient::VrpnLite) {
     for (vector<VrpnObject_impl *>::iterator it = trackables.begin();it < trackables.end(); it++) {
Index: trunk/tools/VrpnLite/src/VrpnLite.cpp
===================================================================
--- trunk/tools/VrpnLite/src/VrpnLite.cpp	(revision 446)
+++ trunk/tools/VrpnLite/src/VrpnLite.cpp	(revision 447)
@@ -23,4 +23,5 @@
 #include <Quaternion.h>
 #include <string.h>
+#include <bits/stdc++.h>
 
 using namespace std;
@@ -61,22 +62,43 @@
     ssize_t rcv=dataSocket->RecvMessage(msg,sizeof(msg),dataSocketTimeout,NULL,NULL,&src_id);
     if(rcv>0) {
-      string object=msg;
-      uint16_t id;
-      memcpy(&id,&msg[rcv-2],sizeof(id));
+      int16_t id;
+      string object=string(msg,rcv-sizeof(id));
+      memcpy(&id,&msg[rcv-sizeof(id)],sizeof(id));
       dataSocket->HostToNetwork((char*)&id,sizeof(id));
-      
-      if(src_id==vrpnobjects_list.size()) {
-        vector<VrpnObject*> vect;
-        vrpnobjects_list.push_back(vect);
-        //Printf("add vect %i\n",src_id);
-      }
-      //assume we receive it in the good order
-      if(id==vrpnobjects_list.at(src_id).size()) {
-        Printf("adding object %s with id %i from %i\n",object.c_str(),id,src_id);
-        VrpnObject* vrpnobject = new VrpnObject(object,vrpnclient->GetTabWidget());
-        vrpnobjects.push_back(vrpnobject);
-        vrpnobjects_list.at(src_id).push_back(vrpnobject);
-      }else {
-        Err("adding object %s failed, expected id %i, got %i\n",object.c_str(),vrpnobjects.size(),id);
+      Printf("src id %i\n",src_id);
+      if(id>0) { //add object
+        if(src_id==vrpnobjects_list.size()) {
+          vector<VrpnObject*> vect;
+          vrpnobjects_list.push_back(vect);
+          //Printf("add vect %i\n",src_id);
+        }
+        //assume we receive it in the good order
+        if(id==vrpnobjects_list.at(src_id).size()+1) {//id 0 is not used as we use positive and negative id for add/remove
+          Printf("adding object %s with id %i from client %i\n",object.c_str(),id,src_id);
+          VrpnObject* vrpnobject = new VrpnObject(object,vrpnclient->GetTabWidget());
+          vrpnobjects.push_back(vrpnobject);
+          vrpnobjects_list.at(src_id).push_back(vrpnobject);
+        }else {
+          Err("adding object %s failed, expected id %i, got %i\n",object.c_str(),vrpnobjects_list.at(src_id).size()+1,id);
+        }
+      } else { //remove object
+        for (vector<VrpnObject*>::iterator it = vrpnobjects.begin();it < vrpnobjects.end(); it++) {
+          if ((*it)->ObjectName() == object) {
+            Printf("removing object %s with id %i from client %i\n",object.c_str(),-id,src_id);
+            auto iteratorEnd=remove(vrpnobjects_list.at(src_id).begin(), vrpnobjects_list.at(src_id).end(),(*it));
+            vrpnobjects_list.at(src_id).erase(iteratorEnd, vrpnobjects_list.at(src_id).end());
+            if(vrpnobjects_list.at(src_id).size()==0) {
+              Printf("not removing empty vrpnobjects_list (need code rewrite\n");
+              //le src_id va continuer a augmenter cote udtsocket et la comparaison if(src_id==vrpnobjects_list.size()) {
+                //ne va pas marcher; il faut identifier autrement les src
+              //auto iteratorEnd=remove(vrpnobjects_list.begin(), vrpnobjects_list.end(),vrpnobjects_list.at(src_id));
+              //vrpnobjects_list.erase(iteratorEnd, vrpnobjects_list.end());
+            }
+            delete (*it);
+            vrpnobjects.erase(it);
+            break;
+          }
+        }
+        
       }
     }
