This repository has been archived by the owner on May 6, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Class ICS3 Reference
Doi Yusuke edited this page Oct 24, 2016
·
25 revisions
The interface class of ICS3 communication.
- ICS3(const std::string& path, const Baudrate& baudrate = RATE115200())
This constructor setup device for ICS3 communication.
- param:
- path: Path of serial device.
- baudrate: Baud rate of serial communication.
- throw:
- std::invalid_argument: Fail path. ex) Non tty device.
- std::runtime_error: Fail setup task. ex) Not exist device or fail set termios.
ics::ICS3 ics3 {"/dev/ttyUSB0", ics::Baudrate::RATE115200()};
After sample have ics3
instance without declaration. that mean ICS3 instance.
- Angle move(const ID& id, Angle angle) const
- Angle free(const ID& id, Angle unit = Angle::newRadian())
Move a motor to angle. Return now angle of it.
- param:
- id: id of a servo motor.
- angle: Want position.
- return: Now angle. angle unit is the same(param:angle).
- throw: std::runtime_error: Communication error.
constexpr ics::ID servoId {0};
ics::Angle target {ics::Angle::newDegree(20)};
ics::Angle nowPos {ics3.move(servoId, target)}; // servo(id:0) move to 20°,
// return degree before moving.
The motor get free torque, Return now angle of it.
- param:
- id: id of a servo motor.
- unit: Unit of return angle.
- return: Now angle. angle unit is the same(param:unit)
- throw: std::runtime_error: Communication error.
constexpr ics::ID servoID {0};
ics::Angle newPos {ics3.free(servoId, ics::Angle::newDegree())};
// servo(id:0) get free torque, return degree before moving.