Skip to content
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

Add beep trylock, print PDgain, print time in EC debug #1060

Merged
merged 3 commits into from
Oct 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ec/hrpEC/hrpEC-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ namespace RTC
#ifndef OPENRTM_VERSION_TRUNK
if (loop % debug_count == 0 && ENABLE_DEBUG_PRINT) {
gettimeofday(&debug_tv4, NULL);
fprintf(stderr, "[hrpEC] Processing time breakdown : waitForNextPeriod %f[ms], warker (onExecute) %f[ms], ExecutionProfile %f[ms], time from prev cicle %f[ms]\n",
fprintf(stderr, "[hrpEC] [%d.%6.6d] Processing time breakdown : waitForNextPeriod %f[ms], warker (onExecute) %f[ms], ExecutionProfile %f[ms], time from prev cicle %f[ms]\n",
tv.tv_sec, tv.tv_usec,
DELTA_SEC(debug_tv1, debug_tv2)*1e3,
DELTA_SEC(debug_tv2, debug_tv3)*1e3,
DELTA_SEC(debug_tv3, debug_tv4)*1e3,
Expand Down
11 changes: 7 additions & 4 deletions rtc/Beeper/Beeper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,13 @@ RTC::ReturnCode_t Beeper::onExecute(RTC::UniqueId ec_id)
bd._beep_length = m_beepCommand.data[BEEP_INFO_LENGTH];
// Push beepCommand to buffer
size_t max_buffer_length = 10;
pthread_mutex_lock( &beep_mutex );
beep_command_buffer.push_back(bd);
while (beep_command_buffer.size() > max_buffer_length) beep_command_buffer.pop_front();
pthread_mutex_unlock( &beep_mutex );
if (pthread_mutex_trylock( &beep_mutex ) == 0) {
beep_command_buffer.push_back(bd);
while (beep_command_buffer.size() > max_buffer_length) beep_command_buffer.pop_front();
pthread_mutex_unlock( &beep_mutex );
} else {
std::cerr << "[" << m_profile.instance_name<< "] Mutex trylock failed (loop=" << m_loop << ")" << std::endl;
}
// print
if (m_debugLevel > 0) {
if (bd._beep_start)
Expand Down
4 changes: 4 additions & 0 deletions rtc/RobotHardware/robot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ bool robot::loadGain()
strm >> default_dgain[i];
}
strm.close();
// Print loaded gain
std::cerr << "[RobotHardware] loadGain" << std::endl;
for (unsigned int i=0; i<numJoints(); i++) { std::cerr << "[RobotHardware] " << joint(i)->name << ", pgain = " << default_pgain[i] << ", dgain = " << default_dgain[i] << std::endl;
}
return true;
}

Expand Down