0

Environment: Python v2.x in Windows OS.

Question: I am using COM4 to communicate with a robot. I notice that I cannot get complete return in my Python code when I send "getver(ion)" cmd to robot.

To be specific, my current code is:

########## open COM4 
ser = serial.Serial(3)
########## send cmd 'getver' 

ser.write ("testmode on \n")
ser.write ("getver \n")
print ser.read()

########### return

Component,Major,Minor,Build,Aux

APPassword,956FC721

BaseID,1.2,1.0,18000,2000,

BatteryType,4,LIION_4CELL_SMART,

Beehive URL, beehive.cloud.com

BlowerType,1,BLOWER_ORIG,

Bootloader Version,27828,,

BrushMotorType,1,BRUSH_MOTOR_ORIG,

BrushSpeed,1400,,

BrushSpeedEco,800,,

ChassisRev,1,,

Cloud Selector, 2

However, the right return is this:

Component,Major,Minor,Build,Aux

APPassword,956FC721

BaseID,1.2,1.0,18000,2000,

BatteryType,4,LIION_4CELL_SMART,

Beehive URL, beehive.cloud.com

BlowerType,1,BLOWER_ORIG,

Bootloader Version,27828,,

BrushMotorType,1,BRUSH_MOTOR_ORIG,

BrushSpeed,1400,,

BrushSpeedEco,800,,

ChassisRev,1,,

Cloud Selector, 2

DropSensorType,1,DROP_SENSOR_ORIG,

LCD Panel,137,240,124,

LDS CPU,F2802x/c001,,

LDS Serial,KSH13315AA-0000153,,

LDS Software,V2.6.15295,0000000001,

LDSMotorType,2,LDS_MOTOR_MABUCHI,

Locale,1,LOCALE_USA,

MagSensorType,1,MAG_SENSOR_ORIG,

MainBoard Serial Number,OPS13115,544a1696de32,

MainBoard Version,1,,

Model,BotVacConnected,905-0143,

QAState,QA_STATE_APPROVED

Serial Number,KSH13715,544a1696de32,P

SideBrushPower,1500,,

SideBrushType,2,SIDE_BRUSH_VORWERK_REV1,

SmartBatt Data Version,2048

SmartBatt Device Chemistry,LION

SmartBatt Device Name,F164A1028

SmartBatt Manufacturer Name,Panasonic

SmartBatt Mfg Year/Month/Day,2095,10,6

SmartBatt Serial Number,14592

SmartBatt Software Version,1280

Software,2,0,0,46,28146

UI Board Hardware,0,0,

UI Board Software,1,3,

UI Name,Davinci

UI Version,1.0.0

VacuumPwr,80,,

VacuumPwrEco,65,,

WallSensorType,1,WALL_SENSOR_ORIG,

WheelPodType,1,WHEEL_POD_ORIG,

As you can see, the return from python is not complete, um...then how to display the full info? Thanks in advance.

Ben
  • 6,687
  • 2
  • 33
  • 46
Amber.G
  • 1,343
  • 5
  • 12
  • 16

1 Answers1

0

I know some electronics and robotics, but I cannot predict what exact could happen, so I have some ideas to check only ;)

1) I wonder to know what did you get when call recieve again. I think it could help.

2) set exact bytes to recieve in read() method. it is described here,

TL;DR below:

While True:
    bytesToRead = ser.inWaiting()
    ser.read(bytesToRead)

3) Try to initialize Serial object with timeout = None - maybe it just waits, or default is too small ;)

I will edit that when you check that sth not working, and if I will have new idea.

Regards and sorry for my English.

Community
  • 1
  • 1
Volodia
  • 84
  • 1
  • 1
  • 6
  • Thanks for the input, Volodia. The output now looks like an infinite loop, keep printing out [omitting some output]...um... – Amber.G Nov 24 '15 at 21:13