Connects to the Dynamixel motors. NOTE: This should be called after all DynamixelClients on the same process are created.
(self)
| 140 | return self.port_handler.is_open |
| 141 | |
| 142 | def connect(self): |
| 143 | """Connects to the Dynamixel motors. |
| 144 | |
| 145 | NOTE: This should be called after all DynamixelClients on the same |
| 146 | process are created. |
| 147 | """ |
| 148 | assert not self.is_connected, 'Client is already connected.' |
| 149 | |
| 150 | if self.port_handler.openPort(): |
| 151 | logging.info('Succeeded to open port: %s', self.port_name) |
| 152 | else: |
| 153 | raise OSError( |
| 154 | ('Failed to open port at {} (Check that the device is powered ' |
| 155 | 'on and connected to your computer).').format(self.port_name)) |
| 156 | |
| 157 | if self.port_handler.setBaudRate(self.baudrate): |
| 158 | logging.info('Succeeded to set baudrate to %d', self.baudrate) |
| 159 | else: |
| 160 | raise OSError( |
| 161 | ('Failed to set the baudrate to {} (Ensure that the device was ' |
| 162 | 'configured for this baudrate).').format(self.baudrate)) |
| 163 | |
| 164 | # Start with all motors enabled. NO, I want to set settings before enabled |
| 165 | #self.set_torque_enabled(self.motor_ids, True) |
| 166 | |
| 167 | def disconnect(self): |
| 168 | """Disconnects from the Dynamixel device.""" |
no outgoing calls
no test coverage detected