-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Sdo info support #93
Open
Rdk-T
wants to merge
6
commits into
master
Choose a base branch
from
sdo-info-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,11 @@ int main(int argc, char *argv[]) | |
// Map RXPDO | ||
mapPDO(0, 0x1600, pdo::rx_mapping, pdo::rx_mapping_count, 0x1C12); | ||
|
||
// Map TXPDO | ||
mapPDO(1, 0x1A00, pdo::tx_mapping, pdo::tx_mapping_count, 0x1C13); | ||
// Map RXPDO | ||
mapPDO(1, 0x1600, pdo::rx_mapping, pdo::rx_mapping_count, 0x1C12); | ||
|
||
bus.createMapping(io_buffer); | ||
|
||
bus.requestState(State::SAFE_OP); | ||
|
@@ -158,10 +163,33 @@ int main(int argc, char *argv[]) | |
|
||
// Setting a small torque | ||
output_pdo->mode_of_operation = 0x5; | ||
output_pdo->target_torque = 3; | ||
output_pdo->target_torque = 0.01; | ||
output_pdo->max_current = 3990; | ||
output_pdo->target_position = 0; | ||
|
||
|
||
// uint32_t size = 4; | ||
// uint32_t vendorID; | ||
// bus.readSDO(ingenia, 0x1018, 0x01, Bus::Access::PARTIAL, &vendorID, &size); | ||
// printf("Direct vendor id %x \n", vendorID); | ||
|
||
|
||
uint8_t buffer[4096]; | ||
uint32_t data_size = 4096; | ||
|
||
// bus.getObjectDictionnaryList(ingenia, CoE::SDO::information::ListType::AllObjects, buffer, &data_size); | ||
// bus.getObjectDescription(ingenia, 0x2018, buffer, &data_size); | ||
|
||
CoE::SDO::information::ValueInfo value_info{7,1,1,1,1, 1}; | ||
bus.getEntryDescription(ingenia, 0x2018, 0, value_info, buffer, &data_size); | ||
|
||
// CoE::UnitType unit_test; | ||
// unit_test.denominator = 0x48; | ||
// unit_test.numerator = 0x01; | ||
// unit_test.prefix = 0x03; | ||
// bus.getUnitDescription(ingenia, unit_test); | ||
|
||
std::abort(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. such violence 🤣 |
||
constexpr int64_t LOOP_NUMBER = 12 * 3600 * 1000; // 12h | ||
int64_t last_error = 0; | ||
for (int64_t i = 0; i < LOOP_NUMBER; ++i) | ||
|
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 |
---|---|---|
|
@@ -103,6 +103,14 @@ namespace kickcat | |
std::shared_ptr<AbstractMessage> createSDO(uint16_t index, uint8_t subindex, bool CA, uint8_t request, void* data, uint32_t* data_size, nanoseconds timeout = 20ms); | ||
std::shared_ptr<GatewayMessage> createGatewayMessage(uint8_t const* raw_message, int32_t raw_message_size, uint16_t gateway_index, nanoseconds timeout = 20ms); | ||
|
||
std::shared_ptr<AbstractMessage> createSDOInfoGetODList(CoE::SDO::information::ListType type, void* data, | ||
uint32_t* data_size, nanoseconds timeout = 20ms); | ||
std::shared_ptr<AbstractMessage> createSDOInfoGetOD(uint16_t index, void* data, uint32_t* data_size, | ||
nanoseconds timeout = 20ms); | ||
std::shared_ptr<AbstractMessage> createSDOInfoGetED(uint16_t index, uint8_t subindex, | ||
CoE::SDO::information::ValueInfo value_info, | ||
void* data, uint32_t* data_size, nanoseconds timeout = 20ms); | ||
|
||
// helper to get next message to send and transfer it to reception callbacks if required | ||
std::shared_ptr<AbstractMessage> send(); | ||
|
||
|
@@ -142,6 +150,26 @@ namespace kickcat | |
uint32_t* client_data_size_; | ||
}; | ||
|
||
class SDOInfoMessage : public AbstractMessage | ||
{ | ||
public: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indentation |
||
SDOInfoMessage(uint16_t mailbox_size, uint8_t request, void* data, uint32_t* data_size, uint32_t request_payload_size, nanoseconds timeout); | ||
virtual ~SDOInfoMessage() = default; | ||
|
||
ProcessingResult process(uint8_t const* received) override; | ||
|
||
protected: | ||
ProcessingResult processSDOInfoResponse(mailbox::Header const* header, CoE::ServiceDataInfo const* sdo, | ||
uint8_t const* payload, uint8_t expected_opcode); | ||
|
||
CoE::Header* coe_; | ||
CoE::ServiceDataInfo* sdo_; | ||
uint8_t* payload_; | ||
uint8_t* client_data_; | ||
uint32_t* client_data_size_; | ||
uint32_t already_received_size_{0}; | ||
}; | ||
|
||
class EmergencyMessage : public AbstractMessage | ||
{ | ||
public: | ||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy/paste error?