Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
13 changes: 12 additions & 1 deletion src/arm_hardware_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,21 @@ include_directories(
${arm_control_INCLUDE_DIRS}
)

include(FetchContent)
FetchContent_Declare(
moteus
GIT_REPOSITORY https://github.com/mjbots/moteus.git
GIT_TAG aa96bf0ae847921a79d2d3d241d65505ee10e209)

FetchContent_MakeAvailable(moteus)

add_library(${PROJECT_NAME} src/armprotocol.cpp include/arm_hardware_interface/ArmSerialProtocol.h)

add_executable(arm_serial_driver src/ArmSerialInterface.cpp include/ArmSerialInterface.h include/arm_hardware_interface/ArmSerialProtocol.h)
# For old and new arm
# add_executable(arm_serial_driver src/ArmSerialInterface.cpp include/ArmSerialInterface.h include/arm_hardware_interface/ArmSerialProtocol.h)
Copy link
Contributor

Choose a reason for hiding this comment

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

i like the idea of using the same class/header, but we should be able to compile both binaries so we don't need to edit a cmake file if we want to run the new arm vs the old arm

Copy link
Contributor

Choose a reason for hiding this comment

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

so yeah try to add both targets, maybe moteus_arm_driver and serial_arm_driver

add_executable(arm_serial_driver src/MoteusInterface.cpp include/ArmSerialInterface.h include/arm_hardware_interface/ArmSerialProtocol.h)

target_link_libraries(arm_serial_driver moteus::cpp)
ament_target_dependencies(arm_serial_driver rclcpp sensor_msgs serial rover_msgs arm_control)

if(BUILD_TESTING)
Expand Down
7 changes: 7 additions & 0 deletions src/arm_hardware_interface/include/ArmSerialInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <thread>
#include <chrono>

#include "moteus.h"
#include <arm_hardware_interface/ArmSerialProtocol.h>


Expand All @@ -26,6 +27,7 @@
#define AXIS_6_DIR 1

using std::string;
using namespace mjbots;

class ArmSerial : public rclcpp::Node {
public:
Expand All @@ -52,6 +54,11 @@ class ArmSerial : public rclcpp::Node {
serial::Timeout timeout_uart = serial::Timeout::simpleTimeout(1000); // E.g., 1000 ms or 1 second


std::map<int, std::shared_ptr<moteus::Controller>> controllers;
Copy link
Contributor

Choose a reason for hiding this comment

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

should moteus stuff be in the serial driver? i thought serial driver was purely for old arm

std::map<int, moteus::Query::Result> servo_data;
std::shared_ptr<moteus::Transport> transport;
bool send_angles = true;

struct Axis{
float curr_pos;
float target_pos;
Expand Down
Loading