Joint plot frequency


I’m implementing a motor control task in which a cerebellar model is able control a robotic arm. I generate in a transfer function a desired sinusoidal trajectory (position and velocity) with a frequency of 1Hz. The cerebellar model must generate the torque commands required to perform that trajectory in the robotics arm. In order to know if the robot properly performs the task, I need to compare the desired and actual trajectories using the “joint plot window”. I plot the current trajectories using the next transfer function:

from sensor_msgs.msg import JointState
@nrp.MapRobotSubscriber(“joints”, Topic("/joint_states", JointState))
@nrp.MapVariable(“Desired_pos_0”, global_key=“Desired_pos_0”, initial_value=0, scope=nrp.GLOBAL)
@nrp.MapVariable(“Desired_vel_0”, global_key=“Desired_vel_0”, initial_value=0, scope=nrp.GLOBAL)
@nrp.Neuron2Robot(Topic(’/robot/joint_states’, JointState))
def joint_states_passthrough (t, joints, Desired_pos_0, Desired_vel_0):
joints = joints.value
return joints

¿How could I also plot the desired trajectories represented by the variables “Desired_pos_0” and “Desired_vel_0”?.
Additionally, I execute this transfer functions each 0.002s. Nevertheless, the “joint plot window” just plots a new value each 0.5s (plotting frequency of 2Hz). How could I increase the plotting frequency to properly see the desired and actual trajectories?.



I am taking a look to your problem.