UnityFibonacciActionSever.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 UnityFibonacciActionSever : MonoBehaviour
  19. {
  20. private RosConnector rosConnector;
  21. private FibonacciActionServer fibonacciActionServer;
  22. public string actionName;
  23. public string status;
  24. public string feedback;
  25. private void Start()
  26. {
  27. rosConnector = GetComponent<RosConnector>();
  28. fibonacciActionServer = new FibonacciActionServer(actionName, rosConnector.RosSocket, new Log(x => Debug.Log(x)));
  29. fibonacciActionServer.Initialize();
  30. }
  31. private void Update()
  32. {
  33. fibonacciActionServer.PublishStatus();
  34. status = fibonacciActionServer.GetStatus().ToString();
  35. feedback = fibonacciActionServer.GetFeedbackSequenceString();
  36. }
  37. }
  38. }