ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Sorry, have to recommend rosserial. I recommend we focus on the problem you have with it. I use a variant of your motor in a 4wd wild thumper, so short answer: Yes it is possible.
I'm not yet sure where exactly your problem is, seems to be that there are multiple, we should identify these and solve each in its own question. You should start with sending cmd_vel to your arduino, send raw pwm values first instead of m/s, e.g.
rostopic pub -1 cmd_vel geometry_msgs/Twist '[255, 0, 0]' '[0, 0, 0.0]'
for max speed forward. Write this value in the OCR register of your arduino.
To give a short answer for reading the encoders: They use gray code, so use something like this code to decode it. Page is in german, but the relevant source code (ISR) is commented in english, so there should not be any problem.
2 | No.2 Revision |
Sorry, have to recommend rosserial. I recommend we focus on the problem you have with it. I use a variant of your motor in a 4wd wild thumper, so short answer: Yes it is possible.
I'm not yet sure where exactly your problem is, seems to be me that there are multiple, we should identify these and solve each in its own question. You should start with sending cmd_vel to your arduino, send raw pwm values first instead of m/s, e.g.
rostopic pub -1 cmd_vel geometry_msgs/Twist '[255, 0, 0]' '[0, 0, 0.0]'
for max speed forward. Write this value in the OCR register of your arduino.
To give a short answer for reading the encoders: They use gray code, so use something like this code to decode it. Page is in german, but the relevant source code (ISR) is commented in english, so there should not be any problem.
3 | No.3 Revision |
Sorry, have to recommend rosserial. I recommend we focus on the problem you have with it. I use a variant of your motor in a 4wd wild thumper, so short answer: Yes it is possible.
I'm not yet sure where exactly your problem is, seems to me that there are multiple, we should identify these and solve each in its own question. You should start with sending cmd_vel to your arduino, send raw pwm values first instead of m/s, e.g.
rostopic pub -1 cmd_vel geometry_msgs/Twist '[255, 0, 0]' '[0, 0, 0.0]'
for max speed forward. Write this value in the OCR register of your arduino.
To give a short answer for reading the encoders: They use gray code, so use something like this code to decode it. Page is in german, but the relevant source code (ISR) is commented in english, so there should not be any problem.it:
static int8_t last;
int8_t new, diff;
unsigned char status = (PINA >> 4) & 0x3;
new = 0;
if(status & 0x1)
new = 3;
if(status & 0x2)
new ^= 1; // convert gray to binary
diff = last - new; // difference last - new
if( diff & 1 ){ // bit 0 = value (1)
last = new; // store new as next last
enc_delta += (diff & 2) - 1; // bit 1 = direction (+/-)
}