Coder Social home page Coder Social logo

jodle001 / ros2_pyads Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 34 KB

This is a ros2 package that will be a wrapper around the pyads library to have communication between ros2 and beckhoff PLCs.

Python 95.46% CMake 4.54%
beckhoff beckhoff-twincat-plc python python3 ros2 ros2-humble pyads

ros2_pyads's Introduction

Top Langs

Anurag's GitHub stats

ros2_pyads's People

Contributors

jodle001 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

mdevhurt100

ros2_pyads's Issues

This function in ads_com "write_by_name" should return a boolean value.

Here is the function in question. which doesn't return any boolean value.

def write_by_name(self, var_name, var_value, var_type):
"""
Write a variable to the PLC by name.
:param var_name: The name of the variable to write (e.g., 'MAIN.testVar')
:param var_value: The value of the variable to write (e.g., 5)
:param var_type: The type of the variable to write (e.g., pyads.PLCTYPE_DWORD)
"""
with pyads.Connection(self.remote_ads, pyads.PORT_TC3PLC1, self.plc_ip) as plc:
plc.write_by_name(var_name, var_value, var_type)

Here is where it is returning false in every case:

success = self.ads_com.write_by_name(
var_name='MAIN.bTest',
var_value=not self.ads_com.read_by_name('MAIN.bTest', pyads.PLCTYPE_BOOL), # Toggle the existing value
var_type=pyads.PLCTYPE_BOOL)
if not success:
self.get_logger().error('Failed to write variable to PLC')

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.