You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

dummy_inference.py 5.2 kB

10 months ago
10 months ago
10 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. """TODO: Add docstring."""
  2. from dora import Node
  3. node = Node()
  4. import numpy as np
  5. pred = np.array(
  6. [
  7. [
  8. [
  9. -0.0737,
  10. -0.0447,
  11. 0.2695,
  12. -0.0054,
  13. -0.0461,
  14. -0.0258,
  15. 0.1357,
  16. 0.1943,
  17. 0.0625,
  18. 0.1270,
  19. -0.0259,
  20. -0.0195,
  21. 0.0981,
  22. 0.1021,
  23. ],
  24. [
  25. -0.0757,
  26. -0.0332,
  27. 0.2793,
  28. -0.0156,
  29. -0.0374,
  30. -0.0193,
  31. 0.1924,
  32. 0.2119,
  33. 0.0654,
  34. 0.1377,
  35. 0.0020,
  36. -0.0076,
  37. 0.0884,
  38. 0.1143,
  39. ],
  40. [
  41. -0.0771,
  42. -0.0282,
  43. 0.2832,
  44. -0.0225,
  45. -0.0378,
  46. -0.0156,
  47. 0.1992,
  48. 0.2324,
  49. 0.0674,
  50. 0.1416,
  51. 0.0088,
  52. -0.0056,
  53. 0.0918,
  54. 0.1191,
  55. ],
  56. [
  57. -0.0825,
  58. -0.0325,
  59. 0.2832,
  60. -0.0210,
  61. -0.0420,
  62. -0.0204,
  63. 0.1904,
  64. 0.2256,
  65. 0.0610,
  66. 0.1475,
  67. 0.0068,
  68. -0.0071,
  69. 0.0879,
  70. 0.1172,
  71. ],
  72. [
  73. -0.0825,
  74. -0.0344,
  75. 0.2852,
  76. -0.0208,
  77. -0.0405,
  78. -0.0167,
  79. 0.1777,
  80. 0.2109,
  81. 0.0518,
  82. 0.1621,
  83. 0.0059,
  84. -0.0017,
  85. 0.0854,
  86. 0.1182,
  87. ],
  88. [
  89. -0.0840,
  90. -0.0332,
  91. 0.2871,
  92. -0.0226,
  93. -0.0417,
  94. -0.0159,
  95. 0.1748,
  96. 0.2080,
  97. 0.0476,
  98. 0.1641,
  99. 0.0000,
  100. 0.0010,
  101. 0.0864,
  102. 0.1196,
  103. ],
  104. [
  105. -0.0879,
  106. -0.0234,
  107. 0.2969,
  108. -0.0305,
  109. -0.0396,
  110. -0.0132,
  111. 0.1904,
  112. 0.2275,
  113. 0.0474,
  114. 0.1758,
  115. 0.0137,
  116. 0.0020,
  117. 0.0874,
  118. 0.1245,
  119. ],
  120. [
  121. -0.0884,
  122. -0.0225,
  123. 0.3008,
  124. -0.0339,
  125. -0.0386,
  126. -0.0118,
  127. 0.1904,
  128. 0.2275,
  129. 0.0469,
  130. 0.1855,
  131. 0.0186,
  132. -0.0017,
  133. 0.0879,
  134. 0.1270,
  135. ],
  136. [
  137. -0.0918,
  138. -0.0081,
  139. 0.3066,
  140. -0.0449,
  141. -0.0325,
  142. -0.0074,
  143. 0.2021,
  144. 0.2363,
  145. 0.0454,
  146. 0.1953,
  147. 0.0332,
  148. 0.0015,
  149. 0.0942,
  150. 0.1348,
  151. ],
  152. [
  153. -0.0938,
  154. -0.0249,
  155. 0.3027,
  156. -0.0366,
  157. -0.0396,
  158. -0.0125,
  159. 0.1777,
  160. 0.2207,
  161. 0.0376,
  162. 0.1953,
  163. 0.0146,
  164. -0.0017,
  165. 0.0884,
  166. 0.1279,
  167. ],
  168. [
  169. -0.0938,
  170. -0.0229,
  171. 0.3047,
  172. -0.0393,
  173. -0.0386,
  174. -0.0121,
  175. 0.1680,
  176. 0.2256,
  177. 0.0330,
  178. 0.2002,
  179. 0.0127,
  180. 0.0015,
  181. 0.0913,
  182. 0.1260,
  183. ],
  184. [
  185. -0.0977,
  186. -0.0206,
  187. 0.3105,
  188. -0.0405,
  189. -0.0359,
  190. -0.0161,
  191. 0.1680,
  192. 0.2178,
  193. 0.0295,
  194. 0.2129,
  195. 0.0146,
  196. -0.0085,
  197. 0.0923,
  198. 0.1309,
  199. ],
  200. [
  201. -0.0938,
  202. -0.0311,
  203. 0.3027,
  204. -0.0334,
  205. -0.0386,
  206. -0.0188,
  207. 0.1377,
  208. 0.2139,
  209. 0.0227,
  210. 0.2031,
  211. 0.0039,
  212. -0.0020,
  213. 0.0913,
  214. 0.1221,
  215. ],
  216. ],
  217. ],
  218. )
  219. import time
  220. import pyarrow as pa
  221. data = pred[0]
  222. for joint in data:
  223. node.send_output("jointstate_left", pa.array(joint[:7], type=pa.float32()))
  224. node.send_output("jointstate_right", pa.array(joint[7:], type=pa.float32()))
  225. time.sleep(0.1)