9 #define EXPECTED_MOTOR_ID 268435504
80 motorControlId.
read();
82 std::cerr <<
"Read check failed: Module ID is expected to be 0x" << std::hex <<
EXPECTED_MOTOR_ID
83 <<
", but it is 0x" << (uint32_t)motorControlId <<
"!" << std::endl;
88 maximumAcceleration = 2000;
89 maximumAcceleration.write();
91 maximumVelocity = 2000;
92 maximumVelocity.write();
101 maximumAccelerationReadBack.read();
102 if(maximumAcceleration != maximumAccelerationReadBack) {
103 std::cerr <<
"Write check failed: Maximum acceleration is expected to be " << maximumAcceleration <<
", but it is "
104 << maximumAccelerationReadBack <<
"!" << std::endl;
109 maximumAcceleration.read();
110 maximumVelocity.read();
114 std::cout <<
"maximumAcceleration = " << maximumAcceleration << std::endl;
115 std::cout <<
"maximumVelocity = " << maximumVelocity << std::endl;
116 std::cout <<
"baseVelocity = " << baseVelocity << std::endl;
117 std::cout <<
"pulseWidth = " << pulseWidth << std::endl;
123 resetMotorPosition = 1;
124 resetMotorPosition.write();
125 resetMotorPosition = 0;
126 resetMotorPosition.write();
128 motorDestination = 0;
129 motorDestination.write();
131 motorPosition.
read();
132 std::cout <<
"Motor at position " << motorPosition << std::endl;
134 for(
size_t i = 0; i < 10; i++) {
136 motorDestination += 5000;
137 motorDestination.
write();
138 std::cout << std::endl <<
"Target position is " << motorDestination << std::endl;
147 motorPosition.
read();
148 std::cout <<
"Motor at position " << motorPosition << std::endl;