1 #ifndef SEED_COMMAND_H_ 2 #define SEED_COMMAND_H_ 4 #include <boost/asio.hpp> 5 #include <boost/thread.hpp> 7 #include <unordered_map> 21 bool openPort(std::string _port,
unsigned int _baud_rate);
23 void writeBuffer(std::vector<char>& _send_data);
24 std::string readBuffer(uint16_t _wait_time=0);
27 void readBufferAsync(std::string _delim, uint16_t _timeout=50);
28 void onReceive(
const boost::system::error_code& _error,
size_t _bytes_transferred);
29 void can_receive(std::vector<uint8_t>& _receive_data);
31 void onTimer(
const boost::system::error_code& _error);
54 bool openPort(std::string _port,
unsigned int _baud_rate);
58 void writeSerialCommand(uint8_t _id, uint8_t *_data);
59 void writeSerialCommand(uint8_t _id, uint8_t _line, uint8_t *_data);
60 bool readSerialCommand(std::vector<uint8_t>& _receive_data, uint16_t _timeout=50);
68 int str2int(std::string _data);
71 void setTypeNumber(uint8_t _id,
const char* _type);
72 void setEditorVersion(uint8_t _id,
const char* _ver);
73 void setMotorCurrentParam(uint8_t _id, uint16_t _driver_max, uint16_t _motor_max, uint8_t _current_conversion);
74 void setDummy(uint8_t _id, uint8_t _cmd);
75 void setSerialVersion(uint8_t _id,
const char* _ver);
76 void setMotorAdaptation(uint8_t _id, uint32_t _type, uint16_t _volt);
77 void setCurrentInstantaneous(uint8_t _id, uint16_t _max, uint16_t _time);
78 void setFirmwareVersion(uint8_t _id,
const char* _ver);
79 void setMotorParam(uint8_t _id, uint8_t _mode, uint8_t _feedback);
80 void setEncoderParam(uint8_t _id, uint16_t _encoder_pulse, uint16_t _motor_pulse);
83 void setIdParam(uint8_t _id, uint8_t _re_id);
84 void setEmergencyParam(uint8_t _id, uint8_t _mode, uint8_t _io_no, uint8_t _io, uint8_t _reset);
85 void setStopModeParam(uint8_t _id, uint8_t _motor, uint8_t _script);
86 void setOperationParam(uint8_t _id, uint8_t _auto_run, uint8_t _script, uint8_t _point_go, uint8_t _motor, uint8_t _io);
87 void setOvertravelParam(uint8_t _id, uint8_t _mode, uint8_t _minus, uint8_t _plus, uint8_t _io);
88 void setErrorMotionParam(uint8_t _id, uint8_t _temperature, uint8_t _motor, uint8_t _ot, uint8_t _voltage);
89 void setResponseParam(uint8_t _id, uint8_t _mode);
90 void setDioParam(uint8_t _id, uint8_t _io0, uint8_t _io1, uint8_t _io2, uint8_t _io3);
91 void setAdParam(uint8_t _id, uint8_t _ad0, uint8_t _ad1, uint8_t _ad2, uint8_t _ad3);
94 void setMotorCurrent(uint8_t _id, uint16_t _max, uint8_t _min, uint16_t _min_time);
95 void setMotorMaxSpeed(uint8_t _id, uint16_t _speed);
96 void setMotorControlParameter1(uint8_t _id, uint8_t _back_surge_a, uint8_t _back_surge_b, uint8_t _back_surge_c, uint8_t _oc, uint8_t _fst);
97 void setMotorControlParameter1(uint8_t _id, uint16_t _i_gain, uint8_t _d_gain, uint8_t _switch);
98 void setInPosition(uint8_t _id, uint16_t _value);
99 void setAcDecelerationRate(uint8_t _id, uint16_t _acc, uint16_t _dec);
100 void setMotorControlParameter2(uint8_t _id, uint16_t _initial_speed, uint16_t _p_gain, uint8_t _correcting_gain);
101 void setUpperSoftwareLimit(uint8_t _id, int32_t _limit);
102 void setLowerSoftwareLimit(uint8_t _id, int32_t _limit);
103 void setMotorRotation(uint8_t _id, uint8_t _pulse_division, uint8_t _encoder_division, uint8_t _motor_inverted, uint8_t _encoder_inverted, uint8_t _dc_inverted);
104 void setMotorError(uint8_t _id, uint16_t _time, uint32_t _pulse);
105 void setMotorErrorLimit(uint8_t _id, uint8_t _temerature , uint8_t _minimum_voltage, uint8_t _maximum_voltage, uint8_t _current);
108 void setScriptData(uint8_t _id, uint8_t _number , uint8_t _start_line, uint8_t _end_line);
109 void writeScriptLine(uint8_t _id, uint8_t _line ,
const char* _command);
112 bool getLockCode(uint8_t _id, uint8_t _mode);
113 void setReleaseLock(uint8_t _id, uint8_t _type, uint16_t _code);
114 std::vector<uint8_t> getConnectedId();
115 void writeRom(uint8_t _id, uint8_t type);
116 int io2int(std::string _parameter);
119 std::array<int, 3> getPosition(uint8_t _id);
120 std::array<int, 3> getCurrent(uint8_t _id);
121 std::array<int, 6> getOperationalInfo(uint8_t _id);
123 void onServo(uint8_t _id, uint8_t _state);
124 void stopMotor(uint8_t _id);
125 void runScript(uint8_t _id, uint8_t _script_no);
126 void waitForScriptEnd(
int _number);
127 void actuateRelativePositionByTime(uint8_t _id, int16_t _time, int32_t _position);
128 void actuateRelativePositionBySpeed(uint8_t _id, int16_t _speed, int32_t _position);
129 void actuateAbsolutePositionByTime(uint8_t _id, uint16_t _time, int32_t _position);
130 void actuateAbsolutePositionBySpeed(uint8_t _id, int16_t _speed, int32_t _position);
131 void actuateContinuousRelativePosition(uint8_t _id, uint16_t _time, int32_t _position);
132 void actuateContinuousAbsolutePosition(uint8_t _id, uint16_t _time, int32_t _position);
133 void actuateBySpeed(uint8_t _id, int16_t _speed);
135 void setPosition(uint8_t _id, uint8_t _position, uint8_t _state);
SerialCommunication serial_com_
std::string receive_buffer_
boost::asio::streambuf stream_buffer_
std::unordered_map< std::string, int32_t > operational_info_
std::vector< uint8_t > connected_id_
std::vector< uint8_t > send_data_
std::unordered_map< std::string, int16_t > lock_code_info_
std::unordered_map< std::string, int32_t > seed_info_