ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

j3ven7's profile - activity

2021-08-23 10:33:53 -0500 received badge  Taxonomist
2019-05-20 02:31:40 -0500 marked best answer Difference in rate when running arduino w/ and without ROS

I have arduino code that takes readings from a bunch of sensors (IMU, hall sensors, encoder, gps). The details of the code are unimportant, but as it stands the loop runs at about 100hz on the arduino when ROS is not running. However, when I run ROS on my raspberry pi (which is connected to the arduino) the rate slows to about 10hz. I run all of my nodes in rospy at 100hz, so I am unsure if this delay is incurred by serial communication or something else. At the end of my arduino code my node head makes a call to spinOnce(). If I am running rospy on my raspberry pi should I be using a multi-threaded spin()? Any thoughts or other ideas? Has anyone experienced an issue like this and been able to fix it? I need to be running at at least 50 hz to get the PID controller we use working.

2019-05-20 02:06:17 -0500 marked best answer Running ROS with DMA

I have an Arduino Due configured to use DMA with the following library: https://github.com/rblilja/DmaSerial . However, when I try to run the code in my sketch I get the following error /ros_lib/ArduinoHardware.h:72:19: error: 'Serial' was not declared in this scope iostream = &Serial; I changed the extern reference to the Serial variable in the variant.h file from a UARTClass object to a DmaSerial object, called dmaSerial, which fixed the error above, but I still run into errors, and I am unsure exactly what to change in ROS to allow ROS to be configured with the arduino DMA. I currently get the following error,

undefined reference to `dmaSerial'

but it's on a line where there isn't even any code in my sketch, which is peculiar. If anyone has done this before or understands ROS well enough to tackle this issue that would be of great help.

2018-09-15 01:47:34 -0500 received badge  Famous Question (source)
2018-05-12 00:34:18 -0500 received badge  Famous Question (source)
2018-01-25 14:31:37 -0500 received badge  Famous Question (source)
2017-10-16 17:38:02 -0500 marked best answer Subscribers not making callbacks

I have a listener function that subscribes to two topics as shown below, but the callbacks (which I confirmed are updating) don't seem to update some variables in the listener. I confirm that the variable (in this case gps_xy) is updated in the gps callback, but for some reason, the value is never modified in listener(). I thought since python is multi-threaded that spinning should not be necessary but I could be wrong. Any ideas? Also this code is executable, I call the listener in a standard if __name__ == '__main__':

def listener():

    pub = rospy.Publisher('kalman_pub', Float32MultiArray, queue_size=10) 
    rospy.init_node('kalman', anonymous=True)
    rospy.Subscriber("bike_state", Float32MultiArray, bike_state)
    rospy.Subscriber("gps", Float32MultiArray, gps)
    #rospy.spin()  
    rate = rospy.Rate(5)
    #Run until the nodes are shutdown (end.sh run OR start.sh was killed)
    while not rospy.is_shutdown():
        dim = [MultiArrayDimension('data', 1, 4)]
        layout = MultiArrayLayout(dim, 0)
        # The Kalman filter wants the GPS data in matrix form
        #Build matrix from gps x,y coordinates and bike velocity and yaw
        gps_matrix = np.matrix(gps_xy + bike_yv + time_step)
        #rospy.loginfo(gps_matrix)
        #save gps state values for later plotting
        gps_data.append(gps_matrix)
        C = np.matrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])
        #If we have 
        if len(gps_data) == 1:
            P_initial = np.matrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]])
            x_pos = gps_matrix[:,0]
            y_pos = gps_matrix[:,1]
            yaw = gps_matrix[:,2]
            v = gps_matrix[:,3]
            v_0 = v.item(0)
            yaw_0 = yaw.item(0)
            x_dot_0 = v_0 * np.cos(yaw_0)
            y_dot_0 = v_0 * np.sin(yaw_0)
            s_initial = np.matrix([[x_pos.item(0)], [y_pos.item(0)], [x_dot_0], [y_dot_0]])
            #output matrix - returns a tuple - first entry - kalman state (x,y,x',y')
            #                             - second entry - prediction error (p)
            output_matrix = kalman_real_time.kalman_no_loop(gps_matrix, C, s_initial, P_initial)
        else:
            output_matrix = kalman_real_time.kalman_no_loop(gps_matrix, C, 
                                                 kalman_state_matrix, p_state_matrix) 
        #rospy.loginfo(output_matrix.shape)
        kalman_state_matrix = output_matrix[0] 
        p_state_matrix = output_matrix[1]                                           
        #Change output_matrix to a standard array for publishing
        kalman_state = output_matrix[0].flatten().tolist()[0]
        #rospy.loginfo(kalman_state)
        p_state = output_matrix[1].flatten()
        #save predicted state values for later plotting
        #kalman_data.append(kalman_state_matrix) 
        #pub.publish(layout, kalman_state)
        pub.publish(layout, kalman_state)
        rate.sleep()
2017-10-06 14:44:11 -0500 received badge  Notable Question (source)
2017-10-02 09:38:48 -0500 received badge  Famous Question (source)
2017-09-30 18:11:37 -0500 received badge  Notable Question (source)
2017-09-08 08:32:19 -0500 received badge  Notable Question (source)
2017-08-16 22:31:55 -0500 received badge  Popular Question (source)
2017-08-15 10:21:57 -0500 edited question Running ROS with DMA

Running ROS with DMA I have an Arduino Due configured to use DMA with the following library: https://github.com/rblilja/

2017-08-15 10:17:57 -0500 asked a question Running ROS with DMA

Running ROS with DMA I have an Arduino Due configured to use DMA with the following library: https://github.com/rblilja/

2017-08-14 10:40:51 -0500 received badge  Notable Question (source)
2017-08-10 14:29:04 -0500 commented answer Difference in rate when running arduino w/ and without ROS

I hope this info helps ^ I haven't modified serial_node.py which is sort of concerning and I only publish in my arduino

2017-08-10 14:28:58 -0500 commented answer Difference in rate when running arduino w/ and without ROS

I hope this info helps ^ I haven't modified serial_node.py which is sort of concerning and I only publish in my arduino

2017-08-10 12:03:30 -0500 commented answer Difference in rate when running arduino w/ and without ROS

I hope this info helps ^ I haven't modified serial_node.py which is sort of concerning and I only publish in my arduino

2017-08-10 12:02:57 -0500 commented answer Difference in rate when running arduino w/ and without ROS

I have four total nodes, one of which is serial_node.py from the rosserial_python library. When I run the other three no

2017-08-10 11:33:07 -0500 received badge  Popular Question (source)
2017-08-09 11:32:22 -0500 asked a question Difference in rate when running arduino w/ and without ROS

Difference in rate when running arduino w/ and without ROS I have arduino code that takes readings from a bunch of senso

2017-08-09 10:13:04 -0500 received badge  Popular Question (source)
2017-08-03 02:12:14 -0500 received badge  Popular Question (source)
2017-08-02 10:48:22 -0500 edited question Subscribers not making callbacks

Subscribers not making callbacks I have a listener function that subscribes to two topics as shown below, but the callba

2017-08-02 10:38:58 -0500 edited question Subscribers not making callbacks

Subscribers not making callbacks I have a listener function that subscribes to two topics as shown below, but the listen

2017-08-02 10:25:19 -0500 received badge  Editor (source)
2017-08-02 10:25:19 -0500 edited question Subscribers not making callbacks

Subscribers not making callbacks I have a listener function that subscribes to two topics as shown below, but the listen

2017-08-02 10:24:54 -0500 edited question Subscribers not making callbacks

Subscribers not making callbacks I have a listener function that subscribes to two topics as shown below, but the listen

2017-08-02 10:24:28 -0500 asked a question Subscribers not making callbacks

Subscribers not making callbacks I have a listener function that subscribes to two topics as shown below, but the listen

2017-07-26 12:18:34 -0500 asked a question Arduino Serial delay

Arduino Serial delay I am running ROS on a raspi 3 which is connected over serial to an Arduino due. It seems when I sta

2017-07-26 12:18:34 -0500 asked a question Delay in Serial

Delay in Serial I have an Arduino due connected to a raspi running ROS. It seems that when I start ROS I incur a massive