Skip to content

Commit

Permalink
🔄 synced local 'docs/cheatsheets' with remote 'cheatsheets'
Browse files Browse the repository at this point in the history
  • Loading branch information
HansRobo committed Feb 29, 2024
1 parent a87c80e commit f3a8693
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions docs/cheatsheets/rclcpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ created: 2024-02-29 10:41:27
rclcpp::Parameter get_parameter(const std::string & name) const
```

名前を指定して、パラメータを返す。
名前を指定して、パラメータを返す。
存在しないパラメータに対しては `rclcpp::exceptions::ParameterNotDeclaredException`を送出する。

##### 2
```
bool get_parameter(const std::string & name, rclcpp::Parameter & parameter) const
```

名前を指定して、引数のパラメータ参照に代入する。
存在しないパラメータの場合、falseが返る。
名前を指定して、引数のパラメータ参照に代入する。
存在しないパラメータの場合、falseが返る。

##### 3

Expand All @@ -32,10 +32,10 @@ template<typename ParameterT>
bool get_parameter(const std::string & name, ParameterT & parameter) const
```

2のパラメータ型をテンプレートで指定するバージョン。
名前を指定して、引数の生パラメータ型の参照に代入する。
存在しないパラメータの場合、falseが返る。
テンプレートで指定したパラメータ型と取得しようとしているパラメータの型が異なる場合、`rclcpp::ParameterTypeException`を送出する。
2のパラメータ型をテンプレートで指定するバージョン。
名前を指定して、引数の生パラメータ型の参照に代入する。
存在しないパラメータの場合、falseが返る。
テンプレートで指定したパラメータ型と取得しようとしているパラメータの型が異なる場合、`rclcpp::ParameterTypeException`を送出する。

##### 4
```
Expand All @@ -47,10 +47,10 @@ get_parameter_or(
const ParameterT & alternative_value) const
```

3のラッパーで、3の返り値がfalseのときに3番目の引数を返す。
パラメータが宣言されていないときに自動で宣言してくれるような機能はない。
返り値はROS空間からパラメータを取得できたかどうか(=alternative_valueが使われたときはfalseが返る)
他のget_parameterと違って実装はnode_impl.hppにあるので注意。
3のラッパーで、3の返り値がfalseのときに3番目の引数を返す。
パラメータが宣言されていないときに自動で宣言してくれるような機能はない。
返り値はROS空間からパラメータを取得できたかどうか(=alternative_valueが使われたときはfalseが返る)
他のget_parameterと違って実装はnode_impl.hppにあるので注意。

##### 5

Expand Down

0 comments on commit f3a8693

Please sign in to comment.