Skip to main content

Canvect is a Python package designed for sending and managing CAN (Controller Area Network) messages related to acceleration control. It provides a simple yet flexible API for creating and dispatching CAN messages, making it ideal for applications in automotive and industrial systems where CAN communication is essential.

Project description

Canvect v0.1.4 Release Notes

Overiew

So, this is the newr version add on's to that Canvect is a Python package designed for sending and managing CAN (Controller Area Network) messages related to acceleration control. It provides a simple yet flexible API for creating and dispatching CAN messages, making it ideal for applications in automotive and industrial systems where CAN communication is essential.

New Features

  1. Dynamic Parameter Input: Users can now input dynamic parameters for the following
  • arbitration_id: Specify the CAN ID as a hexadecimal value.
  • seventh_byte: Set the seventh byte for the CAN message (value between 0-15).
  • channel: Define the CAN channel (e.g., 'PCAN_USBBUS2').
  • interface: Choose the CAN interface (e.g., 'pcan').
  • bitrate: Set the bitrate for the CAN bus communication (e.g., 500000).

This enhancement allows users to customize their CAN message sending directly from input prompts, making the package more versatile and user-friendly.

Installation

pip install canvect==0.1.4

Usage Examples

  1. You can now easily modify parameters like arbitration_id, bitrate, and channel to suit your specific needs:ds
from my_can_package import continuous_acceleration_send

continuous_acceleration_send(
    arbitration_id=int(input("Enter arbitration ID (hex): "), 16),  # Custom CAN ID
    seventh_byte=int(input("Enter the value for the seventh byte (0-15): ")),  # Seventh byte
    channel=input("Enter CAN channel (e.g., 'PCAN_USBBUS2'): "),  # Custom CAN channel
    interface=input("Enter CAN interface (e.g., 'pcan'): "),  # Custom interface
    bitrate=int(input("Enter bitrate (e.g., 500000): "))  # Custom bitrate
)

Example with RingBuffer

from Canvect import RingBuffer

# Create a RingBuffer with a capacity of 5 items
buffer = RingBuffer(capacity=5)

# Append items to the buffer
for i in range(10):
    buffer.append(f"message_{i}")
    print(f"Buffer after appending message_{i}: {buffer}")

# Access items by index
for i in range(len(buffer)):
    print(f"Item at index {i}: {buffer[i]}")
  1. The buffer can hold up to 5 items. Once it reaches the maximum capacity, new items will overwrite the oldest ones.

  2. You can access items using their index. If you try to access an index that is out of range, an IndexError will be raised.

Note: Here refers to above example

from my_can_package import CANBusHandler, send_Canvect_message

# Initialize CAN bus
bus_handler = CANBusHandler(channel='PCAN_USBBUS2', interface='pcan', bitrate=500000)

# Define custom CAN data (8 bytes)
data = [0x11, 0xC8, 0x00, 0x00, 0x00, 0x00, seventh_byte, 0x00]

# Send CAN message with a custom CAN ID and data
send_Canvect_message(bus_handler.bus, arbitration_id=0x200, data=data)

# Shutdown the bus after sending
bus_handler.shutdown()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

canvect-0.1.4.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

canvect-0.1.4-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file canvect-0.1.4.tar.gz.

File metadata

  • Download URL: canvect-0.1.4.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.5

File hashes

Hashes for canvect-0.1.4.tar.gz
Algorithm Hash digest
SHA256 173ccc2185c28773385b69519ad02e12a78bf8a0508df4be1fec101ea5cc6507
MD5 00ca95fad208aec0f44958712520b917
BLAKE2b-256 8ba2107df8d749e7d53547f5f1523da5825adac27beef270897717990829f7c2

See more details on using hashes here.

File details

Details for the file canvect-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: canvect-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.5

File hashes

Hashes for canvect-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0637533364d3af7b80ac164f761496e8ff06635a456b1d7b17463b3241f15637
MD5 58b7e9534e823bc0e38e484c4d7211a4
BLAKE2b-256 ab0a444a82a979bac4bc36eac12b1ed944efaa66e9da47057beffcd9407c8309

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page