mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-02 09:30:25 +08:00
Bump version 0.20.22. Refactored RtabmapThread commands handling. MainWindow/RtabmapThread/Statistics/UVariant: added new option to republish missing data on GUI side. MainWindow: fixed 1 sec lag when waypoints are used. Parameters: added Rtabmap/MaxRepublished (moved from rtabmap_ros). OccupancyGrid: fixed ground cells ignored if there are empty cells, also don't add pose in addedNodes if corresponding node was not in cache.
This commit is contained in:
@@ -93,6 +93,54 @@ UVariant::UVariant(const std::string & value) :
|
||||
{
|
||||
memcpy(data_.data(), value.data(), value.size()+1);
|
||||
}
|
||||
UVariant::UVariant(const std::vector<char> & value) :
|
||||
type_(kCharArray),
|
||||
data_(sizeof(char)*value.size())
|
||||
{
|
||||
memcpy(data_.data(), value.data(), sizeof(char)*value.size());
|
||||
}
|
||||
UVariant::UVariant(const std::vector<unsigned char> & value) :
|
||||
type_(kUCharArray),
|
||||
data_(sizeof(unsigned char)*value.size())
|
||||
{
|
||||
memcpy(data_.data(), value.data(), sizeof(unsigned char)*value.size());
|
||||
}
|
||||
UVariant::UVariant(const std::vector<short> & value) :
|
||||
type_(kShortArray),
|
||||
data_(sizeof(short)*value.size())
|
||||
{
|
||||
memcpy(data_.data(), value.data(), sizeof(short)*value.size());
|
||||
}
|
||||
UVariant::UVariant(const std::vector<unsigned short> & value) :
|
||||
type_(kUShortArray),
|
||||
data_(sizeof(unsigned short)*value.size())
|
||||
{
|
||||
memcpy(data_.data(), value.data(), sizeof(unsigned short)*value.size());
|
||||
}
|
||||
UVariant::UVariant(const std::vector<int> & value) :
|
||||
type_(kIntArray),
|
||||
data_(sizeof(int)*value.size())
|
||||
{
|
||||
memcpy(data_.data(), value.data(), sizeof(int)*value.size());
|
||||
}
|
||||
UVariant::UVariant(const std::vector<unsigned int> & value) :
|
||||
type_(kUIntArray),
|
||||
data_(sizeof(unsigned int)*value.size())
|
||||
{
|
||||
memcpy(data_.data(), value.data(), sizeof(unsigned int)*value.size());
|
||||
}
|
||||
UVariant::UVariant(const std::vector<float> & value) :
|
||||
type_(kFloatArray),
|
||||
data_(sizeof(float)*value.size())
|
||||
{
|
||||
memcpy(data_.data(), value.data(), sizeof(float)*value.size());
|
||||
}
|
||||
UVariant::UVariant(const std::vector<double> & value) :
|
||||
type_(kDoubleArray),
|
||||
data_(sizeof(double)*value.size())
|
||||
{
|
||||
memcpy(data_.data(), value.data(), sizeof(double)*value.size());
|
||||
}
|
||||
|
||||
bool UVariant::toBool() const
|
||||
{
|
||||
@@ -641,3 +689,182 @@ std::string UVariant::toStr(bool * ok) const
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
std::vector<char> UVariant::toCharArray(bool * ok) const
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = false;
|
||||
}
|
||||
|
||||
std::vector<char> v;
|
||||
if(type_ == kCharArray)
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = true;
|
||||
}
|
||||
if(data_.size())
|
||||
{
|
||||
v.resize(data_.size() / sizeof(char));
|
||||
memcpy(v.data(), data_.data(), data_.size());
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> UVariant::toUCharArray(bool * ok) const
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = false;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> v;
|
||||
if(type_ == kUCharArray)
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = true;
|
||||
}
|
||||
if(data_.size())
|
||||
{
|
||||
v.resize(data_.size() / sizeof(unsigned char));
|
||||
memcpy(v.data(), data_.data(), data_.size());
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
std::vector<short> UVariant::toShortArray(bool * ok) const
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = false;
|
||||
}
|
||||
|
||||
std::vector<short> v;
|
||||
if(type_ == kShortArray)
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = true;
|
||||
}
|
||||
if(data_.size())
|
||||
{
|
||||
v.resize(data_.size() / sizeof(short));
|
||||
memcpy(v.data(), data_.data(), data_.size());
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
std::vector<unsigned short> UVariant::toUShortArray(bool * ok) const
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = false;
|
||||
}
|
||||
|
||||
std::vector<unsigned short> v;
|
||||
if(type_ == kUShortArray)
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = true;
|
||||
}
|
||||
if(data_.size())
|
||||
{
|
||||
v.resize(data_.size() / sizeof(unsigned short));
|
||||
memcpy(v.data(), data_.data(), data_.size());
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
std::vector<int> UVariant::toIntArray(bool * ok) const
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = false;
|
||||
}
|
||||
|
||||
std::vector<int> v;
|
||||
if(type_ == kIntArray)
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = true;
|
||||
}
|
||||
if(data_.size())
|
||||
{
|
||||
v.resize(data_.size() / sizeof(int));
|
||||
memcpy(v.data(), data_.data(), data_.size());
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
std::vector<unsigned int> UVariant::toUIntArray(bool * ok) const
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = false;
|
||||
}
|
||||
|
||||
std::vector<unsigned int> v;
|
||||
if(type_ == kUIntArray)
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = true;
|
||||
}
|
||||
if(data_.size())
|
||||
{
|
||||
v.resize(data_.size() / sizeof(unsigned int));
|
||||
memcpy(v.data(), data_.data(), data_.size());
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
std::vector<float> UVariant::toFloatArray(bool * ok) const
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = false;
|
||||
}
|
||||
|
||||
std::vector<float> v;
|
||||
if(type_ == kFloatArray)
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = true;
|
||||
}
|
||||
if(data_.size())
|
||||
{
|
||||
v.resize(data_.size() / sizeof(float));
|
||||
memcpy(v.data(), data_.data(), data_.size());
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
std::vector<double> UVariant::toDoubleArray(bool * ok) const
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = false;
|
||||
}
|
||||
|
||||
std::vector<double> v;
|
||||
if(type_ == kDoubleArray)
|
||||
{
|
||||
if(ok)
|
||||
{
|
||||
*ok = true;
|
||||
}
|
||||
if(data_.size())
|
||||
{
|
||||
v.resize(data_.size() / sizeof(double));
|
||||
memcpy(v.data(), data_.data(), data_.size());
|
||||
}
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user