by keukpa » Tue Oct 25, 2011 4:53 pm
by keukpa
Tue Oct 25, 2011 4:53 pm
thank you, here is my program. This is residing in the /util directory and I use make to build it.
#include "rcb4.h"
#include <unistd>
KondoInstance ki;
int main(int argc, char *argv[])
{
// cmd line arguments ----------------------------
if (argc < 2) {
fprintf(stderr, "Usage: zero_pos position\n");
exit(1);
}
// open ------------------------------------------
int ret = kondo_init(&ki);
if (ret < 0) {
printf("%s", ki.error);
exit(-1);
}
ki.debug = 1;
// servo set (ALL)
unsigned char servos[] = { ~0, ~0, ~0, ~0, ~0 };
unsigned int command = 32767;
//send the command
ret = kondo_send_ics_pos(&ki, servos, command);
if (ret < 0) {
printf("%s", ki.error);
exit(-1);
}
unsigned int command1 = atoi(argv[1]);
ret = kondo_send_ics_pos(&ki, servos, command1);
if (ret < 0) {
printf("%s", ki.error);
exit(-1);
}
// close -----------------------------------------
ret = kondo_close(&ki);
if (ret < 0) {
printf("%s", ki.error);
exit(-1);
}
return 0;
}
thank you, here is my program. This is residing in the /util directory and I use make to build it.
#include "rcb4.h"
#include <unistd>
KondoInstance ki;
int main(int argc, char *argv[])
{
// cmd line arguments ----------------------------
if (argc < 2) {
fprintf(stderr, "Usage: zero_pos position\n");
exit(1);
}
// open ------------------------------------------
int ret = kondo_init(&ki);
if (ret < 0) {
printf("%s", ki.error);
exit(-1);
}
ki.debug = 1;
// servo set (ALL)
unsigned char servos[] = { ~0, ~0, ~0, ~0, ~0 };
unsigned int command = 32767;
//send the command
ret = kondo_send_ics_pos(&ki, servos, command);
if (ret < 0) {
printf("%s", ki.error);
exit(-1);
}
unsigned int command1 = atoi(argv[1]);
ret = kondo_send_ics_pos(&ki, servos, command1);
if (ret < 0) {
printf("%s", ki.error);
exit(-1);
}
// close -----------------------------------------
ret = kondo_close(&ki);
if (ret < 0) {
printf("%s", ki.error);
exit(-1);
}
return 0;
}