I am unable to actuate/control the actuator via rqt_gui. Although I am able to do the same using the web-shell by publishing to the control topic.
Could someone tell me where I am going wrong?
rostopic pub /mira/roll_joint_position_controller/command std_msgs/Float64 "data: 0.2"
Hello @arnab007,
I am following the solution for Exercise 2.3, and it seems that the problem is the rate 1.0 in combination with the expression sin(i/100).
Possible solutions:
- Keep your rate at 1.0 but you have to change the expression to sin(i/10)
- Set your rate to 100 and you can use the expression sin(i/100).
Like in the following image:

Hope this helps,
Roberto
hi @rzegers
Just trying to verify that the variable āiā in the sine expression is the frequency rate yes?
Hello @mamojiz97,
the āiā counter in the Python expression sin(i/10) does not represent the frequency rate. It represents the number of messages that have been published so far by the RQT message publisher plugin. The āiā counter begins with 1 and will continue to increase as long as you keep publishing messages using the plugin.
In this case we use the expression sin(i/10) and the value of the āiā counter to generate a sinusoidal waveform, where the amplitude of the waveform varies as a function of āiā (the number of messages published). The division by 10 is used to control the period of the waveform.
For instance here are the first 40 values for the expression sin(i/10) when the counter āiā starts from one, rounded to two decimal places:
sin(1/10) = 0.10
sin(2/10) = 0.20
sin(3/10) = 0.31
sin(4/10) = 0.39
sin(5/10) = 0.50
sin(6/10) = 0.59
sin(7/10) = 0.68
sin(8/10) = 0.77
sin(9/10) = 0.84
sin(10/10) = 0.87
sin(11/10) = 0.89
sin(12/10) = 0.90
sin(13/10) = 0.90
sin(14/10) = 0.88
sin(15/10) = 0.85
sin(16/10) = 0.81
sin(17/10) = 0.76
sin(18/10) = 0.71
sin(19/10) = 0.64
sin(20/10) = 0.57
sin(21/10) = 0.49
sin(22/10) = 0.41
sin(23/10) = 0.32
sin(24/10) = 0.23
sin(25/10) = 0.14
sin(26/10) = 0.04
sin(27/10) = -0.06
sin(28/10) = -0.16
sin(29/10) = -0.25
sin(30/10) = -0.34
sin(31/10) = -0.43
sin(32/10) = -0.51
sin(33/10) = -0.58
sin(34/10) = -0.64
sin(35/10) = -0.70
sin(36/10) = -0.75
sin(37/10) = -0.79
sin(38/10) = -0.83
sin(39/10) = -0.86
sin(40/10) = -0.88
Note that the values oscillate between -1 and 1, with a period of 20 (since the division factor is 10).
If you wanted to control the frequency rate of the waveform, you would need to adjust the rate at which messages are published using the RQT message publisher plugin. The frequency of the waveform would then be determined by the rate at which messages are being published.
Hope this helps,
Roberto
1 Like