forked from srv/avt_vimba_camera
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve rosout logging #50
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f8f401e
Improve configuration rosout, add print_all_features rosparam
icolwell-as 17d6c68
Remove debug_print parameter in favour of ROS_DEBUG API, clean up all…
icolwell-as abd7a99
Improve printing of all features, adjust default stream bytes
icolwell-as e60fea7
Revert change of error type
icolwell-as 4972c25
Remove commented functions
icolwell-as 3db7fe4
Update according to review
icolwell-as File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,7 @@ class AvtVimbaApi { | |
|
||
/** Translates Vimba error codes to readable error messages | ||
* | ||
* @param error Vimba error tyme | ||
* @param error Vimba error type | ||
* @return readable string error | ||
* | ||
**/ | ||
|
@@ -100,6 +100,33 @@ class AvtVimbaApi { | |
return "Unsupported error code passed."; | ||
} | ||
|
||
std::string interfaceToString(VmbInterfaceType interfaceType) { | ||
switch ( interfaceType ) { | ||
case VmbInterfaceFirewire: return "FireWire"; | ||
break; | ||
case VmbInterfaceEthernet: return "GigE"; | ||
break; | ||
case VmbInterfaceUsb: return "USB"; | ||
break; | ||
default: return "Unknown"; | ||
} | ||
} | ||
|
||
std::string accessModeToString(VmbAccessModeType modeType) { | ||
std::string s; | ||
if (modeType & VmbAccessModeFull) | ||
s = std::string("Read and write access"); | ||
else if (modeType & VmbAccessModeRead) | ||
s = std::string("Only read access"); | ||
else if (modeType & VmbAccessModeConfig) | ||
s = std::string("Device configuration access"); | ||
else if (modeType & VmbAccessModeLite) | ||
s = std::string("Device read/write access without feature access (only addresses)"); | ||
else if (modeType & VmbAccessModeNone) | ||
s = std::string("No access"); | ||
return s; | ||
} | ||
|
||
bool frameToImage(const FramePtr vimba_frame_ptr, sensor_msgs::Image& image) { | ||
VmbPixelFormatType pixel_format; | ||
VmbUint32_t width, height, nSize; | ||
|
@@ -171,26 +198,25 @@ class AvtVimbaApi { | |
VimbaSystem& vs; | ||
|
||
void listAvailableCameras(void) { | ||
std::string name; | ||
ROS_INFO("Searching for cameras ..."); | ||
CameraPtrVector cameras; | ||
if (VmbErrorSuccess == vs.Startup()) { | ||
if (VmbErrorSuccess == vs.GetCameras(cameras)) { | ||
for (CameraPtrVector::iterator iter = cameras.begin(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about |
||
cameras.end() != iter; | ||
++iter) { | ||
if (VmbErrorSuccess == (*iter)->GetName(name)) { | ||
ROS_DEBUG_STREAM("[" << ros::this_node::getName() << "]: Found camera: "); | ||
} | ||
std::string strID; // The ID of the cam | ||
std::string strName; // The name of the cam | ||
std::string strModelname; // The model name of the cam | ||
std::string strSerialNumber; // The serial number of the cam | ||
std::string strInterfaceID; // The ID of the interface the cam is connected to | ||
for (CameraPtrVector::iterator iter = cameras.begin(); cameras.end() != iter; ++iter) { | ||
std::string strID; | ||
std::string strName; | ||
std::string strModelname; | ||
std::string strSerialNumber; | ||
std::string strInterfaceID; | ||
VmbInterfaceType interfaceType; | ||
VmbAccessModeType accessType; | ||
|
||
VmbErrorType err = (*iter)->GetID( strID ); | ||
if ( VmbErrorSuccess != err ) | ||
{ | ||
ROS_ERROR_STREAM("[Could not get camera ID. Error code: " << err << "]"); | ||
} | ||
|
||
err = (*iter)->GetName( strName ); | ||
if ( VmbErrorSuccess != err ) | ||
{ | ||
|
@@ -214,12 +240,26 @@ class AvtVimbaApi { | |
{ | ||
ROS_ERROR_STREAM("[Could not get interface ID. Error code: " << err << "]"); | ||
} | ||
ROS_INFO_STREAM("\t/// Camera Name: " << strName); | ||
ROS_INFO_STREAM("\t/// Model Name: " << strModelname); | ||
ROS_INFO_STREAM("\t/// Camera ID: " << strID); | ||
ROS_INFO_STREAM("\t/// Serial Number: " << strSerialNumber); | ||
ROS_INFO_STREAM("\t/// @ Interface ID: " << strInterfaceID); | ||
|
||
err = (*iter)->GetInterfaceType( interfaceType ); | ||
if ( VmbErrorSuccess != err ) | ||
{ | ||
ROS_ERROR_STREAM("[Could not get interface type. Error code: " << err << "]"); | ||
} | ||
|
||
err = (*iter)->GetPermittedAccess( accessType ); | ||
if ( VmbErrorSuccess != err ) | ||
{ | ||
ROS_ERROR_STREAM("[Could not get access type. Error code: " << err << "]"); | ||
} | ||
|
||
ROS_INFO_STREAM("Found camera named " << strName << ":"); | ||
ROS_INFO_STREAM(" - Model Name : " << strModelname); | ||
ROS_INFO_STREAM(" - Camera ID : " << strID); | ||
ROS_INFO_STREAM(" - Serial Number : " << strSerialNumber); | ||
ROS_INFO_STREAM(" - Interface ID : " << strInterfaceID); | ||
ROS_INFO_STREAM(" - Interface type : " << interfaceToString(interfaceType)); | ||
ROS_INFO_STREAM(" - Access type : " << accessModeToString(accessType)); | ||
} | ||
} else { | ||
ROS_WARN("Could not get cameras from Vimba System"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ class AvtVimbaCamera { | |
public: | ||
AvtVimbaCamera(); | ||
AvtVimbaCamera(const std::string& name); | ||
void start(const std::string& ip_str, const std::string& guid_str, const std::string& frame_id, bool debug_prints = true); | ||
void start(const std::string& ip_str, const std::string& guid_str, const std::string& frame_id, bool print_all_features = false); | ||
void stop(); | ||
double getTimestamp(void); | ||
double getTimestampRealTime(VmbUint64_t timestamp_ticks); | ||
|
@@ -128,7 +128,6 @@ class AvtVimbaCamera { | |
bool opened_; | ||
bool streaming_; | ||
bool on_init_; | ||
bool show_debug_prints_; | ||
std::string name_; | ||
|
||
diagnostic_updater::Updater updater_; | ||
|
@@ -142,7 +141,7 @@ class AvtVimbaCamera { | |
std::string trigger_source_; | ||
int trigger_source_int_; | ||
|
||
CameraPtr openCamera(std::string id_str); | ||
CameraPtr openCamera(std::string id_str, bool print_all_features); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. const std::string& |
||
|
||
frameCallbackFunc userFrameCallback; | ||
void frameCallback(const FramePtr vimba_frame_ptr); | ||
|
@@ -151,17 +150,14 @@ class AvtVimbaCamera { | |
} | ||
|
||
template<typename T> | ||
bool setFeatureValue(const std::string& feature_str, const T& val); | ||
template<typename T> | ||
bool setGetFeatureValue(const std::string& feature_str, const T& val_in, T& val_out); | ||
VmbErrorType setFeatureValue(const std::string& feature_str, const T& val); | ||
template<typename Vimba_Type, typename Std_Type> | ||
void configureFeature(const std::string& feature_str, const Vimba_Type& val_in, Std_Type& val_out); | ||
void configureFeature(const std::string& feature_str, const std::string& val_in, std::string& val_out); | ||
template<typename T> | ||
bool getFeatureValue(const std::string& feature_str, T& val); | ||
bool getFeatureValue(const std::string& feature_str, std::string& val); | ||
bool runCommand(const std::string& command_str); | ||
std::string interfaceToString(VmbInterfaceType interfaceType); | ||
std::string accessModeToString(VmbAccessModeType modeType); | ||
int getTriggerModeInt(std::string mode_str); | ||
void printAllCameraFeatures(const CameraPtr& camera); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
return \"Read and write access\"
so it matchesinterfaceToString
function?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! this function was just moved from another file, I'll improve it though.