Reading Sensor data into ROS
Using the ROS sensor message Joint_State, the values of poteneitometers can be read into ROS using the Teensy 3.2 microcontroller.
This has been tested and is now working as part of the Joint_State_Test code on the github repo.
Bellow is an example of the message printed into the ROS topic
header:
seq: 5531
stamp:
secs: 1552565641
nsecs: 853453006
frame_id: "/myBot"
name: [fore_finger_joint_one_pitch, fore_finger_joint_one_yaw, fore_finger_joint_two, fore_finger_joint_three]
position: [1.1746424436569214, 1.0226298570632935, 0.0, 0.0]
velocity: []
effort: [0.0, 0.0, 0.0, 0.0]
---
The message consists of a single Joint_State sensor message. As this message type has built in functionality to send thevalues for multiple joints, the need for the custom message has been removed, and so development along htose lines has now been discontinued.
The position values is derived from the analog read of a potentiometer and then mapped to a radian angle value using a custom float based version of the arduino map function.
The next step is to implement this code into the current finger control code, to send the current position of the joints into ROS. Then ROS control can be implemented, using ROS to send setpoints to the hand.