echo /joint_states has the following output (shortened).
I made a node (using the rospy tutorial) to subscribe to /joint_states and I want the.py script to print() just the position list for use outside ROS, not the whole topic.
How can I extract only that one line from the topic?
Any help appreciated!
---
header:
seq: 1734
stamp:
secs: 26
nsecs: 47000000
frame_id: ''
name:
- L_CROTCH_Y
- L_CROTCH_R
- L_CROTCH_P
- L_KNEE_P
- L_ANKLE_R
- L_ANKLE_P
- CHEST_Y
- LC-AI-linear-joint
- LC-AO-linear-joint
- RC-W-linear-joint
- LC-W-linear-joint
- RC-E-linear-joint
- LC-E-linear-joint
position: [0.00015912794687559303, -0.00013126947362762615, -0.5109341293645083, 1.1760409850349758, 0.000248513719677129, -0.621929533407773, -0.000435712016344022, -0.25723620888891585, 0.0001570613057798813, -0.00010196824444583892, -0.5109459927618113, 1.176033708862523, 0.00026405600006946736, -0.6219324270315635, 2.4978990728770677e-06, -0.0017088975996239417, -2.073140234539537, 0.1084099023783044, -0.058023574829095245, -1.0747267840396235, 0.07317868560597149, 0.0032100904000482025, 1.6205784723865542, 0.5235246181475844, -2.073396637452086, -0.10915019469469348, 0.05786516725301176, -1.0742435456501649, -0.07401658373418843, 0.003328953066405395, -1.6208511322518637, 0.5236036706122303, 0.2857, 0.2857, 0.2229, 0.294777, 0.2977, 0.2857, 0.2857, 0.2229, 0.2977, 0.2977, 0.2641, 0.2641, 0.1878, 0.1878]
velocity: [-1.3228298182769372e-05, 0.003776438677399348, -0.0004475842306390639, 0.0005277640174040183, 0.00017784552316915054, -1.3651984069540118e-05, 0.0005193152271762515, -1.614980274114962e-05, -2.00906204147508e-05, 0.003781257562926932, 0.0003987885595227354, -0.0001448261644036203, 0.0001767970472550341, -6.29682030487069e-06, 1.0756488468918085e-05, 8.071757825288712e-06, 0.006530372894968822, -0.0022088213690768304, -0.0016988138511383664, -0.008485019320501625, 0.0011095488166591757, -0.0024041403239194944, 0.0010985414608061655, -0.004589661263847082, -0.006443145635355184, -0.0024326191176086316, -0.0015454480678420079, 0.007643253393764543, 0.0002669792459987253, 0.002038055197724077, 0.0002605698826494082, 0.003338718115727315, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
effort: [-0.003956578081039798, -0.103970838003065, -10.348208900103906, 12.521092591095684, 0.031017161031442676, -0.12736535358104373, 0.024752505226941078, 22.123612918291016, 0.0034862249945595775, -0.2969554758624179, -10.330423298916536, 12.466804055037972, -0.021633696134477715, -0.1281664874752675, -0.00023514434759137692, 1.1822407190049664, 28.710767380445425, 4.002011405040487, 1.9539374192954484, -55.435105205047684, -0.08386314941827289, -17.16595565303094, -0.08274324761003982, -0.0006322724365340204, 29.273691838522797, -3.495521534240986, -1.4834178286291244, -55.63014000109101, -0.09213406138346147, -16.939107019010283, -0.09077836527859873, -0.00042287233021992554, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
Originally posted by etorobot on ROS Answers with karma: 30 on 2021-03-09
Post score: 1
Original comments
Comment by jayess on 2021-03-09:
What are you looking to extract?
Comment by etorobot on 2021-03-09:
@jayess just this part:
position: [0.00015912794687559303, -0.00013126947362762615, -0.5109341293645083, 1.1760409850349758, 0.000248513719677129, -0.621929533407773, -0.000435712016344022, -0.25723620888891585, 0.0001570613057798813, -0.00010196824444583892, -0.5109459927618113, 1.176033708862523, 0.00026405600006946736, -0.6219324270315635, 2.4978990728770677e-06, -0.0017088975996239417, -2.073140234539537, 0.1084099023783044, -0.058023574829095245, -1.0747267840396235, 0.07317868560597149, 0.0032100904000482025, 1.6205784723865542, 0.5235246181475844, -2.073396637452086, -0.10915019469469348, 0.05786516725301176, -1.0742435456501649, -0.07401658373418843, 0.003328953066405395, -1.6208511322518637, 0.5236036706122303, 0.2857, 0.2857, 0.2229, 0.294777, 0.2977, 0.2857, 0.2857, 0.2229, 0.2977, 0.2977, 0.2641, 0.2641, 0.1878, 0.1878]