Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replicate candump in GO #224

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Conversation

Jinwoo-H
Copy link
Contributor

@Jinwoo-H Jinwoo-H commented Oct 7, 2024

Replicates functionality of candump within GO. Uses the can package by brutella (https://github.com/brutella/can)

close #214

datalogging/can_recieve.go Outdated Show resolved Hide resolved
datalogging/can_recieve.go Outdated Show resolved Hide resolved
datalogging/can_recieve.go Outdated Show resolved Hide resolved
datalogging/can_recieve.go Outdated Show resolved Hide resolved
datalogging/can_recieve.go Outdated Show resolved Hide resolved
datalogging/can_recieve.go Outdated Show resolved Hide resolved
datalogging/vcan_setup.sh Outdated Show resolved Hide resolved
datalogging/vcan_setup.sh Show resolved Hide resolved
datalogging/can_recieve.go Outdated Show resolved Hide resolved
datalogging/can_recieve.go Outdated Show resolved Hide resolved
datalogging/can_receive.go Outdated Show resolved Hide resolved
@samparent97
Copy link
Contributor

samparent97 commented Oct 8, 2024

Checkout the Canlink package in the HIL repo. We have this functionality already. The package does require some work though. @langei would you be able to set up a call with Jinwoo to go over the current status?

@BlakeFreer
Copy link
Contributor

Checkout the Canlink package in the HIL repo. We have this functionality already. The package does require some work though. @langei would you be able to set up a call with Jinwoo to go over the current status?

The purpose of this issue was not to just replicate candump. In that case then yes, the HIL code would work. This candump program is supposed to grow into the whole data logging project. We can look at the HIL code for inspiration but it won't replace this code.

@samparent97
Copy link
Contributor

samparent97 commented Oct 9, 2024

The purpose of this issue was not to just replicate candump. In that case then yes, the HIL code would work. This candump program is supposed to grow into the whole data logging project. We can look at the HIL code for inspiration but it won't replace this code.

@BlakeFreer and I had a discussion offline about this and the canlink package in the hil repo serves the purpose of the data logging project (this was its intention last year). We need to evaluate what is working, what isn't and what the next steps are for canlink.

@Jinwoo-H
Copy link
Contributor Author

The purpose of this issue was not to just replicate candump. In that case then yes, the HIL code would work. This candump program is supposed to grow into the whole data logging project. We can look at the HIL code for inspiration but it won't replace this code.

@BlakeFreer and I had a discussion offline about this and the canlink package in the hil repo serves the purpose of the data logging project (this was its intention last year). We need to evaluate what is working, what isn't and what the next steps are for canlink.

I'm attempting to use canlink for this, and here's a few things I noticed

The readme instructs me to increase an instance of Tracer with:

  1. Create an instance of Tracer with the NewTracer() function.
    A can interface, directory and logger must be provided as arguments.
    Functional options are available of type TracerOption if required.

    func main() {
        tracer := canlink.NewTracer(
            "can0",
            "/opt/traces",
            logger,
            canlink.WithBusName("PT"),
            canlink.WithTimeout(5*time.Minute))
    }

However just initializing with the can interface, directory, and logger attributes gives an error for insufficient arguments. Additionally, the line canlink.WithBusName("PT") has the error cannot use canlink.WithBusName("PT") (value of type canlink.TracerOption) as net.Conn value in argument to canlink.NewTracer: canlink.TracerOption does not implement net.Conn (missing method Close).

This is the first thing that would have to be fixed before I can evaluate further, is it possible to go over with or is there any documentation on how canlink works so I can work on getting it running?

@langei
Copy link

langei commented Oct 18, 2024

The purpose of this issue was not to just replicate candump. In that case then yes, the HIL code would work. This candump program is supposed to grow into the whole data logging project. We can look at the HIL code for inspiration but it won't replace this code.

@BlakeFreer and I had a discussion offline about this and the canlink package in the hil repo serves the purpose of the data logging project (this was its intention last year). We need to evaluate what is working, what isn't and what the next steps are for canlink.

I'm attempting to use canlink for this, and here's a few things I noticed

The readme instructs me to increase an instance of Tracer with:

  1. Create an instance of Tracer with the NewTracer() function.
    A can interface, directory and logger must be provided as arguments.
    Functional options are available of type TracerOption if required.
    func main() {
        tracer := canlink.NewTracer(
            "can0",
            "/opt/traces",
            logger,
            canlink.WithBusName("PT"),
            canlink.WithTimeout(5*time.Minute))
    }

However just initializing with the can interface, directory, and logger attributes gives an error for insufficient arguments. Additionally, the line canlink.WithBusName("PT") has the error cannot use canlink.WithBusName("PT") (value of type canlink.TracerOption) as net.Conn value in argument to canlink.NewTracer: canlink.TracerOption does not implement net.Conn (missing method Close).

This is the first thing that would have to be fixed before I can evaluate further, is it possible to go over with or is there any documentation on how canlink works so I can work on getting it running?

@Jinwoo-H the tracer has been updated, but the documentation was not. The socketcan connection is now passed in as a fourth required parameter to the tracer. This is why you are getting the error cannot use canlink.WithBusName("PT") (value of type canlink.TracerOption) as net.Conn value in argument to canlink.NewTracer: canlink.TracerOption does not implement net.Conn (missing method Close).

Create the connection like below and use it to create your Tracer.

conn, err := socketcan.DialContext(context.Background(), "can", "can0")
    if err != nil {
        ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DataLog: Replicate candump
4 participants