You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to read the rpm of motor, which is actually connected to VESC 4 on firmware version 5. Hereby I am using PyVESC method to send the message from Jetson to VESC. With PyVESC, it send the message to VESC, which RPM or/and Current it should give to the VESC in order to get the desired rpm from the motor. Below you can see this in the code. But, i am not able to read the return value which gives motor. Here, I get "None".
import pyvesc
import serial
import time
import datetime
from pyvesc import GetValues, SetRPM, SetCurrent, SetRotorPositionMode, GetRotorPosition
port_object = serial.Serial("/dev/ttyACM0",115200, timeout=0.1)
message = pyvesc.SetRPM(10000)
cumessage = pyvesc.SetCurrent(10000)
packet = pyvesc.encode(message)
cupacket = pyvesc.encode(cumessage)
while True:
data = ''
port_object.write(packet)
port_object.write(cupacket)
print("data; ", port_object.in_waiting)
#data = port_object.read(5)
#print(data)
port_object.write(pyvesc.encode_request(GetValues))
#print(port_object.in_waiting)
# Check if there is enough data back for a measurement
if port_object.in_waiting > 78:
(response, consumed) = pyvesc.decode(78)
#packets = []
#now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")
print("response: ",response)
print("consumed: ", consumed)
"""for sensor, value in response.__dict__.items():
data = {}
data['measurement'] = sensor
data['tags'] = {}
data['tags']['source'] = 'vesc'
data['time'] = now
data['fields'] = {}
data['fields']['value'] = value
packets.append(data)"""
#print(data)
#port_object.flush()
#VESCMessage = pyvesc.GetVaĺues()
#packet = pyvesc.decode(VESCMessage)
#print(pa)
I am trying to read the rpm of motor, which is actually connected to VESC 4 on firmware version 5. Hereby I am using PyVESC method to send the message from Jetson to VESC. With PyVESC, it send the message to VESC, which RPM or/and Current it should give to the VESC in order to get the desired rpm from the motor. Below you can see this in the code. But, i am not able to read the return value which gives motor. Here, I get "None".
this is the result:
Does anyone know what is the problem here, why it gets none? what could be the best solutions? Would be really great! Thanks in Advance.
The text was updated successfully, but these errors were encountered: