Expose functions for getting number of corrupt packets and total packets in Create class

This commit is contained in:
jacobperron 2016-02-12 18:06:26 -08:00
parent bcd27b788a
commit 9cb3250268
5 changed files with 20 additions and 11 deletions

View file

@ -22,7 +22,6 @@ target_link_libraries(create
## Declare example executables
add_executable(create_demo examples/create_demo.cpp)
add_executable(odom_test examples/odom_test.cpp)
## Specify libraries to link a library or executable target against
target_link_libraries(create_demo
@ -30,13 +29,7 @@ target_link_libraries(create_demo
create
)
target_link_libraries(odom_test
${Boost_LIBRARIES}
create
)
## Install
## I'm not familiar with install rules, do these make sense?
install(TARGETS create DESTINATION lib)
install(FILES
include/create/create.h

View file

@ -357,6 +357,14 @@ namespace create {
/* Get the estimated velocity of Create based on wheel encoders.
*/
const create::Vel& getVel() const;
/* Get the number of corrupt serial packets since first connecting to Create.
*/
uint64_t getNumCorruptPackets() const;
/* Get the total number of serial packets (including corrupt packets) since first connecting to Create.
*/
uint64_t getTotalPackets() const;
}; // end Create class
} // namespace create

View file

@ -97,8 +97,8 @@ namespace create {
inline bool connected() const { return port.is_open(); };
bool send(const uint8_t* bytes, const uint32_t numBytes);
bool sendOpcode(const Opcode& code);
uint64_t getNumCorruptPackets();
uint64_t getNumTotalPackets();
uint64_t getNumCorruptPackets() const;
uint64_t getTotalPackets() const;
};
} // namespace create

View file

@ -505,4 +505,12 @@ namespace create {
return vel;
}
uint64_t Create::getNumCorruptPackets() const {
return serial->getNumCorruptPackets();
}
uint64_t Create::getTotalPackets() const {
return serial->getTotalPackets();
}
} // end namespace

View file

@ -239,11 +239,11 @@ namespace create {
return send(&oc, 1);
}
uint64_t Serial::getNumCorruptPackets() {
uint64_t Serial::getNumCorruptPackets() const {
return corruptPackets;
}
uint64_t Serial::getNumTotalPackets() {
uint64_t Serial::getTotalPackets() const {
return totalPackets;
}
} // namespace create