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

[RobotHardware] add OutPort for gain #1295

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Naoki-Hiraoka
Copy link
Contributor

RobotHardwareにpgain dgain torquePgain torqueDgain というOutPortを新たに作成し、現在の関節ゲインの値を出力するようにすることで、他のrtcが関節ゲインの値にアクセスできるようにしました。


int robot::readTorquePgain(int i, double &o_torquepgain)
{
#if defined(ROBOT_IOB_VERSION) && ROBOT_IOB_VERSION >= 4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ヘッダファイルと共に #ifマクロの外に関数宣言と定義を書いた方がコンパイルすら通らないのでそちらの方がより安全ということはないだろうか?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#ifマクロ による分岐箇所が可能な限り少ない方が可読性が高く保守もしやすいと考え、robot.cppのiobの関数を直接呼ぶ部分でのみ#ifマクロ を使う形にしました。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すみません 遅くなりました
確かに可読性が高い方がいいかもしれませんね
それでいいと思います

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants