gmnvh / pycarmaker

Class to control and read information from CarMaker (https://ipg-automotive.com/)
42 stars 13 forks source link

Could not install Pycarmaker #10

Closed JeevaPeriasamy closed 3 years ago

JeevaPeriasamy commented 3 years ago

Could anyone explain how to install pycarmaker for a beginner :)

I have IPG\hil\win32-7.1.4. from carmaker I have to read few data(lat,long,Heave,Roll,Pitch and Yaw) and send it via udp; Code to send via UDP is available at the end

For capturing these data from carmaker I thought your script would be useful. But I could not access it. Could you please explain step by step things that needs to be done

----------- Beginning of script ---------------------

import socket

function to send udp data

def UdpBc( MESSAGE ): UDP_IP = "127.0.0.1" UDP_PORT = 5005

print("UDP target IP: %s" % UDP_IP) print("UDP target port: %s" % UDP_PORT) print("message: %s" % MESSAGE)

convert string to bytes since sock.sendto requires in byte

MESSAGE = str.encode(MESSAGE) sock = socket.socket(socket.AF_INET, # Internet socket.SOCK_DGRAM) # UDP sock.sendto(MESSAGE, (UDP_IP, UDP_PORT)) return;

send

UdpBc("S~;Long=3.0Lat=0.699Heave=0.0Roll=0.000RS;Pitch=0.001RS;Yaw=0.000RS;~E")

-----------End of Script--------------------

JeevaPeriasamy commented 3 years ago

It is working perfectly!! for someone new to python

  1. place the file (https://github.com/gmnvh/pycarmaker/blob/master/pycarmaker/CarMaker.py) in the same folder where your scripts are there
  2. rename the file name to pycarmaker.py
  3. start CM with C:\IPG\carmaker\win64-8.0.2\bin\CM.exe -cmdport 16660 and run your maneuver
  4. now run the script

May be there are some easier ways or professional way, but this worked for me

thanks to @gmnvh @gokhanalcan @HemaZ for your work on this repository

gmnvh commented 3 years ago

@JeevaPeriasamy Sorry for the late reply !! I was on vacation last week. I am glad you got all working.