Skip to content
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
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

WIP: Sdo info support #93

wants to merge 6 commits into from

Conversation

Rdk-T
Copy link
Collaborator

@Rdk-T Rdk-T commented Apr 24, 2023

close #90

Example of output on an elmo gold motor driver:

Object dictionnary list: size: 212
index 1001 
index 1002 
index 1003 
index 1008 
...
index 605b 
index 605c 
index 605d 
index 605e 
index 6060 
index 6061 
index 6062 
index 6063 
index 6064 
index 6065 
index 6066 
index 6067 
index 6068 
index 6069 
index 606a 
index 606b 
index 606c 
index 606d 
index 606e 
index 606f 
index 6070 
index 6071 
index 6072 
index 6073 
index 6074 
index 6075 
index 6076 
index 6077 
index 6078 
index 6079 
index 607a 
index 607b 
index 607c 
index 607d 
index 607e 
index 607f 
index 6080 
index 6081 
index 6082 
index 6083 
index 6084 
index 6085 
index 6086 
index 6087 
index 608f 
index 6090 
index 6091 
index 6092 
index 6096 
index 6097 
index 6098 
index 6099 
index 609a 
index 60b0 
index 60b1 
index 60b2 
index 60b8 
index 60b9 
index 60ba 
index 60bb 
index 60bc 
index 60bd 
index 60c2 
index 60c5 
index 60c6 
index 60e3 
index 60f2 
index 60f4 
index 60fa 
index 60fc 
index 60fd 
index 60fe 
index 60ff 
index 6502 

 Received entry desc: Entry Description 
  index:         0x607f
  subindex:      0x0
  value info:    1 
  data type:     0x7 - Unsigned32
  bit length:    32
  object access: R pre op; R safe op; R op; W pre op; W safe op; W op;
  raw data:      Max profile velocity 

@github-actions
Copy link

File Coverage Lines Branches
All files 69% 79% 59%
include/kickcat/Bus.h 50% 83% 17%
include/kickcat/DebugHelpers.h 83% 100% 66%
include/kickcat/Gateway.h 75% 100% 50%
include/kickcat/Link.h 92% 85% 100%
include/kickcat/Mailbox.h 89% 92% 85%
include/kickcat/protocol.h 90% 90% 0%
src/Bus.cc 91% 92% 90%
src/CoE.cc 35% 47% 23%
src/Link.cc 96% 99% 94%
src/Mailbox.cc 61% 64% 57%
src/Prints.cc 93% 93% 93%
src/Slave.cc 78% 76% 80%
src/Time.cc 40% 40% 0%
src/protocol.cc 43% 52% 34%

Minimum allowed coverage is 75%

Generated by 🐒 cobertura-action against efbe925

@@ -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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy/paste error?

// unit_test.prefix = 0x03;
// bus.getUnitDescription(ingenia, unit_test);

std::abort();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

such violence 🤣

@@ -142,6 +150,26 @@ namespace kickcat
uint32_t* client_data_size_;
};

class SDOInfoMessage : public AbstractMessage
{
public:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation

@@ -76,4 +80,87 @@ namespace kickcat
auto sdo = slave.mailbox.createSDO(index, subindex, CA, CoE::SDO::request::DOWNLOAD, data, &data_size, timeout);
waitForMessage(sdo);
}


void Bus::getObjectDictionnaryList(Slave& slave, CoE::SDO::information::ListType type, void* data, uint32_t* data_size, nanoseconds timeout)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of print here: to move in a dedicated example

}

int32_t size = header->len - sizeof(CoE::ServiceDataInfo) - sizeof(CoE::Header);

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line feed


std::string CoE::SDO::information::toString(ObjectAccess object_access)
{
std::stringstream os;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since only string are manipulated, you can work directly on a std::string

@leducp
Copy link
Owner

leducp commented Apr 24, 2023

Need a bit of cleanup. Almost ready to be merged.

}

uint32_t request_payload_size = sizeof(type);
memcpy(data, &type, request_payload_size);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer to call memcpy with std namespace

THROW_ERROR("This mailbox is inactive");
}

memcpy(data, &index, sizeof(index));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe create dedicated pointer to copy to to have a meaningful location.


if(remaining_size < size)
{
status_ = MessageStatus::COE_CLIENT_BUFFER_TOO_SMALL;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can set it once at the end when the status OK is computed.

@leducp leducp changed the title Sdo info support WIP: Sdo info support Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support SDO information service
2 participants