UnityFibonacciActionClient.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. © Siemens AG, 2019
  3. Author: Berkay Alp Cakal (berkay_alp.cakal.ct@siemens.com)
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. <http://www.apache.org/licenses/LICENSE-2.0>.
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. */
  14. using UnityEngine;
  15. namespace RosSharp.RosBridgeClient.Actionlib
  16. {
  17. [RequireComponent(typeof(RosConnector))]
  18. public class UnityFibonacciActionClient : MonoBehaviour
  19. {
  20. private RosConnector rosConnector;
  21. public FibonacciActionClient fibonacciActionClient;
  22. public string actionName;
  23. public int fibonacciOrder = 20;
  24. public string status = "";
  25. public string feedback = "";
  26. public string result = "";
  27. private void Start()
  28. {
  29. rosConnector = GetComponent<RosConnector>();
  30. fibonacciActionClient = new FibonacciActionClient(actionName, rosConnector.RosSocket);
  31. fibonacciActionClient.Initialize();
  32. }
  33. private void Update()
  34. {
  35. status = fibonacciActionClient.GetStatusString();
  36. feedback = fibonacciActionClient.GetFeedbackString();
  37. result = fibonacciActionClient.GetResultString();
  38. }
  39. public void RegisterGoal()
  40. {
  41. fibonacciActionClient.fibonacciOrder = fibonacciOrder;
  42. }
  43. }
  44. }