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

Chassis follow mode and hardware support for DJI and MI motors #6

Merged
merged 24 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9dc2478
Implement Gimbal Only and Chassis Follow mode for omni wheel controller
nice-mee Jul 26, 2024
f18ac69
Add ros_gz dependency to metav_gazebo
nice-mee Jul 27, 2024
1a2e0c4
Add ros2_control depedency
nice-mee Jul 27, 2024
774872e
Add joint_state_broadcaster to dependency
nice-mee Jul 27, 2024
8c88fb8
Create hardware interface template
nice-mee Jul 27, 2024
5459e67
Implement unified launch file for simulation and actual hardware, and…
nice-mee Jul 27, 2024
9b83433
Implement DJI motor driver and hardware_interface
nice-mee Jul 28, 2024
2478814
Remove .gitignore dependency
nice-mee Jul 28, 2024
bec6b5b
Add libsockcanpp to .gitmodules
nice-mee Jul 28, 2024
1fd10b6
Remove pid_controller
nice-mee Jul 28, 2024
40995e3
Fix launch issue
nice-mee Jul 28, 2024
a8afb7f
Overall performance improvement to hardware control and support for M…
nice-mee Jul 29, 2024
178144b
Better formatting of gimbal_controller
nice-mee Jul 29, 2024
4d202e3
Implement angle accumulation in motor position feedback
nice-mee Jul 29, 2024
403e908
Rename chassis controller package
nice-mee Jul 30, 2024
be74904
Refactor of motor networks and support for MI motors
nice-mee Jul 30, 2024
6453e8e
Remove redundant methods and fix DJI motor
nice-mee Jul 30, 2024
47d8d0f
Revise hardware startup logic
nice-mee Jul 30, 2024
bc072dc
Fix MI motor network issues and move initialization of motor networks…
nice-mee Jul 31, 2024
61c9485
Rename dependency
nice-mee Jul 31, 2024
33a39e7
Add shutdown protection to DJI motors so that they don't shutdown too…
nice-mee Jul 31, 2024
0c9f2b4
Upgrade cmake in ros-humble.yml
nice-mee Jul 31, 2024
6cf251c
Rollback dji_motor.h
nice-mee Jul 31, 2024
e9d64aa
Merge branch 'summer2024' of github.com:Meta-Team/Meta-ROS into summe…
nice-mee Jul 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ros-humble.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Upgrade cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.23.x'
- name: Ignore scara_moveit
run: touch decomposition/scara_moveit/AMENT_IGNORE
- name: Install dependencies
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
[submodule "decomposition/wheel_leg_rl"]
path = decomposition/wheel_leg_rl
url = https://github.com/Yao-Xinchen/Meta-WL
[submodule "execution/metav_hardware/libsockcanpp"]
path = execution/metav_hardware/libsockcanpp
url = https://github.com/SimonCahill/libsockcanpp.git
Original file line number Diff line number Diff line change
Expand Up @@ -30,95 +30,92 @@ static constexpr size_t STATE_MY_ITFS = 0;
static constexpr size_t CMD_MY_ITFS = 0;

enum class gimbal_role : std::uint8_t {
PITCH = 0,
YAW = 1,
PITCH = 0,
YAW = 1,
};

class GimbalController
: public controller_interface::ChainableControllerInterface {
public:
GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
GimbalController();

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::CallbackReturn on_init() override;

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::InterfaceConfiguration
command_interface_configuration() const override;

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::InterfaceConfiguration
state_interface_configuration() const override;

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::CallbackReturn
on_configure(const rclcpp_lifecycle::State &previous_state) override;

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::CallbackReturn
on_activate(const rclcpp_lifecycle::State &previous_state) override;

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::CallbackReturn
on_deactivate(const rclcpp_lifecycle::State &previous_state) override;

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::return_type
update_reference_from_subscribers() override;

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::return_type
update_and_write_commands(const rclcpp::Time &time,
const rclcpp::Duration &period) override;

using ControllerFeedbackMsg = sensor_msgs::msg::Imu;
using ControllerReferenceMsg = behavior_interface::msg::Aim;
using ControllerModeSrvType = std_srvs::srv::SetBool;
using ControllerStateMsg = control_msgs::msg::MultiDOFStateStamped;

protected:
std::shared_ptr<gimbal_controller::ParamListener> param_listener_;
gimbal_controller::Params params_;

std::vector<std::string> state_joints_;

// Command subscribers
rclcpp::Duration ref_timeout_ = rclcpp::Duration(0, 0);
rclcpp::Subscription<ControllerReferenceMsg>::SharedPtr
ref_subscriber_ = nullptr;
realtime_tools::RealtimeBuffer<std::shared_ptr<ControllerReferenceMsg>>
input_ref_;

// Feedback subscribers
rclcpp::Subscription<ControllerFeedbackMsg>::SharedPtr feedback_subscriber_ =
nullptr;
realtime_tools::RealtimeBuffer<std::shared_ptr<ControllerFeedbackMsg>>
input_feedback_;

std::vector<std::shared_ptr<control_toolbox::PidROS>> pos2vel_pids_;
std::vector<std::shared_ptr<control_toolbox::PidROS>> vel2eff_pids_;

using ControllerStatePublisher =
realtime_tools::RealtimePublisher<ControllerStateMsg>;

rclcpp::Publisher<ControllerStateMsg>::SharedPtr s_publisher_;
std::unique_ptr<ControllerStatePublisher> state_publisher_;

// override methods from ChainableControllerInterface
std::vector<hardware_interface::CommandInterface>
on_export_reference_interfaces() override;

bool on_set_chained_mode(bool chained_mode) override;

std::vector<gimbal_role> gimbal_roles_;

private:
// callback for topic interface
GIMBAL_CONTROLLER__VISIBILITY_LOCAL
void reference_callback(
const std::shared_ptr<ControllerReferenceMsg> msg);
void feedback_callback(const std::shared_ptr<ControllerFeedbackMsg> msg);
public:
GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
GimbalController();

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::CallbackReturn on_init() override;

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::InterfaceConfiguration
command_interface_configuration() const override;

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::InterfaceConfiguration
state_interface_configuration() const override;

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::CallbackReturn
on_configure(const rclcpp_lifecycle::State &previous_state) override;

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::CallbackReturn
on_activate(const rclcpp_lifecycle::State &previous_state) override;

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::CallbackReturn
on_deactivate(const rclcpp_lifecycle::State &previous_state) override;

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::return_type
update_reference_from_subscribers() override;

GIMBAL_CONTROLLER__VISIBILITY_PUBLIC
controller_interface::return_type
update_and_write_commands(const rclcpp::Time &time,
const rclcpp::Duration &period) override;

using ControllerFeedbackMsg = sensor_msgs::msg::Imu;
using ControllerReferenceMsg = behavior_interface::msg::Aim;
using ControllerModeSrvType = std_srvs::srv::SetBool;
using ControllerStateMsg = control_msgs::msg::MultiDOFStateStamped;

protected:
std::shared_ptr<gimbal_controller::ParamListener> param_listener_;
gimbal_controller::Params params_;

// Command subscribers
rclcpp::Duration ref_timeout_ = rclcpp::Duration(0, 0);
rclcpp::Subscription<ControllerReferenceMsg>::SharedPtr ref_subscriber_ =
nullptr;
realtime_tools::RealtimeBuffer<std::shared_ptr<ControllerReferenceMsg>>
input_ref_;

// Feedback subscribers
rclcpp::Subscription<ControllerFeedbackMsg>::SharedPtr
feedback_subscriber_ = nullptr;
realtime_tools::RealtimeBuffer<std::shared_ptr<ControllerFeedbackMsg>>
input_feedback_;

std::vector<std::shared_ptr<control_toolbox::PidROS>> pos2vel_pids_;
std::vector<std::shared_ptr<control_toolbox::PidROS>> vel2eff_pids_;

using ControllerStatePublisher =
realtime_tools::RealtimePublisher<ControllerStateMsg>;

rclcpp::Publisher<ControllerStateMsg>::SharedPtr s_publisher_;
std::unique_ptr<ControllerStatePublisher> state_publisher_;

// override methods from ChainableControllerInterface
std::vector<hardware_interface::CommandInterface>
on_export_reference_interfaces() override;

bool on_set_chained_mode(bool chained_mode) override;

std::vector<gimbal_role> gimbal_roles_;

private:
// callback for topic interface
GIMBAL_CONTROLLER__VISIBILITY_LOCAL
void reference_callback(const std::shared_ptr<ControllerReferenceMsg> msg);
void feedback_callback(const std::shared_ptr<ControllerFeedbackMsg> msg);
};

} // namespace gimbal_controller
Expand Down
Loading