-
Notifications
You must be signed in to change notification settings - Fork 462
Add unit testing to robot hardware #109
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
Changes from 9 commits
4f0e844
bfb3b20
14771a0
c96b257
5f78e12
5c47656
b09755d
fdb6354
ca06e6b
13c6a53
4614ce8
32fc92e
c561815
7e4aa2a
30476af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,21 +39,19 @@ class JointCommandHandle | |
| * \param cmd A pointer to the storage for this joint's command | ||
| */ | ||
| HARDWARE_INTERFACE_PUBLIC | ||
| JointCommandHandle( | ||
| const std::string & name, | ||
| double * cmd); | ||
| JointCommandHandle(const std::string & name, double * cmd); | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| const std::string & | ||
| get_name() const; | ||
| const std::string & get_name() const; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| double | ||
| get_cmd() const; | ||
| double get_cmd() const; | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| void | ||
| set_cmd(double cmd); | ||
| void set_cmd(double cmd); | ||
|
|
||
| HARDWARE_INTERFACE_PUBLIC | ||
| bool valid_pointers() const; | ||
|
Contributor
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. that function name should be more precise.
Contributor
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. also, the function states
Member
Author
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. I have the same function implemented in all the other handles and I call this from the template function so they should all be called the same. TBH a proper solution would see inheriting such an interface to really ensure this function existing the same way for all |
||
|
|
||
| private: | ||
| std::string name_; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,38 +21,39 @@ | |
|
|
||
| namespace hardware_interface | ||
| { | ||
|
|
||
| JointCommandHandle::JointCommandHandle() | ||
| : name_(), | ||
| cmd_(nullptr) | ||
| {} | ||
|
Comment on lines
-26
to
-28
Contributor
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. why these changes? They seem unrelated |
||
| : name_(), cmd_(nullptr) | ||
| { | ||
| } | ||
|
|
||
| JointCommandHandle::JointCommandHandle( | ||
| const std::string & name, | ||
| double * cmd) | ||
|
bmagyar marked this conversation as resolved.
|
||
| JointCommandHandle::JointCommandHandle(const std::string & name, double * cmd) | ||
| : name_(name), cmd_(cmd) | ||
| { | ||
| THROW_ON_NULLPTR(cmd) | ||
| } | ||
|
|
||
| const std::string & | ||
| JointCommandHandle::get_name() const | ||
| const std::string & JointCommandHandle::get_name() const | ||
| { | ||
| return name_; | ||
| } | ||
|
|
||
| double | ||
| JointCommandHandle::get_cmd() const | ||
| double JointCommandHandle::get_cmd() const | ||
| { | ||
| THROW_ON_NULLPTR(cmd_) | ||
|
bmagyar marked this conversation as resolved.
|
||
|
|
||
| return *cmd_; | ||
| } | ||
|
|
||
| void | ||
| JointCommandHandle::set_cmd(double cmd) | ||
| void JointCommandHandle::set_cmd(double cmd) | ||
| { | ||
| THROW_ON_NULLPTR(cmd_) | ||
|
|
||
| * cmd_ = cmd; | ||
| } | ||
|
|
||
| bool JointCommandHandle::valid_pointers() const | ||
| { | ||
| return cmd_; | ||
| } | ||
|
|
||
| } // namespace hardware_interface | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,18 +21,13 @@ | |
|
|
||
| namespace hardware_interface | ||
| { | ||
|
|
||
| JointStateHandle::JointStateHandle() | ||
| : name_(), | ||
| pos_(nullptr), | ||
| vel_(nullptr), | ||
| eff_(nullptr) | ||
| {} | ||
|
Comment on lines
-26
to
-30
Contributor
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. why these changes? They seem unrelated
Member
Author
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. I really don't know, as I put in the opening post,
Sure, I'll revert 'em |
||
| : name_(), pos_(nullptr), vel_(nullptr), eff_(nullptr) | ||
| { | ||
| } | ||
|
|
||
| JointStateHandle::JointStateHandle( | ||
| const std::string & name, | ||
| const double * pos, | ||
| const double * vel, | ||
| const std::string & name, const double * pos, const double * vel, | ||
|
bmagyar marked this conversation as resolved.
Outdated
|
||
| const double * eff) | ||
| : name_(name), pos_(pos), vel_(vel), eff_(eff) | ||
| { | ||
|
|
@@ -41,33 +36,35 @@ JointStateHandle::JointStateHandle( | |
| THROW_ON_NULLPTR(eff) | ||
| } | ||
|
|
||
| const std::string & | ||
| JointStateHandle::get_name() const | ||
| const std::string & JointStateHandle::get_name() const | ||
| { | ||
| return name_; | ||
| } | ||
|
|
||
| double | ||
| JointStateHandle::get_position() const | ||
| double JointStateHandle::get_position() const | ||
| { | ||
| THROW_ON_NULLPTR(pos_) | ||
|
|
||
| return *pos_; | ||
| } | ||
|
|
||
| double | ||
| JointStateHandle::get_velocity() const | ||
| double JointStateHandle::get_velocity() const | ||
| { | ||
| THROW_ON_NULLPTR(vel_) | ||
|
|
||
| return *vel_; | ||
| } | ||
|
|
||
| double | ||
| JointStateHandle::get_effort() const | ||
| double JointStateHandle::get_effort() const | ||
| { | ||
| THROW_ON_NULLPTR(eff_) | ||
|
|
||
| return *eff_; | ||
| } | ||
|
|
||
| bool JointStateHandle::valid_pointers() const | ||
| { | ||
| return pos_ && vel_ && eff_; | ||
| } | ||
|
|
||
| } // namespace hardware_interface | ||
Uh oh!
There was an error while loading. Please reload this page.