-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Read the start angle of the field data from the persistent config ins…
…tead of the current config
- Loading branch information
Showing
10 changed files
with
333 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
include/sick_safetyscanners/cola2/MeasurementPersistentConfigVariableCommand.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- | ||
|
||
// -- BEGIN LICENSE BLOCK ---------------------------------------------- | ||
|
||
/*! | ||
* Copyright (C) 2018, SICK AG, Waldkirch | ||
* Copyright (C) 2018, FZI Forschungszentrum Informatik, Karlsruhe, Germany | ||
* | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
// -- END LICENSE BLOCK ------------------------------------------------ | ||
|
||
//---------------------------------------------------------------------- | ||
/*! | ||
* \file MeasurementPersistentConfigVariableCommand.h | ||
* | ||
* \author Lennart Puck <puck@fzi.de> | ||
* \date 2019-01-07 | ||
*/ | ||
//---------------------------------------------------------------------- | ||
|
||
#ifndef SICK_SAFETYSCANNERS_COLA2_MEASUREMENTPERSISTENTCONFIGVARIABLECOMMAND_H | ||
#define SICK_SAFETYSCANNERS_COLA2_MEASUREMENTPERSISTENTCONFIGVARIABLECOMMAND_H | ||
|
||
|
||
#include <sick_safetyscanners/cola2/VariableCommand.h> | ||
#include <sick_safetyscanners/data_processing/ParseMeasurementPersistentConfigData.h> | ||
#include <sick_safetyscanners/datastructure/CommSettings.h> | ||
|
||
namespace sick { | ||
namespace cola2 { | ||
|
||
/*! | ||
* \brief Command to read the persistent configuration from the sensor. | ||
*/ | ||
class MeasurementPersistentConfigVariableCommand : public VariableCommand | ||
{ | ||
public: | ||
/*! | ||
* \brief Typedef to reference the base class. | ||
*/ | ||
typedef sick::cola2::VariableCommand base_class; | ||
|
||
/*! | ||
* \brief Constructor of the command. | ||
* | ||
* Takes the current cola2 session and a reference to the field data variable which will be | ||
* written on execution. The index defines which field variable will be read. Depending on the | ||
* sensor up to 128 variables can be defined. | ||
* | ||
* \param session The current cola2 session. | ||
* \param field_data The field data reference which will be modified on execution. | ||
*/ | ||
MeasurementPersistentConfigVariableCommand(Cola2Session& session, | ||
datastructure::FieldData& field_data); | ||
|
||
/*! | ||
* \brief Adds the data to the telegram. | ||
* | ||
* \param telegram The telegram which will be modified by the data. | ||
*/ | ||
void addTelegramData(sick::datastructure::PacketBuffer::VectorBuffer& telegram) const; | ||
|
||
/*! | ||
* \brief Returns if the command can be executed without a session ID. Will return false for most | ||
* commands except the commands to establish a connection. | ||
* | ||
* \returns If the command needs a session ID to be executed. | ||
*/ | ||
bool canBeExecutedWithoutSessionID() const; | ||
|
||
/*! | ||
* \brief Processes the return from the sensor. | ||
* | ||
* \returns If processing of the returned data was successful. | ||
*/ | ||
bool processReply(); | ||
|
||
|
||
private: | ||
std::shared_ptr<sick::data_processing::ReadWriteHelper> m_writer_ptr; | ||
std::shared_ptr<sick::data_processing::ParseMeasurementPersistentConfigData> | ||
m_measurement_persistent_config_parser_ptr; | ||
|
||
sick::datastructure::FieldData& m_field_data; | ||
}; | ||
|
||
} // namespace cola2 | ||
} // namespace sick | ||
|
||
#endif // SICK_SAFETYSCANNERS_COLA2_MEASUREMENTPERSISTENTCONFIGVARIABLECOMMAND_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
include/sick_safetyscanners/data_processing/ParseMeasurementPersistentConfigData.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- | ||
|
||
// -- BEGIN LICENSE BLOCK ---------------------------------------------- | ||
|
||
/*! | ||
* Copyright (C) 2018, SICK AG, Waldkirch | ||
* Copyright (C) 2018, FZI Forschungszentrum Informatik, Karlsruhe, Germany | ||
* | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
// -- END LICENSE BLOCK ------------------------------------------------ | ||
|
||
//---------------------------------------------------------------------- | ||
/*! | ||
* \file ParseMeasurementPersistentConfigData.h | ||
* | ||
* \author Lennart Puck <puck@fzi.de> | ||
* \date 2018-10-16 | ||
*/ | ||
//---------------------------------------------------------------------- | ||
|
||
#ifndef SICK_SAFETYSCANNERS_DATA_PROCESSING_PARSEMEASUREMENTPERSISTENTCONFIGDATA_H | ||
#define SICK_SAFETYSCANNERS_DATA_PROCESSING_PARSEMEASUREMENTPERSISTENTCONFIGDATA_H | ||
|
||
#include <sick_safetyscanners/datastructure/Data.h> | ||
#include <sick_safetyscanners/datastructure/FieldData.h> | ||
#include <sick_safetyscanners/datastructure/PacketBuffer.h> | ||
|
||
#include <sick_safetyscanners/data_processing/ReadWriteHelper.h> | ||
|
||
namespace sick { | ||
|
||
namespace data_processing { | ||
|
||
|
||
/*! | ||
* \brief Parser to read the persistent configuration of the sensor. | ||
*/ | ||
class ParseMeasurementPersistentConfigData | ||
{ | ||
public: | ||
/*! | ||
* \brief Constructor of the parser. | ||
*/ | ||
ParseMeasurementPersistentConfigData(); | ||
|
||
/*! | ||
* \brief Parses a tcp sequence to read the persistent configuration of the sensor. | ||
* | ||
* \param buffer The incoming tcp sequence. | ||
* \param field_data Reference to the field data where the information will be set. | ||
* | ||
* \returns If parsing was successful. | ||
*/ | ||
bool parseTCPSequence(const datastructure::PacketBuffer& buffer, | ||
datastructure::FieldData& field_data) const; | ||
|
||
private: | ||
std::shared_ptr<sick::data_processing::ReadWriteHelper> m_reader_ptr; | ||
|
||
uint32_t readStartAngle(const uint8_t* data_ptr) const; | ||
}; | ||
|
||
} // namespace data_processing | ||
} // namespace sick | ||
|
||
#endif // SICK_SAFETYSCANNERS_DATA_PROCESSING_PARSEMEASUREMENTPERSISTENTCONFIGDATA_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- | ||
|
||
// -- BEGIN LICENSE BLOCK ---------------------------------------------- | ||
|
||
/*! | ||
* Copyright (C) 2018, SICK AG, Waldkirch | ||
* Copyright (C) 2018, FZI Forschungszentrum Informatik, Karlsruhe, Germany | ||
* | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
// -- END LICENSE BLOCK ------------------------------------------------ | ||
|
||
//---------------------------------------------------------------------- | ||
/*! | ||
* \file MeasurementPersistentConfigVariableCommand.cpp | ||
* | ||
* \author Lennart Puck <puck@fzi.de> | ||
* \date 2019-01-07 | ||
*/ | ||
//---------------------------------------------------------------------- | ||
|
||
#include <sick_safetyscanners/cola2/MeasurementPersistentConfigVariableCommand.h> | ||
|
||
#include <sick_safetyscanners/cola2/Cola2Session.h> | ||
#include <sick_safetyscanners/cola2/Command.h> | ||
|
||
namespace sick { | ||
namespace cola2 { | ||
|
||
MeasurementPersistentConfigVariableCommand::MeasurementPersistentConfigVariableCommand( | ||
Cola2Session& session, datastructure::FieldData& field_data) | ||
: VariableCommand(session, 177) | ||
, m_field_data(field_data) | ||
{ | ||
m_writer_ptr = std::make_shared<sick::data_processing::ReadWriteHelper>(); | ||
m_measurement_persistent_config_parser_ptr = | ||
std::make_shared<sick::data_processing::ParseMeasurementPersistentConfigData>(); | ||
} | ||
|
||
void MeasurementPersistentConfigVariableCommand::addTelegramData( | ||
sick::datastructure::PacketBuffer::VectorBuffer& telegram) const | ||
{ | ||
base_class::addTelegramData(telegram); | ||
} | ||
|
||
bool MeasurementPersistentConfigVariableCommand::canBeExecutedWithoutSessionID() const | ||
{ | ||
return true; | ||
} | ||
|
||
bool MeasurementPersistentConfigVariableCommand::processReply() | ||
{ | ||
if (!base_class::processReply()) | ||
{ | ||
return false; | ||
} | ||
m_measurement_persistent_config_parser_ptr->parseTCPSequence(getDataVector(), m_field_data); | ||
return true; | ||
} | ||
|
||
|
||
} // namespace cola2 | ||
} // namespace sick |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.