6 #ifndef UMRT_ARM_FIRMWARE_LIB_ARDUINO_STEPPER_CONTROLLER_HPP
7 #define UMRT_ARM_FIRMWARE_LIB_ARDUINO_STEPPER_CONTROLLER_HPP
9 #include <boost/signals2.hpp>
10 #include <openFrameworksArduino/StdAfx.h>
11 #include <openFrameworksArduino/ofArduino.h>
47 bool setSpeed(
const uint8_t motor,
const int16_t speed);
69 bool sendStep(
const uint8_t motor,
const uint16_t num_steps,
const int16_t speed);
80 bool seekPosition(
const uint8_t motor,
const int32_t position,
const int16_t speed);
103 [[nodiscard]]
bool isSetup()
const;
113 boost::signals2::signal<void(
void)>
ESetup;
125 boost::signals2::signal<void(uint8_t, int16_t)>
ESetSpeed;
131 boost::signals2::signal<void(uint8_t, int16_t)>
EGetSpeed;
137 boost::signals2::signal<void(uint8_t, uint16_t, int16_t)>
ESendStep;
207 bool setup_completed;
Manages the Firmata connection to an Arduino running the Stepper Controller program.
Definition: arduino_stepper_controller.hpp:18
bool seekPosition(const uint8_t motor, const int32_t position, const int16_t speed)
Sends a SysexCommands::SEEK_POS command to move a motor to specific step position.
Definition: arduino_stepper_controller.cpp:83
bool getSpeed(const uint8_t motor)
Sends a SysexCommands::GET_SPEED command to query the speed of a motor.
Definition: arduino_stepper_controller.cpp:62
~ArduinoStepperController() noexcept override
Destroys an ArduinoStepperController.
Definition: arduino_stepper_controller.cpp:26
bool isSetup() const
Returns whether the connection to the stepper controller Arduino has been fully established.
Definition: arduino_stepper_controller.cpp:112
bool setSpeed(const uint8_t motor, const int16_t speed)
Sends a SysexCommands::SET_SPEED command to set the speed of a motor.
Definition: arduino_stepper_controller.cpp:50
boost::signals2::signal< void(uint8_t, int32_t, int16_t)> ESeekPosition
Boost signal triggered when seekPosition responses are received.
Definition: arduino_stepper_controller.hpp:143
bool getPosition(const uint8_t motor)
Sends a SysexCommands::GET_POS command to query the current position of a motor.
Definition: arduino_stepper_controller.cpp:96
void handleSysex(const std::vector< unsigned char > &message)
Handles System-Exclusive (Sysex) messages received on the Firmata link with the Stepper Controller Ar...
Definition: arduino_stepper_controller.cpp:175
bool setGripper(const uint8_t position)
Sends a SysexCommands::SET_GRIPPER command to set the target position of the gripper servo.
Definition: arduino_stepper_controller.cpp:104
bool sendStep(const uint8_t motor, const uint16_t num_steps, const int16_t speed)
Sends a SysexCommands::SEND_STEP command to move a motor a fixed number of steps.
Definition: arduino_stepper_controller.cpp:70
boost::signals2::signal< void(uint8_t, uint16_t, int16_t)> ESendStep
Boost signal triggered when sendStep responses are received.
Definition: arduino_stepper_controller.hpp:137
boost::signals2::connection connectionInitialized
Boost signal triggered when the initial Firmata connection is established.
Definition: arduino_stepper_controller.hpp:162
boost::signals2::signal< void(uint8_t)> ESetGripper
Boost signal triggered when setGripper responses are received.
Definition: arduino_stepper_controller.hpp:155
boost::signals2::signal< void(void)> ESetup
Boost signal triggered once this ArduinoStepperController is fully setup.
Definition: arduino_stepper_controller.hpp:113
boost::signals2::signal< void(uint8_t, int32_t)> EGetPosition
Boost signal triggered when getPosition responses are received.
Definition: arduino_stepper_controller.hpp:149
boost::signals2::signal< void(std::vector< uint8_t >)> EArduinoEcho
Boost signal triggered when sendEcho responses are received.
Definition: arduino_stepper_controller.hpp:119
void setupArduino(const int &version)
Completes configuration of the Stepper Controller Arduino once a Firmata link has been established.
Definition: arduino_stepper_controller.cpp:30
boost::signals2::signal< void(uint8_t, int16_t)> EGetSpeed
Boost signal triggered when getSpeed responses are received.
Definition: arduino_stepper_controller.hpp:131
bool sendEcho(const std::vector< uint8_t > &payload)
Sends a SysexCommands::ARDUINO_ECHO command with the provided payload.
Definition: arduino_stepper_controller.cpp:42
ArduinoStepperController()
Initializes an ArduinoStepperController.
Definition: arduino_stepper_controller.cpp:14
boost::signals2::signal< void(uint8_t, int16_t)> ESetSpeed
Boost signal triggered when setSpeed responses are received.
Definition: arduino_stepper_controller.hpp:125