Matlab Communication
Welcome to Redshift Labs › Forums › UM7 Product Support › Matlab Communication
Tagged: Новинки Порно Видео в HD
- This topic has 10 replies, 3 voices, and was last updated 3 years, 2 months ago by
Petr Tecilla.
-
AuthorPosts
-
8 June 2015 at 8:54 am #758
Thomas
GuestHi,
I want to read data from the UM7 from Matlab. I used the example code and just tried to run the init.m, this is what i get in Matlab2014:
Undefined function or variable “got_temperature_data”.
Error in DUT_callback (line 73)
if got_temperature_data && got_gyro_dataError in instrcb (line 36)
feval(val{1}, obj, eventStruct, val{2:end});Warning: The BytesAvailableFcn is being disabled. To enable the callback property
either connect to the hardware with FOPEN or set the BytesAvailableFcn property.What can I do to make it work? Unfortunately I don’t have any experience in serial communication with Matlab yet. Thanks in advance!
15 August 2015 at 8:47 pm #838Manish Mittal
GuestI also have exactly the same query. Please reply as it is very necessary for my thesis work that I am doing.
17 August 2015 at 12:51 pm #842Caleb Chamberlain
MemberThe Matlab script that can be downloaded from the site is a snippet designed to illustrate how to use serial port callbacks to read and parse data for the UM7, from within Matlab. You can delete the references to got_temperature_data and got_gyro_data.
Basically, the serial callback function reads bytes in from the serial port and parses them. When a packet is received, you can check the packet type and address bytes to see if it is the data that you are interested in. If it is, you can log it, or set a flag (like got_temperature_data), or whatever you want to do with it.
23 August 2015 at 8:48 pm #862Manish Mittal
GuestCan you please write an example code to get the euler angel from the orientation sensor? It would be really helpful.
23 August 2015 at 9:13 pm #863Manish Mittal
GuestI got to communicate with UM6 using MATLAB. Can you please tell me the address for the Euler angle data packet?
24 August 2015 at 9:31 am #864Caleb Chamberlain
MemberSure, the Euler Angle data begins in register 112 (0x70). You can find that information in the datasheet, here: http://www.chrobotics.com/docs/UM7_Datasheet.pdf
7 November 2015 at 9:50 pm #983Manish Mittal
GuestHi Caleb,
I was able to get the Euler Angle Data from the sensor using the MATLAB example code written by you. Now I want to store it in a variable matrix so that I can use it for further calculations. I used the Userdata attribute of the callback. function object to store the data. I did something like:
gyro_x = typecast( flipud(uint8(packet.data(1:2))), ‘int16’ )/100;
gyro_y = typecast( flipud(uint8(packet.data(3:4))), ‘int16’ )/100;
gyro_z = typecast( flipud(uint8(packet.data(5:6))), ‘int16’ )/100;h1 = [gyro_x, gyro_y, gyro_z];
h = [h; h1; h1]
obj.Userdata = h;I thought that it would return an ever-increasing (number of rows will continuously increase storing the real time data) matrix with the gyro_x, gyro_y, gyro_z values. But the Userdata matrix has just one row which contains the latest values of the three variables. Its like its just updating the last row after each loop run. I am not sure if I am doing anything wrong. Can you please tell me know if there is anything wrong or if there is any other way to store the real time data from the callback function in the base workspace for later usage.
7 November 2015 at 9:52 pm #984Manish Mittal
GuestActually it is just
h = [h; h1]; (and not h = [h; h1; h1];)
Please suggest.
28 November 2016 at 8:27 pm #1722Daniel Piedrahita
GuestHi Manish,
You mentioned that you were able to get the Euler Angle Data from the sensor into Matlab. Would you mind sharing your code? I am working on a similar problem now. Any help would be much appreciated.
Thanks,
Daniel11 March 2020 at 1:45 pm #9130Mehedi Hasan
ParticipantHi Manish,
can you please share the code??
Here is my email- mehedimhmpc@gmail.com16 September 2020 at 10:05 am #9690Petr Tecilla
ParticipantHello..in my case the issue is there is no data being read so it gets stuck in the while loop while verifying. My arduino code successfully prints to the serial monitor so I think it’s fine.
-
AuthorPosts
- The forum ‘UM7 Product Support’ is closed to new topics and replies.