Skip to content

Commit

Permalink
Merge pull request #3690 from dorian3d/update_libtm
Browse files Browse the repository at this point in the history
libtm: interface updated to latest firmware
  • Loading branch information
dorodnic authored Apr 7, 2019
2 parents fe8ca57 + 44a340e commit ab141eb
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 78 deletions.
8 changes: 0 additions & 8 deletions third-party/libtm/libtm/include/TrackingDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,14 +409,6 @@ namespace perc
*/
virtual Status SetLocalizationData(IN Listener* listener, IN uint32_t length, IN const uint8_t* buffer) = 0;

/**
* @brief ResetLocalizationData
* Resets the localization data
* @param flag - 0 - Reset all localization data tables, 1 - reset only the map by its mapIndex
* @return Status
*/
virtual Status ResetLocalizationData(IN uint8_t flag) = 0;

/**
* @brief SetStaticNode
* Set a relative position of a static node
Expand Down
1 change: 0 additions & 1 deletion third-party/libtm/libtm/src/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ std::string messageCodeToString(libusb_transfer_type type, uint16_t code)
case SLAM_SET_6DOF_INTERRUPT_RATE: return "SLAM_SET_6DOF_INTERRUPT_RATE";
case SLAM_6DOF_CONTROL: return "SLAM_6DOF_CONTROL";
case SLAM_OCCUPANCY_MAP_CONTROL: return "SLAM_OCCUPANCY_MAP_CONTROL";
case SLAM_RESET_LOCALIZATION_DATA: return "SLAM_RESET_LOCALIZATION_DATA";
case SLAM_GET_LOCALIZATION_DATA_STREAM: return "SLAM_GET_LOCALIZATION_DATA_STREAM";
case SLAM_SET_STATIC_NODE: return "SLAM_SET_STATIC_NODE";
case SLAM_GET_STATIC_NODE: return "SLAM_GET_STATIC_NODE";
Expand Down
28 changes: 0 additions & 28 deletions third-party/libtm/libtm/src/Device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1769,34 +1769,6 @@ namespace perc {
return setMsg.Result == 0 ? Status::SUCCESS : Status::COMMON_ERROR;
}

Status Device::ResetLocalizationData(uint8_t flag)
{
bulk_message_request_reset_localization_data request = {0};
bulk_message_response_reset_localization_data response = {0};

if (flag > 1)
{
DEVICELOGE("Error: Flag (%d) is unknown", flag);
return Status::ERROR_PARAMETER_INVALID;
}

request.header.wMessageID = SLAM_RESET_LOCALIZATION_DATA;
request.header.dwLength = sizeof(request);
request.bFlag = flag;

DEVICELOGD("Set Reset Localization Data - Flag 0x%X", flag);
Bulk_Message msg((uint8_t*)&request, request.header.dwLength, (uint8_t*)&response, sizeof(response), mEndpointBulkMessages | TO_DEVICE, mEndpointBulkMessages | TO_HOST);

mDispatcher->sendMessage(&mFsm, msg);
if (msg.Result != toUnderlying(Status::SUCCESS))
{
DEVICELOGE("USB Error (0x%X)", msg.Result);
return Status::ERROR_USB_TRANSFER;
}

return fwToHostStatus((MESSAGE_STATUS)response.header.wStatus);
}

Status Device::SetStaticNode(const char* guid, const TrackingData::RelativePose& relativePose)
{
bulk_message_request_set_static_node request = { 0 };
Expand Down
1 change: 0 additions & 1 deletion third-party/libtm/libtm/src/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ namespace perc
virtual Status DeleteConfiguration(uint16_t tableType) override;
virtual Status GetLocalizationData(Listener* listener) override;
virtual Status SetLocalizationData(Listener* listener, uint32_t length, const uint8_t* buffer) override;
virtual Status ResetLocalizationData(uint8_t flag) override;
virtual Status SetStaticNode(const char* guid, const TrackingData::RelativePose& relativePose) override;
virtual Status GetStaticNode(const char* guid, TrackingData::RelativePose& relativePose) override;
virtual Status SetGeoLocation(const TrackingData::GeoLocalization& geoLocation) override;
Expand Down
17 changes: 0 additions & 17 deletions third-party/libtm/libtm/src/Message.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ namespace perc
SLAM_SET_6DOF_INTERRUPT_RATE = 0x1005,
SLAM_6DOF_CONTROL = 0x1006,
SLAM_OCCUPANCY_MAP_CONTROL = 0x1007,
SLAM_RESET_LOCALIZATION_DATA = 0x1008,
SLAM_GET_LOCALIZATION_DATA_STREAM = 0x1009,
SLAM_SET_STATIC_NODE = 0x100A,
SLAM_GET_STATIC_NODE = 0x100B,
Expand Down Expand Up @@ -1037,22 +1036,6 @@ namespace perc
} bulk_message_large_stream;


/**
* @brief Bulk reset Localization Data Message
*
* Resets the localization data
*/
typedef struct {
bulk_message_request_header header; /**< Message request header: dwLength = 8 bytes, wMessageID = SLAM_RESET_LOCALIZATION_DATA */
uint8_t bFlag; /**< 0 - Reset all localization data, 1 - Reset only the map by its bMapIndex */
uint8_t bReserved; /**< Reserved = 0 */
} bulk_message_request_reset_localization_data;

typedef struct {
bulk_message_response_header header; /**< Message response header: dwLength = 8 bytes, wMessageID = SLAM_RESET_LOCALIZATION_DATA */
} bulk_message_response_reset_localization_data;


/**
* @brief Bulk Set Static Node Message
*
Expand Down
29 changes: 6 additions & 23 deletions third-party/libtm/tools/libtm_util/libtm_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ enum LocalizationType
{
LocalizationTypeGet = 0,
LocalizationTypeSet = 1,
LocalizationTypeReset = 2,
LocalizationTypeMax = 3,
LocalizationTypeMax = 2,
};

enum ControllerBurnState
Expand Down Expand Up @@ -2818,12 +2817,8 @@ int parseArguments(int argc, char *argv[])
/* Make sure we aren't at the end of argv */
if ((i + 1 < argc) && (strstr(argv[i + 1], "-") != argv[i + 1]))
{
if (strncmp("reset", argv[++i], 3) == 0)
{
gConfiguration.localization[LocalizationTypeReset].enabled = true;
parseError = false;
}
else if ((i + 1 < argc) && (strstr(argv[i + 1], "-") != argv[i + 1]))
++i;
if ((i + 1 < argc) && (strstr(argv[i + 1], "-") != argv[i + 1]))
{
if (strncmp("set", argv[i], 3) == 0)
{
Expand All @@ -2842,10 +2837,9 @@ int parseArguments(int argc, char *argv[])

if (parseError == true)
{
printf("-map : Reset/Set/Get localization map from/to an external file\n");
printf(" On multiple call, the order will be: Get, Set, Reset\n");
printf(" Parameters: <reset/set/get> <filename>\n");
printf(" Example: \"libtm_util.exe -map reset\" : reset localization map\n");
printf("-map : Set/Get localization map from/to an external file\n");
printf(" On multiple call, the order will be: Get, Set\n");
printf(" Parameters: <set/get> <filename>\n");
printf(" Example: \"libtm_util.exe -map set localization_map_input_file\" : set localization from file localization_map_input_file\n");
printf(" Example: \"libtm_util.exe -map get localization_map_output_file\" : get localization to a new file localization_map_output_file\n");
printf(" Notice: To get localization map, 6dof must be enabled\n");
Expand Down Expand Up @@ -3942,17 +3936,6 @@ int main(int argc, char *argv[])
}
}

if (gConfiguration.localization[LocalizationTypeReset].enabled == true)
{
LOGD("Reseting localization map");
status = gDevice->ResetLocalizationData(0);
if (status != Status::SUCCESS)
{
LOGE("Failed to reset localization map, status = %s (0x%X)", statusToString(status).c_str(), status);
goto cleanup;
}
}

if (gConfiguration.gpioEnabled == true)
{
LOGD("Setting GPIO control bitMask 0x%X", gConfiguration.gpioControlBitMask);
Expand Down

0 comments on commit ab141eb

Please sign in to comment.