7 #include "PlusConfigure.h" 12 : mPrintStream(ISI_FALSE)
14 , mManipIndex(ISI_PSM2)
15 , mStatus(ISI_SUCCESS)
37 status = isi_start_stream(
mRateHz);
38 if (status != ISI_SUCCESS)
40 LOG_ERROR(
"Unable to start streaming.");
47 LOG_ERROR(
"Not connected. Cannot start streaming.");
70 LOG_WARNING(
"IntuitiveDaVinci::connect failed to connect with arguments");
84 LOG_ERROR(
"disconnect: not connected.");
105 LOG_WARNING(
"IntuitiveDaVinci::subscribe failed to start stream. Disconnecting from da Vinci");
115 mStatus = isi_subscribe_all_stream_fields();
124 mStatus = isi_set_stream_callback(sCB, userData);
135 mStatus = isi_subscribe_all_events();
145 mStatus = isi_set_event_callback(eCB, userData);
155 std::vector<std::string> names;
157 for (
int i = 0;
i != ISI_NUM_MANIPS;
i++)
159 ISI_MANIP_INDEX index = (ISI_MANIP_INDEX)
i;
160 std::string name = isi_get_manip_name(index);
162 if (name.size() == 0) {
continue; }
164 names.push_back(name);
173 ISI_STREAM_FIELD stream_data;
175 isi_get_stream_field(
mManipIndex, ISI_TIP_TRANSFORM, &stream_data);
183 if (in == NULL || out == NULL) {
return; }
185 out->pos.x = in->pos.x;
186 out->pos.y = in->pos.y;
187 out->pos.z = in->pos.z;
189 out->rot.row0 = in->rot.row0;
190 out->rot.row1 = in->rot.row1;
191 out->rot.row2 = in->rot.row2;
197 LOG_INFO(
"Position: " << T->pos.x <<
" " << T->pos.y <<
" " << T->pos.z);
198 LOG_INFO(
"X Axis Rotation: " << T->rot.row0.x <<
" " << T->rot.row1.x <<
" " << T->rot.row2.x);
199 LOG_INFO(
"Y Axis Rotation: " << T->rot.row0.y <<
" " << T->rot.row1.y <<
" " << T->rot.row2.y);
200 LOG_INFO(
"Z Axis Rotation: " << T->rot.row0.z <<
" " << T->rot.row1.z <<
" " << T->rot.row2.z);
206 static const char help[] = {
"\ 225 ISI_SYSTEM_CONFIG config;
227 status = isi_get_system_config(&config);
229 if (status != ISI_SUCCESS)
234 return config.library_version;
246 ISI_STREAM_FIELD stream_data;
249 LOG_INFO(
"Retrieving stream state for manipulator: " << isi_get_manip_name(manipIndex));
251 LOG_INFO(
"\nISI_TIP_TRANSFORM: \n");
252 isi_get_stream_field(manipIndex, ISI_TIP_TRANSFORM, &stream_data);
255 LOG_INFO(
"\nISI_JOINT_VALUES: \n");
257 isi_get_stream_field(manipIndex, ISI_JOINT_VALUES, &stream_data);
258 for (
i = 0;
i != stream_data.count;
i++)
260 LOG_INFO(
" " << stream_data.data[
i]);
263 LOG_INFO(
"\n ISI Timestamp (seconds): " << stream_data.timestamp);
270 ISI_SYSTEM_CONFIG config;
272 status = isi_get_system_config(&config);
274 if (status == ISI_SUCCESS)
276 LOG_INFO(
"System Name: " << config.system_name);
277 LOG_INFO(
"System Version: " << config.system_version);
278 LOG_INFO(
"Library Version: " << config.library_version);
282 LOG_WARNING(
"Failed to get IntuitiveDaVinci system configuration");
ISI_MANIP_INDEX mManipIndex
void setHostInfo(const std::string ip, const unsigned int port, const std::string pass)
void printTransform(const ISI_TRANSFORM *T)
ISI_STATUS setEventCallback(ISI_EVENT_CALLBACK eCB, void *userData)
void getPosition(ISI_TRANSFORM *T)
void setPassword(const std::string password)
std::vector< std::string > getManipulatorNames()
void copyTransform(ISI_TRANSFORM *in, ISI_TRANSFORM *out)
ISI_STATUS subscribe(ISI_EVENT_CALLBACK eCB, ISI_STREAM_CALLBACK sCB, void *eventUserData, void *streamUserData)
const char int const char * password
void setPort(const unsigned int port)
ISI_STATUS setStreamCallback(ISI_STREAM_CALLBACK sCB, void *userData)
void setIpAddr(const std::string ip)
void printStreamState(ISI_MANIP_INDEX manipIndex)
std::string getLibraryVersion()