Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Class ICS3 Reference

Doi Yusuke edited this page Oct 24, 2016 · 25 revisions

class ICS3

The interface class of ICS3 communication.

constructor

  • ICS3(const std::string& path, const Baudrate& baudrate = RATE115200())

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.

Usage

ics::ICS3 ics("/dev/ttyUSB0", ics::Baudrate::RATE115200());

After sample have ics instance without declaration. that mean ICS3 instance.

methods

  • Angle move(const ID& id, Angle angle) const
  • Angle free(const ID& id, Angle unit = Angle::newRadian())

Angle move(const ID& id, Angle angle) const

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.

Usage

constexpr ics::ID servoId {0};
ics::Angle target = Angle::newDegree(20);
ics::Angle nowPos = ics.move(servoId, target); // servo(id:0) move to 20°,
                                               // return now degree before moving.

Angle free(const ID& id, Angle unit = Angle::newRadian())

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.

Usage

constexpr ics::ID servoID {0};
ics::Angle newPos = ics.free(servoId, ics::Angle::newDegree());
// servo(id:0) get free torque, return now degree before moving.
Clone this wiki locally