-
Notifications
You must be signed in to change notification settings - Fork 1
Configure ada_hardware
for Articulable Fork
#53
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
Draft
jjaime2
wants to merge
28
commits into
jjaime2/articulable_fork_description
Choose a base branch
from
jjaime2/dynamixel_hw_interface
base: jjaime2/articulable_fork_description
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.
Draft
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
78bf8d1
Add hardware interface for Dynamixels
jjaime2 65a3f6b
Merge branch 'jjaime2/articulable_fork_description' into jjaime2/dyna…
jjaime2 04c11b2
Remove lingering comments
jjaime2 1987de5
Add WIP unit test for Dynamixel hardware interface
jjaime2 9b17991
Rename hardware interface Dynamixel to DynamixelHardware to match imp…
jjaime2 6a7a651
Merge branch 'jjaime2/articulable_fork_description' into jjaime2/dyna…
jjaime2 f25ed9d
Rename port to usb_port
jjaime2 ff042fa
Fix merge
jjaime2 97fc98a
Fix parameter definitions for usb_port and baud_rate, rename joints
jjaime2 51b0fd7
Adjust line spacing
jjaime2 68087b0
Fix mis-named joint to af_joint_2
jjaime2 c0072fc
Rename ada_hardware::DynamixelHardware to dynamixel_hardware::Dynamix…
jjaime2 440b1d2
Fix mis-named namespace
jjaime2 652aad9
Merge branch 'jjaime2/articulable_fork_description' into jjaime2/dyna…
jjaime2 cc90416
Formatting
jjaime2 2c3f00c
Add end_effector_tool configuration for ada_hardware.launch.py
jjaime2 01c6fbe
Merge branch 'jjaime2/articulable_fork_description' into jjaime2/dyna…
jjaime2 c7a815f
Use updated ada macro
jjaime2 765ff3f
Merge branch 'jjaime2/articulable_fork_description' into jjaime2/dyna…
jjaime2 a25f7aa
Run pre-commit
jjaime2 aed616d
Fix typo in dynamixel_hardware.hpp
jjaime2 50c8018
Merge branch 'main' into jjaime2/dynamixel_hw_interface
jjaime2 1a4063c
Merge branch 'jjaime2/articulable_fork_description' into jjaime2/dyna…
jjaime2 a489417
Merge branch 'jjaime2/articulable_fork_description' into jjaime2/dyna…
jjaime2 ccddde6
Remove redundant list of arguments
jjaime2 d7ec40d
Remove base_parent argument when instantiating ada macro
jjaime2 47f5845
Merge branch 'jjaime2/articulable_fork_description' into jjaime2/dyna…
jjaime2 beae1a0
Change default end_effector_tool to fork in ada_hardware.launch.py
jjaime2 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 hidden or 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 hidden or 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 hidden or 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
112 changes: 112 additions & 0 deletions
112
ada_hardware/include/ada_hardware/dynamixel_hardware.hpp
This file contains hidden or 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,112 @@ | ||
// Copyright 2020 Yutaka Kondo <[email protected]> | ||
// | ||
// 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. | ||
|
||
#ifndef DYNAMIXEL_HARDWARE__DYNAMIXEL_HARDWARE_HPP_ | ||
#define DYNAMIXEL_HARDWARE__DYNAMIXEL_HARDWARE_HPP_ | ||
|
||
#include <dynamixel_workbench_toolbox/dynamixel_workbench.h> | ||
|
||
#include <map> | ||
#include <vector> | ||
|
||
#include <hardware_interface/handle.hpp> | ||
#include <hardware_interface/hardware_info.hpp> | ||
#include <hardware_interface/system_interface.hpp> | ||
#include <rclcpp_lifecycle/state.hpp> | ||
|
||
#include "ada_hardware/visiblity_control.h" | ||
#include "rclcpp/macros.hpp" | ||
|
||
using hardware_interface::CallbackReturn; | ||
using hardware_interface::return_type; | ||
|
||
namespace dynamixel_hardware { | ||
struct JointValue { | ||
double position{0.0}; | ||
double velocity{0.0}; | ||
double effort{0.0}; | ||
}; | ||
|
||
struct Joint { | ||
JointValue state{}; | ||
JointValue command{}; | ||
JointValue prev_command{}; | ||
}; | ||
|
||
enum class ControlMode { | ||
Position, | ||
Velocity, | ||
Torque, | ||
Current, | ||
ExtendedPosition, | ||
MultiTurn, | ||
CurrentBasedPosition, | ||
PWM, | ||
}; | ||
|
||
class DynamixelHardware : public hardware_interface::SystemInterface { | ||
public: | ||
RCLCPP_SHARED_PTR_DEFINITIONS(DynamixelHardware) | ||
|
||
DYNAMIXEL_HARDWARE_PUBLIC | ||
CallbackReturn on_init(const hardware_interface::HardwareInfo &info) override; | ||
|
||
DYNAMIXEL_HARDWARE_PUBLIC | ||
std::vector<hardware_interface::StateInterface> | ||
export_state_interfaces() override; | ||
|
||
DYNAMIXEL_HARDWARE_PUBLIC | ||
std::vector<hardware_interface::CommandInterface> | ||
export_command_interfaces() override; | ||
|
||
DYNAMIXEL_HARDWARE_PUBLIC | ||
CallbackReturn | ||
on_activate(const rclcpp_lifecycle::State &previous_state) override; | ||
|
||
DYNAMIXEL_HARDWARE_PUBLIC | ||
CallbackReturn | ||
on_deactivate(const rclcpp_lifecycle::State &previous_state) override; | ||
|
||
DYNAMIXEL_HARDWARE_PUBLIC | ||
return_type read(const rclcpp::Time &time, | ||
const rclcpp::Duration &period) override; | ||
|
||
DYNAMIXEL_HARDWARE_PUBLIC | ||
return_type write(const rclcpp::Time &time, | ||
const rclcpp::Duration &period) override; | ||
|
||
private: | ||
return_type enable_torque(const bool enabled); | ||
|
||
return_type set_control_mode(const ControlMode &mode, | ||
const bool force_set = false); | ||
|
||
return_type reset_command(); | ||
|
||
CallbackReturn set_joint_positions(); | ||
CallbackReturn set_joint_velocities(); | ||
CallbackReturn set_joint_params(); | ||
|
||
DynamixelWorkbench dynamixel_workbench_; | ||
std::map<const char *const, const ControlItem *> control_items_; | ||
std::vector<Joint> joints_; | ||
std::vector<uint8_t> joint_ids_; | ||
bool torque_enabled_{false}; | ||
ControlMode control_mode_{ControlMode::Position}; | ||
bool mode_changed_{false}; | ||
bool use_dummy_{false}; | ||
}; | ||
} // namespace dynamixel_hardware | ||
|
||
#endif // DYNAMIXEL_HARDWARE__DYNAMIXEL_HARDWARE_HPP_ |
This file contains hidden or 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,56 @@ | ||
// Copyright 2020 Yutaka Kondo <[email protected]> | ||
// | ||
// 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. | ||
|
||
/* This header must be included by all rclcpp headers which declare symbols | ||
* which are defined in the rclcpp library. When not building the rclcpp | ||
* library, i.e. when using the headers in other package's code, the contents | ||
* of this header change the visibility of certain symbols which the rclcpp | ||
* library cannot have, but the consuming code must have inorder to link. | ||
*/ | ||
|
||
#ifndef DYNAMIXEL_HARDWARE__VISIBLITY_CONTROL_H_ | ||
#define DYNAMIXEL_HARDWARE__VISIBLITY_CONTROL_H_ | ||
|
||
// This logic was borrowed (then namespaced) from the examples on the gcc wiki: | ||
// https://gcc.gnu.org/wiki/Visibility | ||
|
||
#if defined _WIN32 || defined __CYGWIN__ | ||
#ifdef __GNUC__ | ||
#define DYNAMIXEL_HARDWARE_EXPORT __attribute__((dllexport)) | ||
#define DYNAMIXEL_HARDWARE_IMPORT __attribute__((dllimport)) | ||
#else | ||
#define DYNAMIXEL_HARDWARE_EXPORT __declspec(dllexport) | ||
#define DYNAMIXEL_HARDWARE_IMPORT __declspec(dllimport) | ||
#endif | ||
#ifdef DYNAMIXEL_HARDWARE_BUILDING_DLL | ||
#define DYNAMIXEL_HARDWARE_PUBLIC DYNAMIXEL_HARDWARE_EXPORT | ||
#else | ||
#define DYNAMIXEL_HARDWARE_PUBLIC DYNAMIXEL_HARDWARE_IMPORT | ||
#endif | ||
#define DYNAMIXEL_HARDWARE_PUBLIC_TYPE DYNAMIXEL_HARDWARE_PUBLIC | ||
#define DYNAMIXEL_HARDWARE_LOCAL | ||
#else | ||
#define DYNAMIXEL_HARDWARE_EXPORT __attribute__((visibility("default"))) | ||
#define DYNAMIXEL_HARDWARE_IMPORT | ||
#if __GNUC__ >= 4 | ||
#define DYNAMIXEL_HARDWARE_PUBLIC __attribute__((visibility("default"))) | ||
#define DYNAMIXEL_HARDWARE_LOCAL __attribute__((visibility("hidden"))) | ||
#else | ||
#define DYNAMIXEL_HARDWARE_PUBLIC | ||
#define DYNAMIXEL_HARDWARE_LOCAL | ||
#endif | ||
#define DYNAMIXEL_HARDWARE_PUBLIC_TYPE | ||
#endif | ||
|
||
#endif // DYNAMIXEL_HARDWARE__VISIBLITY_CONTROL_H_ |
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
<package format="3"> | ||
<name>ada_hardware</name> | ||
<version>0.0.1</version> | ||
<version>0.0.2</version> | ||
<description>ROS Hardware Interface for ADA</description> | ||
<maintainer email="[email protected]">Ethan K. Gordon</maintainer> | ||
<license>BSD-3-Clause</license> | ||
|
@@ -12,8 +12,10 @@ | |
<depend>rclcpp</depend> | ||
<depend>rclcpp_lifecycle</depend> | ||
<depend>pluginlib</depend> | ||
<depend>lifecycle_msgs</depend> | ||
<depend>hardware_interface</depend> | ||
<depend>sensor_msgs</depend> | ||
<depend>dynamixel_workbench_toolbox</depend> | ||
|
||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>ament_cmake_copyright</test_depend> | ||
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.