Giter Site home page Giter Site logo

vescuartcontrol's People

Contributors

carywin avatar imartinezl avatar pinski1 avatar rollinggecko avatar workaroundfails avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vescuartcontrol's Issues

Warning converting to non-pointer type

Hi,

I made a fresh install on another computer than the usual one that don't have any issue while compiling.
Arduino IDE 1.8.5
VescUartControl VESC6 branch library (latest version on Github).

Compiler window of Arduino IDE :

xxxxxx\Documents\Arduino\libraries\VescUartControl\VescUart.cpp: In function 'int PackSendPayload(uint8_t*, int, int)':

xxxxxx\Documents\Arduino\libraries\VescUartControl\VescUart.cpp:188:21: warning: converting to non-pointer type 'uint8_t {aka unsigned char}' from NULL [-Wconversion-null]

messageSend[count] = NULL;

                 ^

Sketch uses 11462 bytes (37%) of program storage space. Maximum is 30720 bytes.
Global variables use 981 bytes (47%) of dynamic memory, leaving 1067 bytes for local variables. Maximum is 2048 bytes.

Software Serial

It seems that using SoftwareSerial to communicate with the VESC doesn't work. It would be great to get this working so that we can use the HardwareSerial for usb while connected to the VESC.

Changing maximum duty cycle

Hello,
Has any one used this library to be able to change to maximum duty cycle, i ve been looking into this for the last month, but i was not able to success in doing it.
Apparently it should start from this function and go on : confgenerator_serialize_mcconf
But i ve been having problems passing the whole buffer or even jst part of it and every time t does not work.

Update for new VESC4 Firmware incl w/ Beta VESC-Tool

Now that the VESC6 is in Beta, the new VESC-Tool is out (Beta) and it includes new and improved firmware for the VESC4's. According to Vedder this new firmware requires some changes to UART. Can this library be modified to accommodate these changes? Or perhaps a new VescUartControl version is needed? Here is the summary (from Vedder) of what's required for the new firmware to work with VescUartControl:

"
The SetRpm and SetCurrent commands should work as before, but the GetValue command probably has to be updated. This is the way the values are sent in the latest firmware:

case COMM_GET_VALUES:
ind = 0;
send_buffer[ind++] = COMM_GET_VALUES;
buffer_append_float16(send_buffer, mc_interface_temp_fet_filtered(), 1e1, &ind);
buffer_append_float16(send_buffer, mc_interface_temp_motor_filtered(), 1e1, &ind);
buffer_append_float32(send_buffer, mc_interface_read_reset_avg_motor_current(), 1e2, &ind);
buffer_append_float32(send_buffer, mc_interface_read_reset_avg_input_current(), 1e2, &ind);
buffer_append_float32(send_buffer, mc_interface_read_reset_avg_id(), 1e2, &ind);
buffer_append_float32(send_buffer, mc_interface_read_reset_avg_iq(), 1e2, &ind);
buffer_append_float16(send_buffer, mc_interface_get_duty_cycle_now(), 1e3, &ind);
buffer_append_float32(send_buffer, mc_interface_get_rpm(), 1e0, &ind);
buffer_append_float16(send_buffer, GET_INPUT_VOLTAGE(), 1e1, &ind);
buffer_append_float32(send_buffer, mc_interface_get_amp_hours(false), 1e4, &ind);
buffer_append_float32(send_buffer, mc_interface_get_amp_hours_charged(false), 1e4, &ind);
buffer_append_float32(send_buffer, mc_interface_get_watt_hours(false), 1e4, &ind);
buffer_append_float32(send_buffer, mc_interface_get_watt_hours_charged(false), 1e4, &ind);
buffer_append_int32(send_buffer, mc_interface_get_tachometer_value(false), &ind);
buffer_append_int32(send_buffer, mc_interface_get_tachometer_abs_value(false), &ind);
send_buffer[ind++] = mc_interface_get_fault();
commands_send_packet(send_buffer, ind);
break;

"

getting additional values with VescUart

Hi,
I'm wondering if it is possible to get VESC temperature and raw ppm information via VescUart Library.
Another question: is it possible to get the datas from a second VESC connected to the first one through CAN?
I mean:
VESC1 (CAN id 0) ===can=== VESC2 (CAN id 1) ===uart=== ARDUINO
Thank you by advance for the answers.

Using SoftwareSerial

I can not seem to figure out how to implement the use of SoftwareSerial instead of Serial1, is this even possible?

Tester wanted

Hi,

I merged the updates to bldc fw 3.29 know with new functions and multi serial port support from the pull requests. Interface changed. Know the serial port must be initialized. Know the interface is much cleaner.
But I've know hardware to test the changes. Is somebody willing to test it before I merge it to the master??
Changes are in this branch: https://github.com/RollingGecko/VescUartControl/tree/VESC6

Reading rpm out of struct

Hello,
I was trying to use your new UART VESC 6 library and I can't figure out how to simply just pull the rpm member out of the struct. I read that something like Serial.println(measuredVal.rpm); should work but all I keep getting returned is 0.
Any idea what the issue is?

Debugging on a Arduino Nano

Hi,

I have been trying to use your library, with an Arduino Nano. However, I can't debug the output, while the Arduino is connected to a VESC over the hardware serial port. Is it possible to use SoftwareSerial as a means of debugging on a Nano, connecting the SoftwareSerial port to a USB to a serial device?

I have tried modifying your library, so that your VescUart.h defines DEBUGSERIAL as a SoftwareSerial, however without success.

ToDo: Add Message Handling > 255 (starting with 3)

Hi,

First off. Thank you so much for this code. A huge help!

On line 49 of VescUart.cpp, you put //ToDo: Add Message Handling > 255 (starting with 3). I'm trying to read the mcconfig, which returns the starting byte of 3 (since the payload is > 255). As a result, my code goes into case 3, which has this todo marker, and fails.

I've been trying for the last few days to complete this code using all of the documentation given by you and vedder about the communication. With a simple get firmware command, I can see exactly what's going on (I get 2, 3, 0, 2, 18, 84, 17, 3), but with the mcconfig, I get (3, 1, 26, 1, 0, ect... 3). My understanding is, you have start byte of 2, so short packet, packet length of 3, so next 3 bytes for the packet body, then 84 and 17 are the checksum, and finally, 3 is the stop byte. I don't see this pattern because I get the 3 is the start byte, so we should have a long packet body with length 1 + 26 so 27. Not over 255, so why would it be a 3?

Could you either assist me in completing this part of the code or complete it?
Quite a few people are using your code and it's a bummer that it can't do a simple get mc config command.

Thank you

Luke

Message Handler for >256 byte payload length

Hello,

Is it possible to include the VESC command "COMM_GET_MCCONF"? I tried it myself but get stuck at the comamnd "//ToDo: Add Message Handling > 255 (starting with 3)" from your "switch (messageReceived[0])".

Thank you very much.

How to use COMM_FORWARD_CAN to send commands to slave VESC

Hi there @RollingGecko

Have been searching for some code that has this function implemented so I can use it in the arduino, but so far without success. I don't know what are the transformations required in the messages to actually send such command, using the libraries that are currently created.

The idea here was to sent commands to a slave vesc, for instance, setting RPM's. I've tested the CAN master-slave communication through VESC tool and is working well. It is just the code adaptation in c++ that I have no idea how to perform. I don't even know how is supposed to work with such function, while sending a command.

I would appreciate the help of anyone who reads this. Have a nice day!

An error occurred while uploading the sketch Invalid library found

Hey can someone please explain me why i can virtify the program but when i upload the error
"
An error occurred while uploading the sketch Invalid library found in C:\Users\Simon Voss\Documents\Arduino\libraries\test: no headers files (.h)
"
comes up but no error is shown until I try to upload the programming
regards
Simon

HOW TO USE FUNCTION SETPOSITION (MOTOR CONTROL)

Hello.

Now, I'm interested in control the position of the motor.
I would like to know how the function setPosition is performed:
-it is possible without any hall sensor?
-it is possible to use one analog hall sensor (voltage proportional to angle) instead of three digital hall sensors.

I would like to know the meaning of the variable position, that is, this variable indicates how many degrees the motor rotates?

Getting "Failed to get data!" help?

I can only imagine I must be wiring it wrong. I'm using a mega, with a 4.10 vesc running 2.16.

I have uart selected as the mode and baud rate is 115200 on the vesc.

I have vesc Rx -> Tx1 and vesc Tx -> Rx1. Serial 1 in the code also has a baud rate of 115200, to match the VESC's uart baud rate.

Just trying to run the example code. But I never get a connection. Just "Failed to get data!" over and over.

Do I need to wire anything else from the vesc uart? Can't understand why this won't work other wise.

VescUartControl for Vesc tool working with Teensy 3.6 Error

Hi there, my name is Jessica.

I was wondering if anyone can provide me with some assistance. I made various endeavors to run the correct code given by RollingGrecko that allows my Arduino to communicate with my Vesc (Firmware V3.28 ) through UART. I managed to get my Arduino Mega working on a Vesc Firmware V3.28 by receiving information from my Vesc using UART. However for some odd reason, I am unable to get RollingGrecko's code to work on my Teensy 3.6.

This is the Error that I have received on my teensy 3.6(Seen below)

cannot convert 'usb_serial_class*' to 'HardwareSerial*' for argument '1' to 'void SetDebugSerialPort(HardwareSerial*)'

After hours of research, I have notice that the Teensy 3.6 runs a different processor than the Arduino Mega.
Can someone verify if they are having the same problem when using a Teensy 3.6??

Furthermore, any help with getting my Teensy 3.6 to work through UART with the new Firmware V3.28 is
greatly appreciated.

Thank you,
Sincerely
Jess :)

Compatibility with Arduino Uno

Is there any way to get this to work on Arduino Uno? I don't have a Mega or Nano.

Have been trying to edit the code to make it compatible for Uno but it doesn't seem to work.

Support fw 3.28

fw 3.28 is out with the new vesc-tool and it breaks this library. I am going to try and debug it and if i get it working i'll mention it here, but it would be nice to have this working.
right now it is returning messages of length 54, which i'm guessing is some default response considering you're checking for len >55, but haven't gotten as far as to reading the messages.

Issue when trying ti initiate the VescUART class

Please excuse the lack of knowledge.

I've been trying to program an Arduino controller for a Vesc V4 and I'm getting the following error.
I have tried to re-install the library sever times as well as uploading some of the example sketches from the Vesc UART library, and keep getting the aforementioned error on the IDE console.
Any input/help would be of great help. Thanks

Arduino: 1.8.15 (Linux), Board: "Arduino Nano, ATmega328P"

getVescValues:12:1: error: 'VescUart' does not name a type; did you mean 'getchar'?
VescUart UART;
^~~~~~~~
getchar
/home/thinkpad/Arduino/VescUart/examples/getVescValues/getVescValues.ino: In function 'void setup()':
getVescValues:20:3: error: 'Serial1' was not declared in this scope
Serial1.begin(19200);
^~~~~~~
/home/thinkpad/Arduino/VescUart/examples/getVescValues/getVescValues.ino:20:3: note: suggested alternative: 'Serial'
Serial1.begin(19200);
^~~~~~~
Serial
getVescValues:25:3: error: 'UART' was not declared in this scope
UART.setSerialPort(&Serial1);
^~~~
/home/thinkpad/Arduino/VescUart/examples/getVescValues/getVescValues.ino:25:3: note: suggested alternative: 'UDR0'
UART.setSerialPort(&Serial1);
^~~~
UDR0
/home/thinkpad/Arduino/VescUart/examples/getVescValues/getVescValues.ino: In function 'void loop()':
getVescValues:31:8: error: 'UART' was not declared in this scope
if ( UART.getVescValues() ) {
^~~~
/home/thinkpad/Arduino/VescUart/examples/getVescValues/getVescValues.ino:31:8: note: suggested alternative: 'UDR0'
if ( UART.getVescValues() ) {
^~~~
UDR0
exit status 1
'VescUart' does not name a type; did you mean 'getchar'?

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Help appreciated for ESP32

Hi,

I'm trying to get your code working with the ESP32, but I'm having this error:

 \\hrzfs01.hrz.isc.fh-kiel.de\home_st$\selnvett\Arduino\libraries\VescUartControl-master\VescUart.cpp: In function 'int ReceiveUartMessage(uint8_t*)':

\\hrzfs01.hrz.isc.fh-kiel.de\home_st$\selnvett\Arduino\libraries\VescUartControl-master\VescUart.cpp:36:9: error: 'SERIALIO' was not declared in this scope

  while (SERIALIO.available()) {

         ^

\\hrzfs01.hrz.isc.fh-kiel.de\home_st$\selnvett\Arduino\libraries\VescUartControl-master\VescUart.cpp: In function 'int PackSendPayload(uint8_t*, int)':

\\hrzfs01.hrz.isc.fh-kiel.de\home_st$\selnvett\Arduino\libraries\VescUartControl-master\VescUart.cpp:139:21: warning: converting to non-pointer type 'uint8_t {aka unsigned char}' from NULL [-Wconversion-null]

  messageSend[count] = NULL;

                     ^

\\hrzfs01.hrz.isc.fh-kiel.de\home_st$\selnvett\Arduino\libraries\VescUartControl-master\VescUart.cpp:147:2: error: 'SERIALIO' was not declared in this scope

  SERIALIO.write(messageSend, count);

  ^

\\hrzfs01.hrz.isc.fh-kiel.de\home_st$\selnvett\Arduino\libraries\VescUartControl-master\VescUart.cpp: In function 'void SerialPrint(uint8_t*, int)':

\\hrzfs01.hrz.isc.fh-kiel.de\home_st$\selnvett\Arduino\libraries\VescUartControl-master\VescUart.cpp:253:3: error: 'DEBUGSERIAL' was not declared in this scope

   DEBUGSERIAL.print(data[i]);

   ^

\\hrzfs01.hrz.isc.fh-kiel.de\home_st$\selnvett\Arduino\libraries\VescUartControl-master\VescUart.cpp:256:2: error: 'DEBUGSERIAL' was not declared in this scope

  DEBUGSERIAL.println("");

  ^

\\hrzfs01.hrz.isc.fh-kiel.de\home_st$\selnvett\Arduino\libraries\VescUartControl-master\VescUart.cpp: In function 'void SerialPrint(const bldcMeasure&)':

\\hrzfs01.hrz.isc.fh-kiel.de\home_st$\selnvett\Arduino\libraries\VescUartControl-master\VescUart.cpp:261:2: error: 'DEBUGSERIAL' was not declared in this scope

  DEBUGSERIAL.print("avgMotorCurrent: "); DEBUGSERIAL.println(values.avgMotorCurrent);

This is my code:

/*
  Name:    VescUartSample.ino
  Created: 9/26/2015 10:12:38 PM
  Author:  AC
*/

// the setup function runs once when you press reset or power the board
// To use VescUartControl stand alone you need to define a config.h file, that should contain the Serial or you have to comment the line
// #include Config.h out in VescUart.h

//Include libraries copied from VESC
#include "VescUart.h"
#include "datatypes.h"
#include <HardwareSerial.h>


HardwareSerial Serial1(1);

#define DEBUG
unsigned long count;

void setup() {

  //Setup UART port
  Serial1.begin(115200, SERIAL_8N1, 16, 17);
#ifdef DEBUG
  //SEtup debug port
  Serial.begin(115200);
#endif
}

struct bldcMeasure measuredValues;

// the loop function runs over and over again until power down or reset
void loop() {
  //int len=0;
  //len = ReceiveUartMessage(message);
  //if (len > 0)
  //{
  //  len = PackSendPayload(message, len);
  //  len = 0;
  //}

  if (VescUartGetValue(measuredValues)) {
    Serial.print("Loop: "); Serial.println(count++);
    SerialPrint(measuredValues);
  }
  else
  {
    Serial.println("Failed to get data!");
  }

}

Do you have ideas? Your help is very much appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.