Skip to content

Commit

Permalink
adds the third argument to read_power of iob.h
Browse files Browse the repository at this point in the history
  • Loading branch information
fkanehiro committed Apr 18, 2015
1 parent 4bc5fe5 commit 47cf360
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/io/iob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,10 +562,11 @@ int number_of_substeps()
return 5;
}

int read_power(double *voltage, double *current)
int read_power(double *voltage, double *current, double *battery)

This comment has been minimized.

Copy link
@k-okada

k-okada Apr 19, 2015

Contributor

今のtravisではiob.hの変更はエラーに成るようにしています.どうしましょうか.
https://travis-ci.org/fkanehiro/hrpsys-base/jobs/59085347

理由はhrpIo.so など自分たちで作れない環境に有る人が( @130s も含めて),
古いiob.hでコンパイルされたhrpIo.so と新しいiob.hでコンパイルされた他のプログラムから
利用できない,というようなものだったかと思います.

This comment has been minimized.

Copy link
@k-okada

k-okada Apr 19, 2015

Contributor

read_battery()みたいに足すならOKとする(iobをいじれない利用者は自分たちでread_battery()とセットする)
という感じか,コンパイル時に-DIOB_VERSION_2するとbatteryがつかえるようにするとか,
どちらかというかんじでしょうか.

ところで,travisでチェックしているcprotoというプログラム12.04と14.04で挙動が違いますね.14だと何も出力しません.
https://launchpad.net/ubuntu/+source/cproto/4.7j-3/+build/2851088
から,debを撮ってきたら動くから,ソースが違うんですかね.

https://launchpad.net/ubuntu/+source/cproto

This comment has been minimized.

Copy link
@fkanehiro

fkanehiro via email Apr 20, 2015

Author Owner

This comment has been minimized.

Copy link
@k-okada

k-okada Apr 20, 2015

Contributor

#590
に解決策を書きました.
https://github.com/start-jsk/rtmros_gazebo/tree/master/hrpsys_gazebo_general/iob
からも悲鳴があがっているみたいですが,このPRでもダメですかね.
一応,コメントは入れておきましたが....
k-okada@01b72a2#diff-b30cc06105f07d38ed353b57449d72c4R586

This comment has been minimized.

Copy link
@fkanehiro

fkanehiro via email Apr 20, 2015

Author Owner

This comment has been minimized.

Copy link
@k-okada

k-okada Apr 21, 2015

Contributor

XX2以外のだとXXEx以外に思いつかないですね.MSっぽいですが,どうでしょうか.

This comment has been minimized.

Copy link
@garaemon

garaemon Apr 21, 2015

Contributor

Error on downstream
start-jsk/rtmros_gazebo#183

This comment has been minimized.

Copy link
@fkanehiro

fkanehiro via email Apr 21, 2015

Author Owner

This comment has been minimized.

Copy link
@k-okada

k-okada Apr 21, 2015

Contributor

了解です.
https://travis-ci.org/k-okada/hrpsys-base/builds/59338158
でテストプログラムを作っているので,マージはチョット待っていて下さい

{
*voltage = ((double)random()-RAND_MAX/2)/(RAND_MAX/2)*1+48;
*current = ((double)random()-RAND_MAX/2)/(RAND_MAX/2)*0.5+1;
*battery = ((double)random()-RAND_MAX/2)/(RAND_MAX/2)*0.5+50;
return TRUE;
}

Expand Down
3 changes: 2 additions & 1 deletion lib/io/iob.h
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,10 @@ extern "C"{
* @brief read status of power source
* @param v voltage[V]
* @param a current[A]
* @param b remaining battery level[%]
* @return TRUE or FALSE
*/
int read_power(double *v, double *a);
int read_power(double *v, double *a, double *b);
//@}

/**
Expand Down
2 changes: 1 addition & 1 deletion rtc/RobotHardware/RobotHardwareService_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void RobotHardwareService_impl::getStatus(OpenHRP::RobotHardwareService::RobotSt
m_robot->readForceSensor(i, rs->force[i].get_buffer());
}

m_robot->readPowerStatus(rs->voltage, rs->current);
m_robot->readPowerStatus(rs->voltage, rs->current, rs->battery);
}

CORBA::Boolean RobotHardwareService_impl::power(const char* jname, OpenHRP::RobotHardwareService::SwitchStatus ss)
Expand Down
4 changes: 2 additions & 2 deletions rtc/RobotHardware/robot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,9 +459,9 @@ void robot::writeVelocityCommands(const double *i_commands)
write_command_velocities(i_commands);
}

void robot::readPowerStatus(double &o_voltage, double &o_current)
void robot::readPowerStatus(double &o_voltage, double &o_current, double &o_battery)
{
read_power(&o_voltage, &o_current);
read_power(&o_voltage, &o_current, &o_battery);
}

int robot::readCalibState(int i)
Expand Down
3 changes: 2 additions & 1 deletion rtc/RobotHardware/robot.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ class robot : public hrp::Body
\brief read voltage and current of the robot power source
\param o_voltage voltage
\param o_current current
\param o_battery remaining battery level
*/
void readPowerStatus(double &o_voltage, double &o_current);
void readPowerStatus(double &o_voltage, double &o_current, double &o_battery);

/**
\brief read array of all joint angles[rad]
Expand Down

0 comments on commit 47cf360

Please sign in to comment.